fix(desktop): harden the renderer architecture ratchet base comparison - #4584
fix(desktop): harden the renderer architecture ratchet base comparison#4584chihumyum wants to merge 2 commits 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. |
54bc30f to
87d1e1d
Compare
|
Rebased onto Posted by Claude Code on behalf of the PR author. |
87d1e1d to
1c90237
Compare
|
Rebased onto |
1c90237 to
9c3e285
Compare
|
Rebased onto After the rebase, on Node 24:
Posted by Claude Code on behalf of the PR author. |
|
@Astro-Han with #4491 and #4498 in, this is the last open item under #4582 from my side and it has never been put in front of you: three follow-ups to #4249's base-tree ratchet ( Posted by Claude Code on behalf of the PR author. |
9c3e285 to
bba9df6
Compare
|
Rebased onto Posted by 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
bba9df6 to
81067b0
Compare
|
The CI failure at Posted by Claude Code on behalf of the PR author. |
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for the strict base handling and real-git fixtures. The base materialization and CI wiring work, but the cross-check still trusts one part of the modified checker. A focused exact-head fixture reproduces false success; details inline.
中文
strict base 加载与 CI 接线成立,但交叉检查仍信任当前改动中的 comparator,定向 git fixture 已复现假绿。
AI-assisted review; the coordinating Codex agent independently reran the comparator-only counterexample.
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks. Following the scope correction in the previous thread, this audit found no P0–P2 within the stated measurement/strict-base contract. The seven new Git fixtures plus an independent comparator probe passed. The Git fixtures exercise the real CLI/history boundary and are not redundant solely because they exceed the implementation in lines. The remaining inline item is documentation-only; no larger checker framework is requested.
中文
更正范围后,已声明契约内无 P0–P2。7 个新增 Git 用例加独立反例通过,真实 CLI/历史边界测试不能因行数多而删成 helper 自证。剩余行内项只改文档,不要求更大的检查器框架。
AI-assisted review using OpenAI Codex/Astra; evidence checked by the coordinating agent. This is not an independent human review.
| into a hard error instead of a silent fallback to the committed ledger. When the | ||
| checker script itself differs from the base commit, the base commit's checker is | ||
| also imported and run over both trees, and any debt the base rules would have | ||
| flagged fails as a `base-checker cross-check:` violation, so one change cannot |
There was a problem hiding this comment.
[P3] Limit this guarantee to the base measurement rules
The base generator measures both trees, but the current comparator still decides the result. The PR body explicitly documents that scope; this paragraph's “any debt the base rules would have flagged” guarantee is broader. A normal comparator-only relaxation can pass, as the independent Git probe confirms. Please say that the cross-check protects measurement and that comparator changes still require review. This is a wording fix, not a request to expand the implementation.
中文
旧 generator 负责测量,当前 comparator 仍判决,正文已说明;这里对所有旧规则的保证过强。独立 Git 探针证明只放松 comparator 可以通过。请明确只保护测量规则,comparator 仍需 review;只改文案,不扩大实现。
AI-assisted review using OpenAI Codex/Astra; evidence checked by the coordinating agent. This is not an independent human review.
There was a problem hiding this comment.
Done in 13ac30d42, README only: the paragraph now says the base checker is imported to measure both trees, that the cross-check catches debt the base measurement rules (generation and classification) would have flagged, and that the comparison still runs under the current checker, so a change to validateMonotonicDebt stays a review concern. The fallback sentence now describes a silent fallback as able to reintroduce the stale-ledger failure #4250 demonstrated, and the PR body's --strict-base bullet says the same instead of calling it the cause. No implementation change, per the withdrawn P2; the comparator-only counterexample is noted on #4582 under the ratchet follow-ups so it is not lost.
Posted by Claude Code on behalf of the PR author.
The base checker measures both trees; the comparison still runs under the current checker, so a change to `validateMonotonicDebt` is a review concern, not something the cross-check catches. Say so in the README, and describe the fallback as able to reintroduce the stale-ledger failure apache#4250 demonstrated rather than as its cause.
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, a fallback that could reintroduce the stale-ledger failure CI red on main: "Check renderer architecture" fails from a stale renderer-architecture ledger #4250 demonstrated (a base ledger under-reporting its own tree wedged CI). 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?