Skip to content

feat(redesign-coverage): the D38 file-level assertion (REBUILD.md Phase 5) - #584

Merged
thomasluizon merged 3 commits into
mainfrom
feature/redesign-coverage-file-assertion
Jul 24, 2026
Merged

feat(redesign-coverage): the D38 file-level assertion (REBUILD.md Phase 5)#584
thomasluizon merged 3 commits into
mainfrom
feature/redesign-coverage-file-assertion

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

What

The last Phase 5 deliverable of REBUILD.md: tools/redesign-coverage.mjs grows the second assertion decision D38 mandates. Every .tsx under apps/*/app and apps/*/components must map to exactly one #539 redesign ticket by directory rule; the tool exits 1 on any orphaned file, exactly as it already exits 1 on any unclaimed surface (D35).

How

  • New exported FILE_RULES: an ordered directory-rule list over repo-relative paths, first match wins, mirroring the existing TICKETS structure. Assignments follow the 8.5.2 disposition table: chat to R11, upgrade to R17, habit form fields to R7, goals to R6, gamification to R4, ui primitives to R1 (the final catch-all), layouts / errors / not-found to R2 after the feature rules, so a feature-scoped layout stays with its feature.
  • A local walkTsx walker over the four roots (skips node_modules and __tests__, same convention as surface-manifest.mjs).
  • Human output gains a files column and an ORPHANED FILES section; --json gains a files block (total, perTicket, orphans).
  • A one-line invariant fails fast if a FILE_RULES entry references a ticket id not in TICKETS, so a typo cannot silently create a phantom owner.
  • Docs synced: the tools/README.md row and the root CLAUDE.md registry line.

Verification

  • node tools/redesign-coverage.mjs: surfaces 171 claimed 171 unclaimed 0; files 651 claimed 651 orphaned 0; exit 0.
  • Cross-checked every surface sourceFile against its file-level ticket: 2 divergences remain, both structural, not rule accidents. The multi-view root page.tsx hosts R5 and R6 surfaces in one file (R5 wins first-rule, same as the surface partition resolves it), and social/_components/edit-handle-sheet.tsx goes to R13 by directory while its overlay surface is claimed by R16. Three real ordering accidents found by that check were fixed (fresh-start-modal to R4, both habit-list confirm-dialogs files to R1, matching the surface partition).
  • node tools/check-dashes.mjs --files tools/redesign-coverage.mjs tools/README.md CLAUDE.md: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01F6r1CFPJTUABPrRtX3omPX

…se 5)

Extends tools/redesign-coverage.mjs with the second assertion D38 mandates:
every .tsx under apps/*/app and apps/*/components maps to exactly one #539
ticket via an ordered directory-rule list (FILE_RULES, first match wins),
exit 1 on orphans. Assignments follow 8.5.2: chat to R11, upgrade to R17,
habit form fields to R7, goals to R6, gamification to R4, ui primitives to
R1, layouts and not-found to R2. 651 files, 0 orphans against the current
tree. Docs synced in tools/README.md and the CLAUDE.md registry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F6r1CFPJTUABPrRtX3omPX
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
orbit-ui-mobile-web Ignored Ignored Jul 24, 2026 4:48pm

Request Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: PR #584

Scope: PR #584 in thomasluizon/orbit-ui-mobile (feat(redesign-coverage): the D38 file-level assertion)
Recommendation: APPROVE

Summary

This PR extends tools/redesign-coverage.mjs with the D38 file-level assertion: every .tsx under apps/*/app and apps/*/components must map to exactly one #539 redesign ticket via a new ordered FILE_RULES directory-rule list, mirroring the existing surface-level TICKETS pattern. Docs (CLAUDE.md, tools/README.md) are updated in the same edit. The diff is tooling-only (no apps/* UI files, no orbit-api, no i18n, no shared contract types), so it is narrow and low-risk; a manual trace of the new FILE_RULES ordering against real files in the repo (chat cards, tab-bar layouts, calendar/profile subtrees, components/ui/*) found the priority ordering behaves as documented, with one real gap in the tool's own self-diagnosis.

Findings

Critical

None.

High

None.

Medium

