fix(desktop): harden the renderer architecture ratchet base comparison - #4584
fix(desktop): harden the renderer architecture ratchet base comparison#4584chihumyum wants to merge 1 commit into
Conversation
a8721f4 to
54bc30f
Compare
|
The first CI run failed only in Storybook smoke, on the Automated update from Claude Code on behalf of the PR author. |
Add a --strict-base flag that turns the silent fallback to the committed base ledger (the pre-apache#4249 behaviour that wedged CI in apache#4250) into a hard failure, and pass it from the CI step that supplies --base. When the checker script differs from the base commit, also measure both trees with the base commit's checker and ratchet those results, so a change cannot weaken a rule and lower both sides of the comparison at once. Cover the base-tree derivation with git-fixture integration tests. Generated-by: Claude Code
54bc30f to
87d1e1d
Compare
|
Rebased onto Posted by Claude Code on behalf of the PR author. |
Summary
Three follow-ups to #4249's base-tree ratchet, so the guard fails loudly and cannot be lowered from one side.
--strict-base: when the base commit's tree cannot be materialized or analyzed, the check fails instead of silently falling back to the base's committed ledger (the pre-fix(desktop): ratchet renderer debt against the base tree, not its ledger #4249 behavior that wedged CI in CI red on main: "Check renderer architecture" fails from a stale renderer-architecture ledger #4250). CI now passes the flag; local runs without it are unchanged.check-renderer-architecture.mjsitself differs from the base commit, the base version is imported and itsgenerateArchitectureConfigis run over both trees, and the currentvalidateMonotonicDebtcompares the two. Debt that the base rules would have flagged fails as abase-checker cross-check:violation, so one PR cannot weaken a rule and lower both sides of the ratchet at once. Nothing extra runs when the script is unchanged.--strict-basefails when the base cannot be materialized, and the cross-check catches a weakened checker.Refs #4582
Verification
node --test apps/desktop/scripts/check-renderer-architecture.test.mjs— 78 tests (71 existing + 7 new), 0 failuresnpm run check:renderer-architecture -- --base upstream/main— passes; because this PR changes the script, the output shows the cross-check running (… differs from upstream/main; cross-checked debt under the base checker.)npm run check:renderer-architecture(no base) — passesscripts/*workflow-policy*.test.mjs) — 69 tests, 0 failuresnpm run check:asf-headers, Biome lint on both scripts,git diff --check— cleanrenderer-architecture.jsonis untouched. Run under Node 24 (identical under Node 22).Review focus
--strict-base, a base checker that exists but cannot be imported, or whose generator throws on either tree, fails closed; a base checker with nogenerateArchitectureConfigexport, or whose output does not fit the current ledger schema, is a notice-and-skip in both modes. Consequence: a PR that makes the old checker unable to analyze the new tree must land the checker change first. Easy to flip if the other default is preferred.validateMonotonicDebtitself is not covered; that stays a review concern.@babel/parserresolves, and removed infinally;.gitignorecovers a crash mid-run.import.meta.url === pathToFileURL(argv[1])guard is realpath-sensitive, so invoking it through a symlinked path is a silent no-op. The fixtures userealpath.AI use
Select exactly one:
Tool(s) and scope: Claude Code — implementation, tests, and local validation. The commit carries a
Generated-by: Claude Codetrailer.Checklist
Does this PR entail a change in behavior?