chore(bmad-module): diagnose vendor:check ide-sync drift in CI
Print committed-vs-fresh lengths and the first differing window on a vendor:check mismatch so a CI-only drift (passes locally, fails in CI) is actionable from the log. Temporary diagnostic to locate the divergence. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ce314ba600
commit
962e9a068a
|
|
@ -140,6 +140,10 @@ if (checkMode) {
|
||||||
` The committed bundle no longer matches tools/installer/ide/*.\n` +
|
` The committed bundle no longer matches tools/installer/ide/*.\n` +
|
||||||
` Fix: run \`npm run vendor:build\` and commit the regenerated files.\n`,
|
` Fix: run \`npm run vendor:build\` and commit the regenerated files.\n`,
|
||||||
);
|
);
|
||||||
|
// Pinpoint the first divergence so a CI-only mismatch is diagnosable from the
|
||||||
|
// log instead of just "they differ".
|
||||||
|
reportFirstDiff('ide-sync.mjs', currentBundle, built);
|
||||||
|
reportFirstDiff('platform-codes.yaml', currentSidecar, sidecar);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -149,6 +153,26 @@ process.stdout.write(`built ide-sync.mjs + platform-codes.yaml (self-check OK, e
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// On a --check mismatch, print the committed vs freshly-built lengths and a
|
||||||
|
// window around the first differing character. Keeps CI logs actionable when a
|
||||||
|
// drift is environment-specific and can't be reproduced locally.
|
||||||
|
function reportFirstDiff(label, committed, fresh) {
|
||||||
|
if (committed === fresh) return;
|
||||||
|
if (committed == null) {
|
||||||
|
process.stderr.write(` [diff] ${label}: committed file missing\n`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const n = Math.min(committed.length, fresh.length);
|
||||||
|
let i = 0;
|
||||||
|
while (i < n && committed[i] === fresh[i]) i++;
|
||||||
|
const win = (s) => JSON.stringify(s.slice(Math.max(0, i - 40), i + 40));
|
||||||
|
process.stderr.write(
|
||||||
|
` [diff] ${label}: committed=${committed.length}B fresh=${fresh.length}B firstDiff@${i}\n` +
|
||||||
|
` committed: ${win(committed)}\n` +
|
||||||
|
` fresh : ${win(fresh)}\n`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function selfCheck(bundleText, sidecarText) {
|
async function selfCheck(bundleText, sidecarText) {
|
||||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'bmad-ide-sync-check-'));
|
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'bmad-ide-sync-check-'));
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue