Skip to content

69 oversized files: each test module moves to a sibling tests.rs - #5224

Draft
joelteply wants to merge 13 commits into
canaryfrom
fable/tests-out-of-big-files
Draft

joelteply wants to merge 13 commits into
canaryfrom
fable/tests-out-of-big-files

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Under the new rule (no one edits a file over 1,000 lines), 76 of the 145 oversized Rust files were over only because of their inline test module. This moves that module byte for byte to <stem>/tests.rs in 69 of them. The parent keeps #[cfg(test)] mod tests;.

What changes: no behaviour. Each child module keeps use super::* access. The only non-move edit is one include_str! path, which needed one more ../ because the test now sits a directory deeper.

What stays over 1,000 after this (picked up by the split branches):

  • modules/forge.rs, 1,003 lines
  • the tests of cognition/recall_faculty, 1,245 lines
  • the tests of commands/training_trigger/submit, 1,332 lines

Verified so far:

  • Test attributes: 8,320 before and after.
  • continuum-core lib tests compile.
  • continuum-cli-lifecycle: 79 pass, with the same single failure canary has (card 250ce9c8).

The full suite is left to CI, so the serving M5 isn't burdened with it.

This PR edits 69 files over 1,000 lines, and each ends below 1,000, so it passes the oversized-edit gate on #5221.

🤖 Generated with Claude Code

@joelteply

Copy link
Copy Markdown
Contributor Author

Scoped source review at4fb6daf111fcdd09373821fed376784a51be31d4: inference/coordinator, inference/turn_admission, modules/serving_consumer and capacity/grid preserve their production text exactly; extracted test bodies match after whitespace normalization. No build performed; this is not full-PR approval.

The final claim that this head passes #5221's oversized-edit gate is incorrect. Reading changed Rust blobs at this head finds recall_faculty/tests.rs1245 lines, training_trigger/submit/tests.rs1332 lines, and modules/forge.rs1002 lines. The body already acknowledges follow-up splits, but the gate judges this PR's final tree, including tests. Include those splits here before claiming gate passage, or explicitly document the integration dependency and validate the combined head before landing. Please correct the contradictory validation statement.

joelteply added a commit that referenced this pull request Oct 20, 2026
…cannot move it

A per-file count read +7 on #5224, which only moves test modules into sibling
files: the same `use crate::modules::x` counted once per file it now sits in.
A line is the coupling site; a pure move leaves it unchanged. The baseline is
re-measured under the new unit in the next commit, from this tree's CI run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 3 commits October 20, 2026 15:08
…t column zero

production_half stopped at the first #[cfg(test)] anywhere, so an indented
test-only helper inside an impl ended "production" for the rest of the file.
In cognition/llm_deliberation_faculty.rs that hid ~9,000 production lines
from every ratchet except derived_bounds, which already cut at column zero
for this reason (it carried its own copy of the split). Found 2026-10-20
when deleting one such helper surfaced 4 hidden unwraps.

One split for every rule, at column zero; derived_bounds' private copy is
deleted. Baselines re-measured to what was always there (not new debt):
unwraps 2,119 -> 2,274, serialization 234 -> 245, spawn sites 123 -> 128,
hand-built homes 72 -> 79. source-hygiene 39/39.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
A cut that keeps the start of text drops what happened last (the newest
message, result, outcome), so she acts as if time never moved and loops
(Joel, 2026-10-20); and one source shrinking itself by its own number
breaks the budget for everything else. The rule counts, on prompt paths
(cognition, persona, rag, modules, airc, positron): head keepers
(chars().take, head_to_tokens, truncate_chars, lines().next()), literal
take/truncate/[..N], and literal .min/.clamp ceilings beside a size word
(plain arithmetic such as backoff exponents is not flagged). A cut that
never reaches a prompt says `head-cut-ok: <why>`.

Measured 179 on this branch; the count may only fall. source-hygiene 41/41.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…cannot move it

A per-file count read +7 on #5224, which only moves test modules into sibling
files: the same `use crate::modules::x` counted once per file it now sits in.
A line is the coupling site; a pure move leaves it unchanged. The baseline is
re-measured under the new unit in the next commit, from this tree's CI run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 20, 2026
…, owned by its module

Two source-reading guards failed on #5224 because a test module moved into a
sibling tests.rs read as production: experience/tests.rs became a second caller
of record_lived_turn, service_module/tests.rs a registration of
PersonaServiceModule. Each guard carried its own copy of the walk and the
comment strip, so each would have needed its own fix.