1. File-level rule matching has no multi-match diagnostic, unlike the surface-level check it mirrors

  • File: tools/redesign-coverage.mjs:150-154
  • Summary: The surface-level loop explicitly computes and reports every surface matched by more than one ticket rule (multiMatch, lines 138-143), so an accidental double-match is visible in both human and --json output. The new file-level loop uses FILE_RULES.find(...) — a short-circuiting first match — with no equivalent collection of files that matched more than one rule:
    const fileAssignment = new Map()
    for (const path of files) {
      const match = FILE_RULES.find(([, test]) => test(path))
      if (match) fileAssignment.set(path, match[0])
    }
    The PR body itself demonstrates the cost: the author found "three real ordering accidents" (fresh-start-modal to R4, both habit-list confirm-dialog files to R1) only by manually cross-checking every file against its surface-partition ticket, rather than the tool surfacing them. Per tools/CONVENTIONS.md's "Gate tools" contract ("report the shortfall precisely... so the ratio is the output, not a boolean an agent can round up"), this is exactly the kind of silent ambiguity the surface-level multiMatch mechanism exists to catch — the file-level path doesn't get the same guarantee, so a future contributor adding a file that matches two FILE_RULES entries gets a silent first-rule-wins pick with no signal, unlike an unclaimed file (which correctly fails via orphans).
  • Failure scenario: A future .tsx file is added whose path matches two FILE_RULES entries in an order the author did not intend (the same class of accident already found three times by hand this PR). The tool exits 0, reports it as claimed, and the misassignment ships silently — there is no files.multiMatch in either output mode to catch it, whereas the identical surface-level mistake would have been flagged.
  • Fix: Mirror the surface-level pattern — FILE_RULES.filter(([, test]) => test(path)) instead of .find, push to a fileMultiMatch array when matches.length > 1, take matches[0] for fileAssignment, and report it in both output modes the same way multiMatch is reported today.

Low / Info

None.

Subagents

