Skip to content

Move the inline tests out of the thirteen report files, and pin the test files - #475

Merged
lamemustafa merged 1 commit into
masterfrom
refactor/extract-reports-tests
Sep 17, 2026
Merged

lamemustafa merged 1 commit into
masterfrom
refactor/extract-reports-tests

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Each src-tauri/src/reports/*.rs file held its tests in an inline
#[cfg(test)] mod tests {}, so editing a test re-hashed a pinned
production report. Each block moves to a sibling <stem>_tests.rs, loaded
with #[cfg(test)] #[path = "<stem>_tests.rs"] mod tests;.

Unlike every earlier batch of this extraction, the new test files are pinned.
That departs from the bridge#416 practice of leaving extracted test files
unpinned. (A few older test files, such as agent_tests.rs, were already pinned
before that practice.) The gate requires it here:
REQUIRED_SURFACE_DIRECTORIES in the compatibility tool requires every file
under src-tauri/src/reports to be pinned, and an unpinned _tests.rs there
fails real_tree_has_complete_migration_and_report_surface_coverage.
Exempting _tests.rs from that rule would change what the gate can miss, so
this PR adds the 13 pins and raises MAX_SURFACE_FILES from 249 to 262, with
one grouped, named reason beside the constant. Headroom stays zero.

Each parent rebuilds byte-identical to its previous version from the
parent plus its moved child. rustfmt then re-laid out ten of the thirteen
moved files, all except bulk_party_statement_tests.rs,
outstandings_working_paper_tests.rs and schedule_iii_tests.rs. In each, the
string literals are identical. The non-whitespace code tokens are unchanged
except for trailing commas: one dropped in outstandings_working_paper_xlsx_tests.rs,
one in party_ledger_master_xlsx_tests.rs, two in party_statement_pdf_tests.rs,
and one added in trial_balance_store_tests.rs.

Measured against the original base 32ac7d7, the bridge lib test lists are
identical before and after under default (968),
voucher-scan (986), live-calibration-harness (988) and lab-writes (1068).
The 94 moved test attributes are 94 listed tests, and all pass by exact name
under each set.

The pin list gains exactly the 13 test files and loses nothing. The changed
hashes are the 13 parents and tools/bridge-tally-compatibility/src/lib.rs
(the cap and its reason). check-unbounded-reads scans 10 call sites where
master (be757fe) scans 14. It still reports 10 bounded, 0 unbounded and 3
reviewed exceptions, as on master. The scanner skips _tests.rs files by name.

Merge order and the cap. Rebased onto be757fe, after #444 (+12 pins, cap 251) and #473 (−2 pins, cap 249). The "Raised ten times" sentence lists this raise after #444's and after the lowering to 249. The pin list is master's 249 plus these 13, so 262, resealed with --pins-changed.

Before the move I grepped every file type for each path. The readers found: the three reviewed report exceptions in check-unbounded-reads.mjs (production reads, unchanged) and a path-normalisation test string in tools/bridge-tally-compatibility/src/lib_tests.rs. Neither reads test content.

Local checks run on this commit: CI's three src-tauri clippy commands, the seven scripts/check-*.mjs gates, a reseal with --pins-changed and a verify, cargo test -p bridge-tally-compatibility (including the real-tree required-directory test), and admission_and_egress_files_stay_pinned. The test lists were taken with a forced rebuild proven to compile from this worktree. The reseal used a tool binary built from this worktree and copied out of the shared build directory, so no other worktree's build could replace it between steps.
corepack pnpm test on 875e411: posted as a comment.

🤖 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.

@lamemustafa

Copy link
Copy Markdown
Owner Author

corepack pnpm test on 875e411: node 244/244, vitest 113/113, playwright 10/10, exit 0 (first run).

…est files

Each `src-tauri/src/reports/*.rs` file held its tests in an inline
`#[cfg(test)] mod tests {}`, so editing a test re-hashed a pinned
production report. Each block moves to a sibling `<stem>_tests.rs`, loaded
with `#[cfg(test)] #[path = "<stem>_tests.rs"] mod tests;`.

Unlike every earlier batch of this extraction, the new test files are pinned.
That departs from the bridge#416 practice of leaving extracted test files
unpinned. (A few older test files, such as `agent_tests.rs`, were already pinned
before that practice.) The gate requires it here:
`REQUIRED_SURFACE_DIRECTORIES` in the compatibility tool requires every file
under `src-tauri/src/reports` to be pinned, and an unpinned `_tests.rs` there
fails `real_tree_has_complete_migration_and_report_surface_coverage`.
Exempting `_tests.rs` from that rule would change what the gate can miss, so
this PR adds the 13 pins and raises `MAX_SURFACE_FILES` from 249 to 262, with
one grouped, named reason beside the constant. Headroom stays zero.

Each parent rebuilds byte-identical to its previous version from the
parent plus its moved child. rustfmt then re-laid out ten of the thirteen
moved files, all except bulk_party_statement_tests.rs,
outstandings_working_paper_tests.rs and schedule_iii_tests.rs. In each, the
string literals are identical. The non-whitespace code tokens are unchanged
except for trailing commas: one dropped in outstandings_working_paper_xlsx_tests.rs,
one in party_ledger_master_xlsx_tests.rs, two in party_statement_pdf_tests.rs,
and one added in trial_balance_store_tests.rs.

Measured against the original base 32ac7d7, the bridge lib test lists are
identical before and after under default (968),
voucher-scan (986), live-calibration-harness (988) and lab-writes (1068).
The 94 moved test attributes are 94 listed tests, and all pass by exact name
under each set.

The pin list gains exactly the 13 test files and loses nothing. The changed
hashes are the 13 parents and tools/bridge-tally-compatibility/src/lib.rs
(the cap and its reason). check-unbounded-reads scans 10 call sites where
master (be757fe) scans 14. It still reports 10 bounded, 0 unbounded and 3
reviewed exceptions, as on master. The scanner skips `_tests.rs` files by name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lamemustafa
lamemustafa force-pushed the refactor/extract-reports-tests branch from 875e411 to a81b055 Compare September 17, 2026 02:07
@lamemustafa

Copy link
Copy Markdown
Owner Author

Rebased onto be757fe: 249 master pins + 13 = 262, cap 262, resealed with --pins-changed using a tool binary built from this worktree; all 262 hashes match disk and the matrix points at the manifest. On a81b055: corepack pnpm test first run node 250/250, vitest 113/113, playwright 10/10; cargo test -p bridge --lib -- reports:: from this worktree's build: 94 passed; cargo test -p bridge-tally-compatibility --lib (includes the real-tree required-directory test): 24 passed.

@lamemustafa
lamemustafa merged commit e4d480a into master Sep 17, 2026
13 checks passed
@lamemustafa
lamemustafa deleted the refactor/extract-reports-tests branch September 17, 2026 02:28
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