source_tree (cfg(test)) is the one reader: crate_sources(), and per file
is_test_file(), production() and owner() (x/tests.rs belongs to x.rs).
Migrated: the module-wiring audit (keys references by owner), the lived-turn
caller count (production only), the loose-id scan, the GPU base check and the
context-constant scan. Five private walks deleted. The swe env-root guard keeps
its copy until the sweep splits swe_bench.rs (5,946 lines; no edits over 1,000).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/tests-out-of-big-files branch from dcaf550 to ce27fc5 Compare October 20, 2026 20:08
…e per-line unit

CI on canary a854548 + this branch: boundary serialization 246, spawn sites
127, unjustified unwraps 2,279 (the split now sees production code that an
indented #[cfg(test)] helper hid), upward imports 674 lines across 73 pairs
(the unit changed from files to lines). No code changed between the two counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 20, 2026
…, owned by its module

Two source-reading guards failed on #5224 because a test module moved into a
sibling tests.rs read as production: experience/tests.rs became a second caller
of record_lived_turn, service_module/tests.rs a registration of
PersonaServiceModule. Each guard carried its own copy of the walk and the
comment strip, so each would have needed its own fix.

source_tree (cfg(test)) is the one reader: crate_sources(), and per file
is_test_file(), production() and owner() (x/tests.rs belongs to x.rs).
Migrated: the module-wiring audit (keys references by owner), the lived-turn
caller count (production only), the loose-id scan, the GPU base check and the
context-constant scan. Five private walks deleted. The swe env-root guard keeps
its copy until the sweep splits swe_bench.rs (5,946 lines; no edits over 1,000).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/tests-out-of-big-files branch from ce27fc5 to e179ad7 Compare October 20, 2026 20:10
joelteply added a commit that referenced this pull request Oct 20, 2026
…sures

lib.rs declaring two cfg(test) modules counted as a second test mod (19 -> 20),
so the source reader nests under test_env, the crate's test environment.
CI on this branch: lines past the readable size 154,999 -> 136,485, unwired
public machinery 60 -> 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 20, 2026
The sixth private source walk, deferred in #5224 while swe_bench.rs was 5,946
lines; the sweep split it, so the guard now uses the shared reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 7 commits October 20, 2026 15:44
…st of the file

The cut stopped at the first column-zero #[cfg(test)], which is the end of
production only when the test mod is the file's last item. It is not in many
files: ipc/mod.rs has ~3,400 production lines (start_server) after its test
mod; commands/benchmark.rs has production between three test mods;
persona_tools.rs and positron_source.rs gate a helper fn near the top. Found on
#5225, where llamacpp_adapter.rs declared 'mod tests;' at line 93 of 934 and the
split read as 10 unwraps removed when none were.

The gated item's extent is read as one character stream (string escapes and
continuations, raw strings, char literals vs lifetimes, comments), because test
fixtures carry braces in multi-line strings. Audited on canary: of 1,249 gates,
1,248 close where rustfmt closes them; the one other is a #[cfg(test)] inside
the generator's raw-string template, where the new cut keeps more real code.
Regression test: only_the_gated_item_is_test_code_never_the_rest_of_the_file.

Baselines re-measured on canary a854548 + this change (no code changed):
unwraps 2,279 -> 2,377, homes 79 -> 103, spawns 127 -> 132, head cuts
179 -> 188, serialization 246 -> 251, underived bounds 159 -> 164, unwired
60 -> 61. Each is code that was always production and was never scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
New rule (Joel, 2026-10-20): no one edits a file over 1,000 lines. 76 of
the 145 Rust files over 1,000 lines were over only because their inline
#[cfg(test)] mod tests sat inside them. This moves that module, byte for
byte (no re-indent, so string literals are untouched), to `<stem>/tests.rs`;
the parent keeps `#[cfg(test)] mod tests;`. A child module keeps `use
super::*` access, so nothing else changes.

Moved: 69 files (66 continuum-core, 3 continuum-cli-lifecycle). Skipped:
11 being split on other branches, crate roots (main/lib/mod/bin), and 1
file with items after its test mod. One include_str! path is one level
deeper (prebuilt_artifact tests).