Agent Verdict
parity-checker N/A - no apps/web or apps/mobile file changed
i18n-syncer N/A - no user-facing strings or i18n JSON changed
contract-aligner N/A - no shared types/endpoints, orbit-api not touched
security-reviewer N/A - orbit-api not touched
design-reviewer N/A - no apps/* or landing-page UI file changed

Validation

Check Result
Lint N/A - node/npm execution sandboxed in this review run; reviewed statically instead
Type check N/A - same sandbox restriction
Tests N/A - same restriction; tools/*.mjs has no existing unit-test convention in this repo, so no test gap introduced
Build (api) N/A - orbit-api not touched

Static verification performed in place of execution: manually traced FILE_RULES ordering against real repo files across web + mobile ((tabs)/, (chat)/, (auth)/, (onboarding)/, calendar/_components/, profile/_components/, both platforms' components/ui/*, and the specific files REBUILD.md's own audit calls out as confirmed orphans - +not-found.tsx, tag-chip.tsx, web components/chat/*) and confirmed each resolves to the ticket the 8.5.2 disposition table intends. No misassignment or crash-causing bug found; the FILE_RULES invariant check and doc-sync edits are consistent with the code change and REBUILD.md's D38 entry.

Deferred - N/A dimensions & files not verdicted

  • DESIGN.md / AI-slop (#8): N/A - no apps/* UI file changed.
  • Parity (#9): N/A - no apps/web or apps/mobile file changed.
  • i18n (#10): N/A - no i18n JSON changed.
  • Contract drift + backward-compat (#11): N/A - no shared types, no orbit-api DTOs.
  • Security (#12): N/A - no orbit-api code changed.
  • Backend hard rules (#13): N/A - orbit-api not touched.
  • FEATURES.md parity (#14): N/A - internal tooling change, not a user-facing feature surface.
  • Lint/type-check/tests/build: not executed (sandbox restriction on this review run); covered by static trace instead.

All three changed files (CLAUDE.md, tools/README.md, tools/redesign-coverage.mjs) received a verdict; nothing changed was skipped.

What's good

  • The new FILE_RULES list is a faithful, well-ordered implementation of REBUILD.md's 8.5.2 disposition table (chat before habits/goals so chat-embedded cards stay with chat, feature rules before the shell/layout rule so feature-scoped layouts stay with their feature, ui primitives as the true final catch-all).
  • The knownTickets invariant check fails fast on a typo'd ticket id rather than silently creating a phantom owner.
  • Docs (CLAUDE.md registry line, tools/README.md catalog row) were updated in the same edit.
  • The PR body's own verification section is unusually rigorous: it names the exact three ordering accidents found and fixed, and explicitly flags the two remaining structural divergences instead of hiding them.

Recommendation

Safe to merge as-is; the file-level multiMatch gap (Medium) is worth a fast follow-up rather than a blocker, since it affects future maintainability of the assertion (silent misassignment risk on new files) rather than anything wrong in the current 651-file baseline.

@sonarqubecloud

Copy link
Copy Markdown

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review: PR #584

Scope: PR #584 in thomasluizon/orbit-ui-mobile
Recommendation: APPROVE

Summary

No diff exists since the last bot review. The PR's current head (df636d5744a6138587d7d34354d219ed9bb7ddb9) is the exact commit the prior claude review (2026-07-24T16:42:11Z, state APPROVED) already walked — verified with git diff <reviewed-oid> <PR-head> over the three changed files (CLAUDE.md, tools/README.md, tools/redesign-coverage.mjs), which returned nothing. Nothing in this pass needed re-flagging or re-litigating; the prior verdict stands unchanged.

Findings

Critical

None.

High

None.

Medium

1. (Carried forward, unaddressed, non-blocking) File-level rule matching has no multi-match diagnostic, unlike the surface-level check it mirrors

  • File: tools/redesign-coverage.mjs:150-154
  • Issue: fileAssignment is built with FILE_RULES.find(...) (short-circuiting first match), with no equivalent to the surface-level multiMatch collection that flags files matched by more than one FILE_RULES entry.
  • Risk: A future .tsx file matching two rules in an unintended order gets silently misassigned — the tool exits 0 and reports it as claimed, unlike an unclaimed file (which correctly fails via orphans). The PR's own body notes three such ordering accidents were only caught by manual cross-check this round.
  • Fix: Mirror the surface-level pattern — FILE_RULES.filter(...) instead of .find, collect a fileMultiMatch array, report it in both output modes.
  • Reference: CLAUDE.md rule 1 (root-cause, consistency with the sibling mechanism it mirrors); this was already raised in the prior review and remains present in the current head — confirmed still FILE_RULES.find at line 152.

This is unchanged from the prior review; it is Medium and does not force NEEDS WORK per the rubric's Signal gate.

Low / Info

None.

Subagents

Not re-run — no new diff to feed them; the prior review's gates apply unchanged (diff touches only CLAUDE.md, tools/README.md, tools/redesign-coverage.mjs — no apps/*, no orbit-api, no i18n JSON, no shared contract types).

Agent Verdict
parity-checker N/A — no apps/web or apps/mobile file changed
i18n-syncer N/A — no user-facing strings or i18n JSON changed
contract-aligner N/A — no shared types/endpoints, orbit-api not touched (also not checked out in this environment)
security-reviewer N/A — orbit-api not touched
design-reviewer N/A — no apps/* or landing-page UI file changed

Validation

Skipped per CI adaptation (Build/Unit Tests/SonarCloud run as separate required checks). SonarCloud's own PR comment already reports Quality Gate passed, 0 new issues.

Check Result
Lint N/A — skipped, separate CI check
Type check N/A — skipped, separate CI check
Tests N/A — skipped, separate CI check
Build (api) N/A — orbit-api not touched, not checked out

Deferred — N/A dimensions & files not verdicted

  • DESIGN.md / AI-slop: N/A — no apps/* UI file changed.
  • Parity: N/A — no apps/web or apps/mobile file changed.
  • i18n: N/A — no i18n JSON changed.
  • Contract drift + backward-compat: N/A — no packages/shared/src/types/*, orbit-api not checked out (not verifiable in this environment).
  • Security: N/A — no orbit-api code changed.
  • Backend hard rules: N/A — orbit-api not touched.
  • FEATURES.md parity: N/A — internal tooling change, not a user-facing feature surface.

All three changed files (CLAUDE.md, tools/README.md, tools/redesign-coverage.mjs) already carry a verdict from the prior review and were re-confirmed identical in this pass.

What's good

  • FILE_RULES faithfully implements REBUILD.md 8.5.2's disposition table with correct rule ordering (feature rules before the shell/layout catch-all, ui-primitives as the true final catch-all); the knownTickets invariant fails fast on a typo'd ticket id; docs (CLAUDE.md registry, tools/README.md) synced in the same edit; the PR body names its own three fixed ordering accidents and the two remaining structural divergences instead of hiding them.

Recommendation

No action needed from this pass — the PR is unchanged since the last approval. Safe to merge as-is; the Medium file-level multiMatch diagnostic gap is worth a fast follow-up (not a blocker) since it affects future maintainability of the assertion rather than anything wrong in the current 651-file baseline.

@thomasluizon
thomasluizon merged commit 9386e55 into main Jul 24, 2026
26 checks passed
@thomasluizon
thomasluizon deleted the feature/redesign-coverage-file-assertion branch July 24, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant