Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging for older runtimes for runtime-api decoration #5988

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions packages/api/src/base/Decorate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {

this.#runtimeLog[implName] = true;

for (let i = 0, scount = sections.length; i < scount; i++) {
if (isApiInMetadata) {
if (isApiInMetadata) {
for (let i = 0, scount = sections.length; i < scount; i++) {
const [_section, secs] = sections[i];
const sec = secs[0];
const sectionHash = blake2AsHex(_section, 64);
Expand All @@ -563,7 +563,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {

named[section][method] = objectSpread({ method, name: `${_section}_${_method}`, section, sectionHash }, def);
}
} else {
}
} else {
for (let i = 0, scount = sections.length; i < scount; i++) {
const [_section, secs] = sections[i];
const sectionHash = blake2AsHex(_section, 64);
const rtApi = apis.find(([a]) => a.eq(sectionHash));
Expand Down Expand Up @@ -594,21 +596,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
older.push(`${_section}/${rtApi[1].toString()} (${all.join('/')} known)`);
}
}
}

// find the runtimes that we don't have hashes for
const notFound = apis
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
.filter(([a]) => !hashes[a])
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);
// find the runtimes that we don't have hashes for
const notFound = apis
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
.filter(([a]) => !hashes[a])
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);

if (!this._options.noInitWarn && !hasLogged) {
if (older.length) {
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
}
if (!this._options.noInitWarn && !hasLogged) {
if (older.length) {
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
}

if (notFound.length) {
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
}
if (notFound.length) {
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
}
}
}
Expand Down
Loading