Verified: #[test]/#[tokio::test] attributes 8,320 before and after;
continuum-core lib tests compile; continuum-cli-lifecycle 79 pass with the
same 1 failure canary has (card 250ce9c8). Still over 1,000 after this
and left to the split work: modules/forge.rs (1,003), and the tests files
of cognition/recall_faculty (1,245) and commands/training_trigger/submit
(1,332).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Without the inner attribute the hygiene scanner read the 69 moved tests.rs files as production (the
file_engine split showed unwraps rising 150). The repo's existing convention for a test module in
its own file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…, owned by its module

Two source-reading guards failed on #5224 because a test module moved into a
sibling tests.rs read as production: experience/tests.rs became a second caller
of record_lived_turn, service_module/tests.rs a registration of
PersonaServiceModule. Each guard carried its own copy of the walk and the
comment strip, so each would have needed its own fix.

source_tree (cfg(test)) is the one reader: crate_sources(), and per file
is_test_file(), production() and owner() (x/tests.rs belongs to x.rs).
Migrated: the module-wiring audit (keys references by owner), the lived-turn
caller count (production only), the loose-id scan, the GPU base check and the
context-constant scan. Five private walks deleted. The swe env-root guard keeps
its copy until the sweep splits swe_bench.rs (5,946 lines; no edits over 1,000).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…sures

lib.rs declaring two cfg(test) modules counted as a second test mod (19 -> 20),
so the source reader nests under test_env, the crate's test environment.
CI on this branch: lines past the readable size 154,999 -> 136,485, unwired
public machinery 60 -> 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
… test

