refactor: replace 156k-line generated baselines with SHA-256 hash files

Config and Plugin SDK drift detection now compares SHA-256 hashes instead
of full JSON content. The .sha256 files (6 lines total) are tracked in git;
the full JSON baselines are gitignored and generated locally for inspection.

Same CI guarantee, zero repo churn on schema changes.
This commit is contained in:
Peter Steinberger
2026-04-04 16:46:07 +09:00
parent b4e9802ef3
commit b5265a07d7
17 changed files with 124 additions and 156374 deletions

View File

@@ -19,24 +19,14 @@ const result = await writeConfigDocBaselineArtifacts({
if (checkOnly) {
if (!result.changed) {
console.log(
[
`OK ${path.relative(repoRoot, result.jsonPaths.combined)}`,
`OK ${path.relative(repoRoot, result.jsonPaths.core)}`,
`OK ${path.relative(repoRoot, result.jsonPaths.channel)}`,
`OK ${path.relative(repoRoot, result.jsonPaths.plugin)}`,
].join("\n"),
);
console.log(`OK ${path.relative(repoRoot, result.hashPath)}`);
process.exit(0);
}
console.error(
[
"Config baseline drift detected.",
`Expected current: ${path.relative(repoRoot, result.jsonPaths.combined)}`,
`Expected current: ${path.relative(repoRoot, result.jsonPaths.core)}`,
`Expected current: ${path.relative(repoRoot, result.jsonPaths.channel)}`,
`Expected current: ${path.relative(repoRoot, result.jsonPaths.plugin)}`,
"If this config-surface change is intentional, run `pnpm config:docs:gen` and commit the updated baseline files.",
`Hash mismatch: ${path.relative(repoRoot, result.hashPath)}`,
"If this config-surface change is intentional, run `pnpm config:docs:gen` and commit the updated hash file.",
"If not intentional, treat this as docs drift or a possible breaking config change and fix the schema/help changes first.",
].join("\n"),
);
@@ -45,9 +35,10 @@ if (checkOnly) {
console.log(
[
`Wrote ${path.relative(repoRoot, result.jsonPaths.combined)}`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.core)}`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.channel)}`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.plugin)}`,
`Wrote ${path.relative(repoRoot, result.hashPath)}`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.combined)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.core)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.channel)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.jsonPaths.plugin)} (gitignored, local only)`,
].join("\n"),
);

View File

@@ -24,23 +24,21 @@ async function main(): Promise<void> {
console.error(
[
"Plugin SDK API baseline drift detected.",
`Expected current: ${path.relative(repoRoot, result.jsonPath)}`,
`Expected current: ${path.relative(repoRoot, result.statefilePath)}`,
"If this Plugin SDK surface change is intentional, run `pnpm plugin-sdk:api:gen` and commit the updated baseline files.",
`Hash mismatch: ${path.relative(repoRoot, result.hashPath)}`,
"If this Plugin SDK surface change is intentional, run `pnpm plugin-sdk:api:gen` and commit the updated hash file.",
"If not intentional, treat this as API drift and fix the plugin-sdk exports or metadata first.",
].join("\n"),
);
process.exit(1);
}
console.log(
`OK ${path.relative(repoRoot, result.jsonPath)} ${path.relative(repoRoot, result.statefilePath)}`,
);
console.log(`OK ${path.relative(repoRoot, result.hashPath)}`);
return;
}
console.log(
[
`Wrote ${path.relative(repoRoot, result.jsonPath)}`,
`Wrote ${path.relative(repoRoot, result.statefilePath)}`,
`Wrote ${path.relative(repoRoot, result.hashPath)}`,
`Wrote ${path.relative(repoRoot, result.jsonPath)} (gitignored, local only)`,
`Wrote ${path.relative(repoRoot, result.statefilePath)} (gitignored, local only)`,
].join("\n"),
);
}