Skip to content

Share the mirror screen's duplicated Tally types and presentation with App - #468

Merged
lamemustafa merged 1 commit into
masterfrom
tapish-claude/share-tally-mirror-presentation
Sep 16, 2026
Merged

lamemustafa merged 1 commit into
masterfrom
tapish-claude/share-tally-mirror-presentation

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Problem

src/MirrorProofScreen.tsx was extracted from src/main.tsx by copying, and the originals were never removed. Measured with the TypeScript AST on master 32ac7d79, comparing top-level items by exact text:

  • 22 items (about 230 lines) are byte-identical in both files: TallyErrorNotice, CapabilityRows, CapabilityBadge, the capability formatters and labels, formatIdentifier, formatRuntimeTime, and 13 DTO types.
  • 3 types had already drifted. TallyCompany, TallySyncEvidence and MirrorExplorerPage are narrower in the mirror screen. For example, its TallySyncEvidence.operator_hint.state is string where App has a closed union.

Both files are pinned, so every fix to one copy costs a reseal and still leaves the other copy stale.

This is the first step of the frontend large-file work. It is a pure move, sized to review as one. It follows the decision checklist in docs/rust-module-conventions.md (#461) where the checklist applies to TS: delete or dedupe before decomposing, name modules by subject, keep the move free of edits, and prove it.

Change

Each shared item moves once, verbatim, into a module named for its subject:

module holds
src/display-format.ts formatIdentifier, formatRuntimeTime
src/tally-command-error.tsx command error envelope, OperatorError, TallyErrorNotice, and App's toOperatorError / toErrorMessage / isTallyCommandErrorEnvelope
src/tally-capability-evidence.tsx capability evidence types, PACK_LABELS, CAPABILITY_REASON_LABELS, formatters, CapabilityBadge, CapabilityRows
src/tally-mirror-contract.ts the command DTO types both screens use, taking App's (fuller) version of the three drifted types

Exports are limited to names another module actually imports. The rest stay module-private.

main.tsx: 2594 → 2290 lines. MirrorProofScreen.tsx: 967 → 694.

Why it is a pure move (measured)

  • Every one of the 28 moved bodies equals master main.tsx's text for that item, apart from the added export keyword (0 mismatches).
  • Every top-level item left in main.tsx or MirrorProofScreen.tsx is unchanged (0 changed, 0 added). The only added lines are imports, and the removed lines are the moved items plus the now-unused classifyTallyError import.
  • tsc --noEmit passes. Proved the check is live by injecting a type error, which it reported.
  • corepack pnpm build succeeds.

Pins

main.tsx, MirrorProofScreen.tsx, scripts/tally-setup-safety.test.mjs and tools/bridge-tally-compatibility/src/lib.rs are resealed (4 digests, pin list unchanged). Per docs/module-decomposition.md ("a pinned file's collaborators are pinned or explicitly exempted"), the exemption and its reason are recorded beside MAX_SURFACE_FILES. The four new modules are deliberately unpinned, by the seal criterion "could a silent change make a workbook or drawer attribute a report to the wrong book?":

  • The DTO module is types only, erased at runtime.
  • The formatters, error notice and capability rows are presentation of errors and capability labels; none of them attributes a report to a book.

Reviewers, please challenge this. tally-error-copy.ts is pinned, and TallyErrorNotice renders its classification.

Test change

tally-setup-safety.test.mjs › "structured Tally errors retain their backend remediation" read Next step: {message.remediation} out of main.tsx. It now reads it from the shared notice, and also asserts that both screens import TallyErrorNotice from ./tally-command-error and define no local copy, so the drift this PR removes cannot come back unseen. Mutation-checked:

  • re-adding a local function TallyErrorNotice to main.tsx fails the test;
  • deleting the Next step: line from the notice fails it;
  • restored, it passes.

Verification

Rebased onto 6b9c4e8b (251 pins after #444). Re-proven on that base: 28 moved items with 0 text mismatches, 0 changed and 0 added items in either screen. Seal checked without the tool binary: every pinned file's sha256 matches, the matrix points at the manifest, and the pin paths equal master's. tsc, cargo test -p bridge-tally-compatibility --lib 24/24 and node 250/250 pass.

Earlier, on the first head: corepack pnpm test after commit: node 244/244, vitest 113/113, Playwright 10/10. corepack pnpm build OK.

Not in this PR (found while measuring; for follow-ups)

  • Six screens each hand-roll an error formatter (errorMessage, operatorMessage, formatInvokeError), and they disagree on whether the backend remediation is shown. SourceDraft, Outstandings and NativeLifecycle drop it. Unifying them changes what operators see, so it needs its own PR and a decision.
  • AxalScreen and DocumentsScreen duplicate AxalIntegration, AxalConnectionStatus and TABLE_PREVIEW_LIMIT from main.tsx. JournalPostingScreen and GstScreen hold drifted TallyConfig and GstReturnDraft.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

…h App

MirrorProofScreen.tsx was extracted from main.tsx by copying: 22 top-level
items (about 230 lines) were byte-identical in both files, and three types
(TallyCompany, TallySyncEvidence, MirrorExplorerPage) had already drifted,
with the mirror screen holding narrower copies.

Move each shared item once, verbatim, into a module named for its subject:
- display-format.ts: formatIdentifier, formatRuntimeTime
- tally-command-error.tsx: the command error envelope, OperatorError,
  TallyErrorNotice, and App's toOperatorError/toErrorMessage
- tally-capability-evidence.tsx: capability evidence types, labels,
  CapabilityBadge and CapabilityRows
- tally-mirror-contract.ts: the command DTO types both screens use, taking
  App's (fuller) version of the three drifted types

Exports are limited to names another module imports. No behaviour change:
every moved body matches master's main.tsx text, every item left in either
screen is unchanged, and the only added lines are imports.

tally-setup-safety's remediation test read "Next step:" out of main.tsx;
it now reads the shared notice and asserts both screens import it rather
than defining their own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lamemustafa
lamemustafa force-pushed the tapish-claude/share-tally-mirror-presentation branch from 87121db to 6735b38 Compare September 16, 2026 23:33
@lamemustafa
lamemustafa merged commit a80fab0 into master Sep 16, 2026
13 checks passed
@lamemustafa
lamemustafa deleted the tapish-claude/share-tally-mirror-presentation branch September 16, 2026 23:45
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