fix(bootstrap): keep unvalidated config values out of the safe boot error (Q-6.9-10)
On CONFIG_SCHEMA_INVALID the loader copied the raw RELEASE_ID and CONFIG_SCHEMA_VERSION strings (up to the 64 KB body limit) into the "safe" error that BootErrorShell and diagnostics show, contradicting the file's own contract. The error now carries the schema version only when it passed the version gate (no validator issue at CONFIG_SCHEMA_VERSION) and never the release id of a rejected document. Verified: two cases in tests/runtime-schema/runtime-config.test.ts (invalid field with a 10 KB RELEASE_ID; unsupported 10 KB version) RED before, green after; test:runtime-schema and all gates PASS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
40659de7ec
commit
924ef3891c
@@ -116,16 +116,18 @@ export async function loadRuntimeConfig(
|
||||
|
||||
const validated = validateRuntimeConfig(rawConfig);
|
||||
if (!validated.success) {
|
||||
// Q-6.9-10. Only a value that passed a check reaches the safe error. The
|
||||
// declared schema version did when it selected a parser; nothing else in
|
||||
// a rejected document did (RELEASE_ID could be 64 KB of anything).
|
||||
const versionAccepted = !validated.issues.some(
|
||||
(issue) => issue.path === "CONFIG_SCHEMA_VERSION",
|
||||
);
|
||||
throw new BootConfigError("CONFIG_SCHEMA_INVALID", {
|
||||
buildId: buildConfig.buildId,
|
||||
configSchemaVersion:
|
||||
typeof rawConfig.CONFIG_SCHEMA_VERSION === "string"
|
||||
versionAccepted && typeof rawConfig.CONFIG_SCHEMA_VERSION === "string"
|
||||
? rawConfig.CONFIG_SCHEMA_VERSION
|
||||
: undefined,
|
||||
releaseId:
|
||||
typeof rawConfig.RELEASE_ID === "string"
|
||||
? rawConfig.RELEASE_ID
|
||||
: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user