Skip to content

Move the compatibility tool's inline tests out of its pinned lib.rs - #446

Merged
lamemustafa merged 1 commit into
masterfrom
refactor/extract-compatibility-tool-tests
Sep 16, 2026
Merged

lamemustafa merged 1 commit into
masterfrom
refactor/extract-compatibility-tool-tests

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Follows docs/proposed-rust-module-conventions.md item 2, as in #440#442, for the tests module of tools/bridge-tally-compatibility/src/lib.rs, the tool that validates the compatibility surface. It moves to lib_tests.rs beside it via #[path].

file before after
lib.rs 2,853 1,686
lib_tests.rs 1,162

No production code followed the test block.

Checked, not asserted

  • No production change. Before rustfmt, lib.rs rebuilt byte-identical to HEAD from the new parent plus the re-indented child. After rustfmt, the child differs from that reconstruction only in layout (below).
  • rustfmt made one non-whitespace change, a trailing comma. All 169 string and char literals are identical.
  • No test lost. The test lists are identical before and after: 24 lib tests by default, and 30 with bills-native-outstandings-probe-receipt. The full crate passes under both, with no warnings.
  • The one test that needed resealing. Before the reseal, real_tree_has_complete_migration_and_report_surface_coverage failed with surface_file_changed, which is expected after changing a pinned file. It passes after the reseal. reseal --verify exits 0, and exactly one pinned hash changed.
  • Clippy -D warnings is clean for CI's tools-workspace step and for its probe-receipt feature step.
  • Scripts that read these files as text:
    • check-tally-live-read-boundary.mjs allowlists this lib.rs for probe identifiers. The moved tests contain none, and the check passes.
    • The request-builder hazard scanner now reads lib_tests.rs as production code (see Skip extracted test modules in the hazard scanner by how they load, not by name #443). It still reports exactly its 10 pinned violations.
    • The other scanning scripts pass.
    • The frontend suite passes on a clean tree: 239 node, 113 vitest, 10 Playwright. (The merge-driver test refuses to run while surface files have uncommitted changes.)
  • Windows. The one #[cfg(windows)] test couldn't run on the macOS host that did this move. CI's windows-latest native job runs the tools workspace tests.

What leaves the seal, and why this file is different

lib_tests.rs is unpinned. That follows #416's rule and #440#442: tests decide nothing about what Bridge posts or emits.

The loss is sharper here than in earlier extractions. real_tree_has_complete_migration_and_report_surface_coverage holds the only executable check of the reserve bound:

assert!(MAX_SURFACE_FILES - surface.files.len() <= RESERVED_SURFACE_FILES);

The cap itself is still enforced in the pinned lib.rs. But editing or deleting that assertion no longer changes a pinned hash. If you want it sealed, pinning lib_tests.rs takes one entry, a cap raise with a named reason, and matching changes to the guard.

Correction to the remaining-work picture

An earlier version of this description called this the last large inline test block in a pinned file. It isn't. I had ranked files by production lines and truncated the list. Ranked by inline test lines, 70 pinned files still hold 18,384 lines of top-level inline #[cfg(test)] modules. This one is third, behind source_draft/catalog.rs (1,779) and tally/connector.rs (1,317).

Coordination

#444 also edits this lib.rs, raising the cap to 251 in the doc comment and constant near the top. The two edits don't overlap in the source. Both regenerate the surface manifest, and #444 adds pins, so whichever lands second must merge the pin list and reseal, not take either side.

🤖 Generated with Claude Code

docs/proposed-rust-module-conventions.md item 2, continuing #440-#442, for
the last large inline test block among pinned files: the `tests` module of
tools/bridge-tally-compatibility/src/lib.rs -- the tool that validates the
compatibility surface -- moves to lib_tests.rs beside it via #[path].
lib.rs goes from 2,853 to 1,686 lines. No production code followed the
block.

Checked, not asserted:
- lib.rs rebuilds byte-identical to HEAD from the new parent plus the
  re-indented child.
- rustfmt's only non-whitespace change is one trailing comma; all 169
  string and char literals are identical.
- Test lists are identical before and after: 24 lib tests by default, 30
  with bills-native-outstandings-probe-receipt. The full crate passes under
  both, with no warnings.
- Before resealing, real_tree_has_complete_migration_and_report_surface_coverage
  failed with surface_file_changed -- the expected result of changing a
  pinned file -- and passes after; reseal --verify exits 0 and exactly one
  pinned hash changed.
- clippy -D warnings is clean for CI's tools-workspace step and its
  probe-receipt feature step.
- Text readers: check-tally-live-read-boundary.mjs allowlists this lib.rs
  for probe identifiers; the moved tests contain none, and it passes. The
  request-builder hazard scanner now reads lib_tests.rs as production (see
  #443) and still reports exactly its 10 pinned violations. The other
  scanning scripts pass, and the frontend suite passes (239 node, 113
  vitest, 10 Playwright) on a clean tree -- the merge-driver test refuses
  to run with uncommitted surface changes.

Coverage, stated rather than assumed. lib_tests.rs is unpinned, following
#416's rule and #440-#442: tests decide nothing about what Bridge posts
or emits. For this file the loss is sharper than before, because
real_tree_has_complete_migration_and_report_surface_coverage holds the only
executable check of the reserve bound, `MAX_SURFACE_FILES -
files.len() <= RESERVED_SURFACE_FILES`. The cap itself stays enforced in
the pinned lib.rs. Editing or deleting that assertion no longer changes a
pinned hash.

The one #[cfg(windows)] test, normalise_surface_path_uses_forward_slashes,
could not run on the macOS host that did this move; CI's windows-latest
native job runs the tools workspace tests and covers it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@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
lamemustafa merged commit eb5e3e9 into master Sep 16, 2026
12 checks passed
@lamemustafa
lamemustafa deleted the refactor/extract-compatibility-tool-tests branch September 16, 2026 12:23
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