Retracts the previous commit's reason for 60 -> 58. That drop was a miscount,
not a win: the rule reads a type as wired when its name appears outside its
own file, test code included, so moving a test module into a sibling tests.rs
made two types constructed only in their own tests read as externally used,
the exact AgentContext (#27) shape this rule exists to catch.

SourceFile::owning_module() names the module a file's code belongs to (x for
x.rs, x/mod.rs, and a #![cfg(test)] x/tests.rs or x/tests/part_N.rs); the
rule's own-mentions now include the moved tests of the same module. Baseline
back to 60; regression test a_type_constructed_only_in_its_moved_tests_is_still_reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/tests-out-of-big-files branch from 83bf0cc to fba07a5 Compare October 20, 2026 20:44
joelteply added a commit that referenced this pull request Oct 20, 2026
The sixth private source walk, deferred in #5224 while swe_bench.rs was 5,946
lines; the sweep split it, so the guard now uses the shared reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

PR5224 scoped independent source review

Reviewed head: fba07a5
Base: a854548
Reviewer: Astra subagent, delegated by Codex; read-only source review, no authorship of this split.
Metadata verified with governed airc gh run; all comparisons used pinned local Git objects. No checkout changes, builds, tests, or deployment.

Verdict

Source PASS for coordinator, turn_admission, serving_consumer, and capacity/grid test extraction only. This is not full PR approval or approval of inherited PR5227 hygiene changes.

Owner Production file lines Tests file lines Test annotations preserved
inference/coordinator 891 742 28
inference/turn_admission 712 752 9
modules/serving_consumer 682 631 17
capacity/grid 715 374 7

All paths are beneath core/continuum-core/src. Every reviewed changed file is at most 1000 lines.

Evidence

  • Lexically compared each base owner with head after replacing only its inline test-module body with an external mod tests;: production tokens identical in all four owners. This includes function bodies, visibility, imports, constants, and cfg attributes.
  • Lexically compared every moved test-module body with its corresponding tests.rs, ignoring the added crate-level #![cfg(test)]: identical in all four. All 61 test annotations survive; all parent declarations remain #[cfg(test)] mod tests;.
  • Externalizing an inline module under the same tests name preserves its Rust module path, privacy relationship, use super::* meaning, test names/selectors, and default logging targets. No added visibility or forwarding facade.
  • No include_str!, include_bytes!, current_exe, --exact, or super::super references in these moved test bodies that would need physical-path or subprocess-selector adjustment.
  • PR history includes bcbab21 and earlier PR5227 scanner changes, plus subsequent source_tree/production_reachability edits. Those are separate review scope. Some other PR5224 test files remain above 1000 lines; this report certifies only the four requested owner slices.

Limits

This source comparison does not validate compilation, actual test execution, scheduling performance, runtime residency, or learning. The rest of the sweep and inherited scanner/baseline changes need their respective reviews.

joelteply and others added 2 commits October 20, 2026 20:39
Applies the source-approved replacement from #5227 comment 6304136412
(Astra independent review) against bcbab21, unchanged:
- a #[cfg(test)] item that starts on the attribute's own line is blanked,
  with source line numbers preserved;
- item termination stays correct for static initializers and method
  continuations;
- one nested block-comment scanner is shared (duplicate removed);
- pub(in ...) and other restricted const visibilities are recognized by
  derived_bounds.

Measured on this tree: cargo test -p source-hygiene, 42 passed. Every
ratchet sits exactly at its existing baseline, so no baseline was edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply marked this pull request as draft October 21, 2026 01:49
@joelteply

Copy link
Copy Markdown
Contributor Author

Superseded for landing by #5228, which contains this PR's commits in full (merged down, not rebased) and passes the new oversized-edits gate. On its own, this PR now fails that gate: it creates or edits files over 1,000 lines that only #5228 splits (recall_faculty/tests.rs 1,245, training_trigger/submit/tests.rs 1,332, forge.rs 1,002). Landing order: #5227, then #5228. Converted to draft, not closed, so the scoped reviews stay readable.

joelteply added a commit that referenced this pull request Oct 21, 2026
…ts ratchet (#5227)

* Every ratchet scans the production code that exists: the split cuts at column zero

production_half stopped at the first #[cfg(test)] anywhere, so an indented
test-only helper inside an impl ended "production" for the rest of the file.
In cognition/llm_deliberation_faculty.rs that hid ~9,000 production lines
from every ratchet except derived_bounds, which already cut at column zero
for this reason (it carried its own copy of the split). Found 2026-10-20
when deleting one such helper surfaced 4 hidden unwraps.

One split for every rule, at column zero; derived_bounds' private copy is
deleted. Baselines re-measured to what was always there (not new debt):
unwraps 2,119 -> 2,274, serialization 234 -> 245, spawn sites 123 -> 128,
hand-built homes 72 -> 79. source-hygiene 39/39.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* head_cuts: a ratchet on text cuts that drop the newest end of her prompt

A cut that keeps the start of text drops what happened last (the newest
message, result, outcome), so she acts as if time never moved and loops
(Joel, 2026-10-20); and one source shrinking itself by its own number
breaks the budget for everything else. The rule counts, on prompt paths
(cognition, persona, rag, modules, airc, positron): head keepers
(chars().take, head_to_tokens, truncate_chars, lines().next()), literal
take/truncate/[..N], and literal .min/.clamp ceilings beside a size word
(plain arithmetic such as backoff exponents is not flagged). A cut that
never reaches a prompt says `head-cut-ok: <why>`.

Measured 179 on this branch; the count may only fall. source-hygiene 41/41.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* layer_discipline counts coupling sites per line, so a split by owner cannot move it

A per-file count read +7 on #5224, which only moves test modules into sibling
files: the same `use crate::modules::x` counted once per file it now sits in.
A line is the coupling site; a pure move leaves it unchanged. The baseline is
re-measured under the new unit in the next commit, from this tree's CI run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Ratchet baselines measured on canary for the column-zero split and the per-line unit

CI on canary a854548 + this branch: boundary serialization 246, spawn sites
127, unjustified unwraps 2,279 (the split now sees production code that an
indented #[cfg(test)] helper hid), upward imports 674 lines across 73 pairs
(the unit changed from files to lines). No code changed between the two counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* production_half blanks only the #[cfg(test)]-gated item, never the rest of the file

The cut stopped at the first column-zero #[cfg(test)], which is the end of
production only when the test mod is the file's last item. It is not in many
files: ipc/mod.rs has ~3,400 production lines (start_server) after its test
mod; commands/benchmark.rs has production between three test mods;
persona_tools.rs and positron_source.rs gate a helper fn near the top. Found on
#5225, where llamacpp_adapter.rs declared 'mod tests;' at line 93 of 934 and the
split read as 10 unwraps removed when none were.

The gated item's extent is read as one character stream (string escapes and
continuations, raw strings, char literals vs lifetimes, comments), because test
fixtures carry braces in multi-line strings. Audited on canary: of 1,249 gates,
1,248 close where rustfmt closes them; the one other is a #[cfg(test)] inside
the generator's raw-string template, where the new cut keeps more real code.
Regression test: only_the_gated_item_is_test_code_never_the_rest_of_the_file.

Baselines re-measured on canary a854548 + this change (no code changed):
unwraps 2,279 -> 2,377, homes 79 -> 103, spawns 127 -> 132, head cuts
179 -> 188, serialization 246 -> 251, underived bounds 159 -> 164, unwired
60 -> 61. Each is code that was always production and was never scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(source-hygiene): integrate Codex's reviewed scanner revision 5

Applies the source-approved replacement from #5227 comment 6304136412
(Astra independent review) against bcbab21, unchanged:
- a #[cfg(test)] item that starts on the attribute's own line is blanked,
  with source line numbers preserved;
- item termination stays correct for static initializers and method
  continuations;
- one nested block-comment scanner is shared (duplicate removed);
- pub(in ...) and other restricted const visibilities are recognized by
  derived_bounds.

Measured on this tree: cargo test -p source-hygiene, 42 passed. Every
ratchet sits exactly at its existing baseline, so no baseline was edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
joelteply added a commit that referenced this pull request Oct 21, 2026
…pure moves) (#5228)

* Every ratchet scans the production code that exists: the split cuts at column zero

production_half stopped at the first #[cfg(test)] anywhere, so an indented
test-only helper inside an impl ended "production" for the rest of the file.
In cognition/llm_deliberation_faculty.rs that hid ~9,000 production lines
from every ratchet except derived_bounds, which already cut at column zero
for this reason (it carried its own copy of the split). Found 2026-10-20
when deleting one such helper surfaced 4 hidden unwraps.

One split for every rule, at column zero; derived_bounds' private copy is
deleted. Baselines re-measured to what was always there (not new debt):
unwraps 2,119 -> 2,274, serialization 234 -> 245, spawn sites 123 -> 128,
hand-built homes 72 -> 79. source-hygiene 39/39.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* head_cuts: a ratchet on text cuts that drop the newest end of her prompt

A cut that keeps the start of text drops what happened last (the newest
message, result, outcome), so she acts as if time never moved and loops
(Joel, 2026-10-20); and one source shrinking itself by its own number
breaks the budget for everything else. The rule counts, on prompt paths
(cognition, persona, rag, modules, airc, positron): head keepers
(chars().take, head_to_tokens, truncate_chars, lines().next()), literal
take/truncate/[..N], and literal .min/.clamp ceilings beside a size word
(plain arithmetic such as backoff exponents is not flagged). A cut that
never reaches a prompt says `head-cut-ok: <why>`.

Measured 179 on this branch; the count may only fall. source-hygiene 41/41.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* layer_discipline counts coupling sites per line, so a split by owner cannot move it

A per-file count read +7 on #5224, which only moves test modules into sibling
files: the same `use crate::modules::x` counted once per file it now sits in.
A line is the coupling site; a pure move leaves it unchanged. The baseline is
re-measured under the new unit in the next commit, from this tree's CI run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Ratchet baselines measured on canary for the column-zero split and the per-line unit

CI on canary a854548 + this branch: boundary serialization 246, spawn sites
127, unjustified unwraps 2,279 (the split now sees production code that an
indented #[cfg(test)] helper hid), upward imports 674 lines across 73 pairs
(the unit changed from files to lines). No code changed between the two counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* production_half blanks only the #[cfg(test)]-gated item, never the rest of the file

The cut stopped at the first column-zero #[cfg(test)], which is the end of
production only when the test mod is the file's last item. It is not in many
files: ipc/mod.rs has ~3,400 production lines (start_server) after its test
mod; commands/benchmark.rs has production between three test mods;
persona_tools.rs and positron_source.rs gate a helper fn near the top. Found on
#5225, where llamacpp_adapter.rs declared 'mod tests;' at line 93 of 934 and the
split read as 10 unwraps removed when none were.

The gated item's extent is read as one character stream (string escapes and
continuations, raw strings, char literals vs lifetimes, comments), because test
fixtures carry braces in multi-line strings. Audited on canary: of 1,249 gates,
1,248 close where rustfmt closes them; the one other is a #[cfg(test)] inside
the generator's raw-string template, where the new cut keeps more real code.
Regression test: only_the_gated_item_is_test_code_never_the_rest_of_the_file.

Baselines re-measured on canary a854548 + this change (no code changed):
unwraps 2,279 -> 2,377, homes 79 -> 103, spawns 127 -> 132, head cuts
179 -> 188, serialization 246 -> 251, underived bounds 159 -> 164, unwired
60 -> 61. Each is code that was always production and was never scanned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* 69 oversized files: each one's test module moves to a sibling tests.rs

New rule (Joel, 2026-10-20): no one edits a file over 1,000 lines. 76 of
the 145 Rust files over 1,000 lines were over only because their inline
#[cfg(test)] mod tests sat inside them. This moves that module, byte for
byte (no re-indent, so string literals are untouched), to `<stem>/tests.rs`;
the parent keeps `#[cfg(test)] mod tests;`. A child module keeps `use
super::*` access, so nothing else changes.

Moved: 69 files (66 continuum-core, 3 continuum-cli-lifecycle). Skipped:
11 being split on other branches, crate roots (main/lib/mod/bin), and 1
file with items after its test mod. One include_str! path is one level
deeper (prebuilt_artifact tests).

Verified: #[test]/#[tokio::test] attributes 8,320 before and after;
continuum-core lib tests compile; continuum-cli-lifecycle 79 pass with the
same 1 failure canary has (card 250ce9c8). Still over 1,000 after this
and left to the split work: modules/forge.rs (1,003), and the tests files
of cognition/recall_faculty (1,245) and commands/training_trigger/submit
(1,332).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Moved test modules declare themselves test code (#![cfg(test)])

Without the inner attribute the hygiene scanner read the 69 moved tests.rs files as production (the
file_engine split showed unwraps rising 150). The repo's existing convention for a test module in
its own file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* One reader for the crate's own source: a moved test file is test code, owned by its module

Two source-reading guards failed on #5224 because a test module moved into a
sibling tests.rs read as production: experience/tests.rs became a second caller
of record_lived_turn, service_module/tests.rs a registration of
PersonaServiceModule. Each guard carried its own copy of the walk and the
comment strip, so each would have needed its own fix.

source_tree (cfg(test)) is the one reader: crate_sources(), and per file
is_test_file(), production() and owner() (x/tests.rs belongs to x.rs).
Migrated: the module-wiring audit (keys references by owner), the lived-turn
caller count (production only), the loose-id scan, the GPU base check and the
context-constant scan. Five private walks deleted. The swe env-root guard keeps
its copy until the sweep splits swe_bench.rs (5,946 lines; no edits over 1,000).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* source_tree lives under test_env; baselines lowered to what #5224 measures

lib.rs declaring two cfg(test) modules counted as a second test mod (19 -> 20),
so the source reader nests under test_env, the crate's test environment.
CI on this branch: lines past the readable size 154,999 -> 136,485, unwired
public machinery 60 -> 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* production_reachability: a moved test module is still its owner's own test

Retracts the previous commit's reason for 60 -> 58. That drop was a miscount,
not a win: the rule reads a type as wired when its name appears outside its
own file, test code included, so moving a test module into a sibling tests.rs
made two types constructed only in their own tests read as externally used,
the exact AgentContext (#27) shape this rule exists to catch.

SourceFile::owning_module() names the module a file's code belongs to (x for
x.rs, x/mod.rs, and a #![cfg(test)] x/tests.rs or x/tests/part_N.rs); the
rule's own-mentions now include the moved tests of the same module. Baseline
back to 60; regression test a_type_constructed_only_in_its_moved_tests_is_still_reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* production_reachability: own the joined text the counts borrow from

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split llamacpp_adapter.rs by owner: construction, payload, tests (1794 -> 934)

Pure move. construction.rs: inherent builders + ensure_loaded (+Default); payload.rs: sampling/media decode; tests.rs: tests mod. Tests 12 passed/1 ignored before and after. Two tracing::warn! gain an explicit target so log targets are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split persona/response.rs: sanitize + tests (1504 -> 918)

Pure move. sanitize.rs: think-block/leaked-markup stripping; tests.rs: tests mod. Tests 19 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split genome/teach.rs: progress, status, tests (1410 -> 944)

Pure move. progress.rs: watch cell/ledger/bus milestones; status.rs: genome/teach-status; tests.rs. Public paths kept via re-exports. Tests 15 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split modules/agent.rs: tools (1393 -> 841)

Pure move. tools.rs: tool-call parsing and tool implementations. Tests 5 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split cognition/generate_response.rs: tests (1367 -> 644)

Pure move of the tests mod. Tests 44 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split airc_remote/transport.rs: tests (1161 -> 757)

Pure move of the tests mod. Tests 12 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split inference/handle_module.rs: tests (1095 -> 663)

Pure move of the tests mod. Tests 23 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Split persona/rag_inspect.rs: tests (1035 -> 684)

Pure move of the tests mod. Tests 15 passed before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* file_size baseline 136,485 -> 133,731 after the eight splits (measured on this head)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* WIP: split the 59 remaining oversized files by owner (scripted, pure moves)

Lines past 1000: 153,027 -> 58,046 (files over 1000: ~140 -> 18). Test attributes 8,320 = base.
Workspace tests vs base: 9,573/43 vs 9,568/48; the 8 sweep-only failures were source-reading
tests (fixed: loose-id declarations moved with their fields, the guard sees widened fields,
three include paths). Ratchets: at or below canary's true counts once the column-zero scanner
fix lands; upward-imports (per-file count) and derived-bounds (+3) still to reconcile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The swe env-root guard reads the crate through test_env::source_tree

The sixth private source walk, deferred in #5224 while swe_bench.rs was 5,946
lines; the sweep split it, so the guard now uses the shared reader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Scanned constants keep any visibility; sweep baselines measured on this head

The split widens a moved constant to pub(in crate::path), which neither
derived_bounds' prefix list nor the context-constant guard recognized, so
NARRATION_BUDGET left the scan the day it moved. Both now strip any visibility.

Measured on this head: lines past the readable size 133,731 -> 57,268; excess
test mods 19 -> 15 (multi-mod suites became nested themes in one test file);
unwired 61 -> 57, which is NOT a win: four types read as wired only because
their constructor moved to a sibling chunk (named at the baseline, card 7660e70f).
Unjustified unwraps, upward imports, spawns, homes, serialization, head cuts
and underived bounds are unchanged: the sweep moves code, it changes none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The sweep's imports narrowed to what each module actually re-exports; zero new warnings

The splitter gave every child a 'pub use child::*' in its parent. Where the
child's items are crate- or module-scoped that re-export was too wide (56
'glob import doesn't reexport' warnings) or reached nothing (51 unused). Each
glob now carries the visibility its items have (pub(crate), the module's own
pub(in ...), or private), and the ones nothing resolves through are removed,
compiler-checked after each pass. run_harness/Harness are crate-scoped (their
only caller is grade.rs) instead of widening a chain of private types.

Built on the M5 in a build window (serving down), cargo test --lib --no-run
with --features metal,accelerate: 0 warnings that the base (#5225 head) does not
have; 63 total vs the base's 72 (9 old unused imports went with them). The CI
baseline is set to 66 on the inference that CI's Linux build carries the same 3
cfg-only warnings it did at the base (75 vs 72); CI prints the exact number.

cargo test -p continuum-core --lib (metal, M5): 9,002 passed, 2 failed:
- the lived-turn guard named settle.rs; the driver now sits in settle/, so the
  guard accepts the settle module (fixed here, passes).
- config_env read_all_on_a_missing_file: a stale temp file from an earlier run
  on this machine (card 4c820b46); passes on fresh CI runners.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* kill9: the parent glob import is Windows-only, where its one caller lives

Removed as unused on the macOS build; the Windows build needs it for
parse_tasklist_image_name (CI: Windows core compilation, E0425).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* benchmark_dispatch: recipe path extracted to run_recipe (no behaviour change)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* voice_module: decompose handle_command into per-family files (no behaviour change)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* model catalog: models() split into per-provider-family row functions, original order kept (no behaviour change)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* launch_gate: windows module decomposed into startup gate, scheduler script, custody, recovery journal and tests (no behaviour change)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* serve_persona_loop_inner: decomposed by responsibility (no behaviour change)

Wake selection, quiescence, self-tick, backlog resync + loop-filler gate, turn intake
(admit/compose/burst), the WorkspaceCycle step and the spoken-turn settle each move to
a sibling module; the loop reads as setup + named steps with Step enums for the
continue/break exits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* start_server.rs: decomposed by boot phase (no behaviour change)

start_server() was one 3,388-line function. It is now the ordered list of
boot phases (259 lines); each phase lives in a child module under
ipc/start_server/ that owns it (model registry, foundation modules,
resource authority, serving, pressure broker, inference, cognition,
live call, service modules, AIRC discovery, persona registry/hosting/
reconciler, re-home reconciler, AI+genome, closing modules, runtime
start, command executor, listeners, TCP ingress, WS ingress, memory
guard, accept loop). Code is moved verbatim; shared values travel as
parameters or small structs (Foundation, CognitionHandles, LiveCall,
CodeHandles, AircBoot, RuntimeStarted). Order of spawns, registrations
and binds is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* start_server: keep the unwrap_or_else justification on its own line

rustfmt moved the same-line `// unwrap_or_else: ...` comment to the next
line, which the unwrap ratchet counts as unjustified (2377 -> 2378).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* persona loop: phase_timings is mutable where say_ms is recorded; baselines for the deduplicated trigger

CI E0594 on turn_settle.rs. The loop built its trigger InboxMessage twice (the
loop-filler gate and admission), each with a peer- id cut and an unwrap_or_else;
trigger_inbox_message builds it once, so head cuts 188 -> 187 and unjustified
unwraps 2,377 -> 2,376 (checked in the diff), lines past the readable size
57,268 -> 56,859.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* launch_gate: the PowerShell include is two directories deeper; file_size baseline 57,131

Windows CI: couldn't read windows-prepared.ps1 from launch_gate/windows/. The
path now climbs seven levels (checked: the file resolves).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* file_size baseline 57,131 -> 54,053 with the six giant items decomposed (measured on this merge)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* fix(source-hygiene): integrate Codex's reviewed scanner revision 5

Applies the source-approved replacement from #5227 comment 6304136412
(Astra independent review) against bcbab21, unchanged:
- a #[cfg(test)] item that starts on the attribute's own line is blanked,
  with source line numbers preserved;
- item termination stays correct for static initializers and method
  continuations;
- one nested block-comment scanner is shared (duplicate removed);
- pub(in ...) and other restricted const visibilities are recognized by
  derived_bounds.

Measured on this tree: cargo test -p source-hygiene, 42 passed. Every
ratchet sits exactly at its existing baseline, so no baseline was edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* test_env/source_tree: production is source-hygiene's projection, not a cut at the first cfg(test)

Codex on #5228 (REQUEST CHANGES, comment 6307538140): the shared test reader
ended production at the first column-zero #[cfg(test)], so production below a
mid-file test mod or gated helper was invisible to the lived-turn exactly-one-
caller guard, which the old private scan did see. That is the same hole
production_half already closed for the ratchets (#5227).

- production() delegates to source_hygiene::production_half (existing
  dev-dependency); only the gated items are removed.
- code_only delegates to source_hygiene::split_code_and_comment, the one
  string-aware comment rule, instead of a second cruder copy.
- Regression test: a function below a mid-file test mod stays production, and
  the gated item does not.

Uncompiled locally (serving node); CI runs the guard tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Restore the comments the split dropped; the moved Windows test file is #![cfg(test)]

Independent whole-PR review of 7bcdb2b (REQUEST CHANGES, P2): the
splitter carried code faithfully but dropped about 506 lines of free-standing
`//` comments between items, plus trailing comments on const lines.
Examples are the MAX_LANES history in serving_plan.rs, the evidence-ledger
rules in benchmark.rs and the parser format examples.

- 186 blocks (596 lines) restored by script. Each is placed before the line
  that followed it in canary, matched on the next three lines with
  visibility normalised; indentation follows the new nesting.
- Three trailing const comments restored: `// 2 GiB`, `// 1 hour`,
  `// 0=Normal`.
- Seven blocks placed by hand: section banners, the ipc handler pointer, the
  vector-params note, test-module banners and the model-family parser
  banner.
- Not restored, on purpose: comments on test code that the shared
  source_tree reader replaced (experience.rs code_only, device_probe.rs).
  The persona-loop provenance and wake-engram notes were already carried,
  as rewrites, in turn_cycle.rs and turn_context.rs.
- The diff adds comment lines only, apart from the three trailing comments
  on existing lines; no code changes.
- launch_gate/windows/tests.rs now starts with #![cfg(test)] (review
  finding 3).

source-hygiene 43/43, no count moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Restore the benchmark/swe-setup rationale above SweSetupParams; trailing comments keep one space

Review of ad6dc73: the last block the split dropped (canary
benchmark.rs:3930-3940). The three restored trailing comments now use one
space before //, as canary had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant