Skip to content

fix(desktop): harden the renderer architecture ratchet base comparison - #4584

Open
chihumyum wants to merge 1 commit into
apache:mainfrom
chihumyum:fix/renderer-architecture-strict-base
Open

fix(desktop): harden the renderer architecture ratchet base comparison#4584
chihumyum wants to merge 1 commit into
apache:mainfrom
chihumyum:fix/renderer-architecture-strict-base

Conversation

@chihumyum

Copy link
Copy Markdown
Contributor

Summary

Three follow-ups to #4249's base-tree ratchet, so the guard fails loudly and cannot be lowered from one side.

Refs #4582

Verification

  • node --test apps/desktop/scripts/check-renderer-architecture.test.mjs — 78 tests (71 existing + 7 new), 0 failures
  • npm 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) — passes
  • Workflow policy tests (scripts/*workflow-policy*.test.mjs) — 69 tests, 0 failures
  • npm run check:asf-headers, Biome lint on both scripts, git diff --check — clean
  • renderer-architecture.json is untouched. Run under Node 24 (identical under Node 22).

Review focus

  • Strict-mode policy: under --strict-base, a base checker that exists but cannot be imported, or whose generator throws on either tree, fails closed; a base checker with no generateArchitectureConfig export, 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.
  • The cross-check protects the measurement. A PR that weakens validateMonotonicDebt itself is not covered; that stays a review concern.
  • The scratch copy of the base checker is written next to the live script so @babel/parser resolves, and removed in finally; .gitignore covers a crash mid-run.
  • Surfaced but left alone: the script's import.meta.url === pathToFileURL(argv[1]) guard is realpath-sensitive, so invoking it through a symlinked path is a silent no-op. The fixtures use realpath.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — implementation, tests, and local validation. The commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above: CI fails instead of warning when the base tree cannot be derived, and a PR that weakens the checker while adding debt is rejected.
  • No

@github-actions github-actions Bot added the effort/L Under 1000 readable lines label Sep 2, 2026
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
@chihumyum
chihumyum force-pushed the fix/renderer-architecture-strict-base branch from a8721f4 to 54bc30f Compare September 2, 2026 19:24
@chihumyum

Copy link
Copy Markdown
Contributor Author

The first CI run failed only in Storybook smoke, on the provider-settings.stories play; every other step passed. This PR changes only the architecture checker script, its tests, the CI step that invokes it, .gitignore, and the renderer README, so it cannot reach that story. Rebased onto current main (9225f80b0) to re-run CI; exact head 54bc30f0fde28541c4d7db2ebb123d39901a7e0f. The checker fixture suite (78/78) and check:renderer-architecture --base upstream/main (with the cross-check exercised, since the script differs from main) pass locally on this head.

Automated update from Claude Code on behalf of the PR author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant