Skip to content

Every remaining Rust file over 1,000 lines split into child modules (pure moves) - #5228

Merged
joelteply merged 46 commits into
canaryfrom
fable/split-every-oversized-file
Oct 21, 2026
Merged

joelteply merged 46 commits into
canaryfrom
fable/split-every-oversized-file

Conversation

@joelteply

@joelteply joelteply commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Every Rust file over 1,000 lines that no other PR owns, split into child modules: pure moves, scripted (the splitter that also produced #5225's shape), so the new rule ("no one edits a file over 1,000 lines", gate in #5221) can bind.

Stacked: #5227 → #5224 → #5225 → this. Review the last two commits; everything below them is those PRs.

What moved

  • Rust files over 1,000 lines (vendor excluded, wc -l): canary a854548 has 144 holding 303,020 lines; this head has 17 holding 74,396 (listed below). This PR and the two it stacks on (69 oversized files: each test module moves to a sibling tests.rs #5224, Eight files over 1,000 lines split by owner (pure moves) #5225) take it from 144 to 17; six of the 17 are already split on owner branches (below).
  • Each child module use super::*; the parent pub use child::*. Visibility widened only where a moved item is now in a sibling (private → pub(super), an existing pub(super) → pub(in crate::<parent>)). Relative paths: super:: → super::super::, include paths gain one ../ per level. Test modules over 950 lines go to tests/mod.rs + part_N.rs, each #![cfg(test)].
  • Chunks are named by their first item. That is a starting point, not an owner name: renames by owner follow in their own PRs, now that each owner is small enough to edit.
  • ipc/mod.rs and modules/grid/handlers.rs were re-split from canary's current text on the restack (canary changed them after the first split).

Fixed in the same change (sweep-only failures)

  • identity/mod.rs loose-id detector strips any pub(...), and 12 LooseId declarations name the file each field now lives in.
  • Three source-reading tests repointed at the files their code moved to (service_loop, recipe/validate, no_cpu_fallback_contract).
  • The swe env-root guard reads the crate through test_env::source_tree (the shared reader from 69 oversized files: each test module moves to a sibling tests.rs #5224).

Not in this PR (each split on its own branch, PRs to follow)

llm_deliberation_faculty.rs (being rebuilt on canary, replaces #5226), file_engine.rs, working_memory.rs, openai_adapter.rs, dream_consolidation.rs, resource_admission.rs.
Still over 1,000 with no split yet, each a single giant item to decompose by hand: ipc/start_server.rs (3,388), bin/continuum.rs (9,811), serving_daemon.rs and llama_server.rs (Codex's lane), act_observe/mod.rs, launch_gate.rs, serve_persona_loop_inner.rs, voice_module.rs, models.rs, templates.rs, benchmark_dispatch.rs.

Verification

CI only: no compile on the M5 while it serves. cargo test -p continuum-core --lib and the source-hygiene ratchets on this exact head. The first sweep build (before the restack) compiled; its test failures matched base except 8, which are the fixes above. Not yet re-run on this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Independent whole-PR review (2026-10-21)

The reviewer did not author the sweep. 7bcdb2b got REQUEST CHANGES: the splitter dropped about 506 comment lines. After the fixes in ad6dc73 and b4db6ed, the 37 dropped lines still absent are accounted for:

  • Deliberate omissions: comments on test helpers that test_env/source_tree replaced (experience.rs, device_probe.rs), and } // end mod stress markers.
  • Comments on code the decomposition removed: the deferred bindings in service_loop.rs. The wake_engram note was rewritten at serve_persona_loop_inner.rs:274.
  • Already present: the turn_admission hits are scanner false positives; that text is in turn_admission/tests.rs.

The fix commits add comment lines only, plus #![cfg(test)] on launch_gate/windows/tests.rs.

Verified by the reviewer:

  • Moved code matches canary after module plumbing. Checked on 25 files and the full diff.
  • No cfg gate lost.
  • No visibility widened.
  • The six decompositions are equivalent: start_server phase order, the 23 voice arms, model id order, the benchmark recipe return, and the await_wake select arms.
  • recipe/validate.rs and no_cpu_fallback_contract.rs still read the code they guard.

Accepted P3s, disclosed:

  • Log component labels change for about 250 clog_* sites. The label comes from module_path!()'s last segment, so moved code logs under the child module's name. Chunked modules show up as call_manager_2 and data_state_2. Log files and EnvFilter targets are unchanged because both match by prefix.
  • production_reachability 61 → 57 is lost detection, not progress. BenchRound, EmbeddingCache, NeuralEmbeddingProvider and CommandRegistration are still only constructed inside their former file. The split made that look like outside use. Card 7660e70f owns it.

joelteply and others added 4 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply and others added 19 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…4 -> 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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Pure move. tools.rs: tool-call parsing and tool implementations. Tests 5 passed before and after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…is 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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/split-every-oversized-file branch from 275a6bd to 024c9c7 Compare October 20, 2026 20:47
joelteply and others added 4 commits October 20, 2026 16:50
… 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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ives

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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Scoped source PASS at f20d06a for the deduplicated trigger InboxMessage constructor. Compared both old constructors in a854548 service_loop.rs against backlog_resync.rs:25 and its call sites (backlog_resync.rs:215, turn_context.rs:53): all fields preserved, including fresh UUID per construction, transport-selected turn_room, sender identity/name, rendered media content, admission-time timestamp, priority and optional fields. Loop-filler still admits before returning Continue; admitted retries still bypass re-admission and preserve their wake engram. This is not a full sweep approval or endorsement of pre-existing fallback policy. No tests/builds run locally; host-spawn review is separate and pending.

@joelteply

Copy link
Copy Markdown
Contributor Author

Scoped independent SOURCE PASS for persona-host spawn at f20d06a against a854548. persona_hosting.rs:258-271 creates the oneshot and subscribes synchronously before spawn. persona_host_reconciler.rs:21-32 awaits the same wired Arc before pull/provider/spawn work. start_server.rs:196-218 initializes/verifies runtime and installs module executors before command_executor.rs sends readiness. Early boot error drops sender and the waiting task returns. Independent comparison matched 1329 executable tokens after inlining the extracted pull helper, aside from equivalent escaped-newline string indentation.

No introduced lifecycle/custody/error-path defect found in this seam. Detached reconciler/pull handles and warning-only initialization failures predate the split; this does not establish supervision improvements. Default tracing/probe targets move from ipc to child modules while classes/messages remain. No local build or live validation; this is not full-sweep approval. Together with comment6304690331, both requested hand-edited seams now have scoped source verdicts.

@joelteply

Copy link
Copy Markdown
Contributor Author

Scoped source review at f20d06a, base a854548: lifecycle test extraction passes source equivalence for launchd, prebuilt_artifact and supervisor_install.

The three production parents are byte-equivalent after replacing the final inline test module with its external declaration. launchd and supervisor_install test bodies are unchanged (11 and 10 test attributes). prebuilt_artifact preserves its nine tests with exactly one necessary change: the core-binaries.yml include moves from ../../../ to ../../../../ for the extra directory. Parent cfg(test), child cfg(test), and logical module names remain intact. No subprocess --exact/current_exe/module_path selectors were found in these three extracted bodies.

This supports modular cleanup while preserving installer behavior; it is not a runtime speed measurement. Receipt: 5228-cli-test-equivalence-20261021-0109.json plus inspected include path delta. No builds/tests executed here. Maintenance subtree and the rest of this PR are excluded from this verdict; inherited scanner concerns remain separate.

@joelteply

Copy link
Copy Markdown
Contributor Author

PR5228 serving-plan extraction — independent source review

Head: f20d06a
Base: a854548
Scope: core/continuum-core/src/cognition/serving_plan.rs and its extracted subtree only.
Reviewer: Astra, delegated independent reviewer; did not author this extraction.
Method: pinned local git show/diff, lexical comparison and source/reference inspection. No checkout edits, build, fetch, test execution or runtime changes. Receipt is the only written artifact.

Verdict

Scoped SOURCE PASS. No confirmed semantic regression found in this slice. This does not approve the remaining PR5228 sweep or certify CI/live behavior.

Evidence

  • Reassembled extracted production units in original order after removing module wiring/import boilerplate. All 3,305 original production tokens are preserved; the only added executable tokens are pub(super) on bytes_gb (plan_serving.rs:568), allowing the parent to retain access after extraction. No expression, branch, measurement field, limit, diagnostic rationale, or arithmetic changes.
  • 24 production functions remain (20 in max_lanes.rs, 4 in plan_serving.rs). Public API names remain exported through serving_plan.rs:42-45; extracted modules stay private. ServingDemand, HostBudget, ModelFootprint, ServingPlan and associated enums retain fields/derives and implementation bodies. No additional runner, scheduler, store, or admission policy introduced.
  • Requirement-aware allocation still calls the existing window_allocator::allocate (plan_serving.rs:226-249), preserves explicit NoFit output, and keeps the legacy path for missing requirements. Requested/measured/sticky/typical prompt distinctions, leased-in demand, lane/window constraints, stable/at-rest planning, peak memory accounting, and rationale construction are byte-token-equivalent to base. This is preservation, not endorsement of inherited fixed limits or proof that live evidence is correct.
  • The pre-existing footprint.rs blob is identical, keeping its measurement/probe owner untouched. Newly moved production code contains no tracing/probe/module_path calls; no logging-target migration occurs in this slice. Human-readable rationale string contents remain identical.
  • All 40 #[test] cases remain: 15 in tests/mod.rs, 19 in tests/part_2.rs, 6 in tests/part_3.rs. After removing module boilerplate, all 7,647 original test-body tokens remain; differences are 44 added pub(super) visibility annotations on test functions/helpers/constants only. Fixture values and assertions are unchanged. These annotations are broader than needed for most test functions but confined to cfg(test) code; not a semantic blocker.
  • Parent tests is #[cfg(test)]; every extracted test file additionally declares #![cfg(test)]. Parent helpers remain reachable through use super::*; no unresolved relative physical include or subprocess selector exists in these test bodies. The 25 tests in part_2/part_3 gain those path components; repository-wide pinned searches found no exact serving_plan::tests selector or include_str!/include_bytes! path requiring migration. Ordinary test discovery remains intact; actual execution not performed.
  • Changed file lengths: root 48; max_lanes.rs 607; plan_serving.rs 570; tests/mod.rs 705; tests/part_2.rs 683; tests/part_3.rs 198. All below 1,000 lines.

Read relevant AGENTS.md/CLAUDE.md, existing concurrency guidance, and pinned SERVING-OBSERVATION-AND-DEMAND.md / ADMISSION-IS-UNOBSERVABLE.md. The extraction advances modularity while preserving the existing planner/scheduler seam. No performance, residency, or learning claim is made.

@joelteply

Copy link
Copy Markdown
Contributor Author

PR5228 adapter-only source review

Head: f20d06a
PR base verified through gh: a854548
Scope: core/continuum-core/src/ai/adapter.rs and its extracted adapter subtree only.
Reviewer did not author this extraction. Read AGENTS/README/CLAUDE testing instructions. No checkout edits, builds or runtime actions; this receipt is outside the checkout.

Scoped verdict

No introduced adapter-selection/model/native-binding logic defect found. NOT an approval of the whole sweep. One observable diagnostics change prevents claiming a completely behavior-identical move unless explicitly accepted or preserved:

  • adapter/adapter_selection_error.rs:258,285,351,359 moved four clog_warn! invocation sites. logging/mod.rs:311 expands module_path! at the caller; :263 extracts the last segment. The component changes from adapter to adapter_selection_error. Category selection (:204) still matches ai::, warning text and severity stay unchanged. Component-filtered diagnostics for adapter can therefore miss these warnings. Preserve the old component through an explicit supported logging seam, or document/accept the component migration rather than claiming diagnostic equivalence. No current component-filter consumer was established by this scoped inspection.

Source equivalence evidence

Concatenated inference_device.rs + adapter_selection_error.rs + tests.rs, retaining source order. Line comparison after trimming indentation/blank lines and normalizing ONLY pub(super) additions, use super::* and inner cfg(test) gives exact equality to the original body except root imports/docs retained in adapter.rs, the removed test-module wrapper, and five obsolete ArcAdapterShim commentary lines. All 70 function declarations preserved; four #[test] and two #[tokio::test] attributes preserved. This checks actual source, not merely test counts. No formatting-normalization of strings or changed branches was needed.

Six explicit visibility widenings remain confined to the adapter parent: capability-builder inner field; registry adapters and priority_order fields; registration_key, get_shared, select_shared helpers. Public types/trait/functions are reexported through the original ai::adapter path via private child modules. AdapterSelectionError retains its single NoEligibleProductionAdapter variant, fields, derives, Display text and Error impl.

Selection remains byte-for-byte equivalent after extraction: no-specifier refusal; named-provider lookup honoring supplied model supports_model; unavailable named provider refuses rather than selecting another; registry-driven cloud branch; device-filtered priority scan; select_arc clones the selected Arc without relooking up the provider identifier. Duplicate-provider/model-selection and retained-lease fixture remains intact. No persona identity/binding rewrite was added.

Existing limitations are not fixed or endorsed: InferenceDevice::Auto accepts every device in the selector despite its GPU-only documentation; named providers bypass device filtering; local is a routing category rather than an immutable model identity; cloud routing precedes generic local selection. These predate this head. Equivalent selection is not proof that every upstream caller supplies a native model binding.

Tests remain at ai::adapter::tests via #[cfg(test)] mod tests; extracted tests.rs has #![cfg(test)] and the original six test names. Source discovery appears preserved; no compiler/test run performed. No deployed-performance or learning claim.

Responsibility naming observation (non-blocking for this bounded review): adapter_selection_error.rs owns most AdapterRegistry behavior, while the error enum lives in inference_device.rs. Names do not describe the extracted ownership cleanly; source move is verified but a coherent naming cleanup would improve reviewability.

joelteply and others added 4 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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…lit-every-oversized-file

# Conflicts:
#	core/source-hygiene/src/derived_bounds.rs
@joelteply

Copy link
Copy Markdown
Contributor Author

Codex review at exact head ebcba4e: REQUEST CHANGES for one concrete guard regression.

[P2] Reuse the corrected production projection in the new shared test reader.

core/continuum-core/src/test_env/source_tree.rs:58 uses take_while(|l| !l.starts_with("#[cfg(test)]")), dropping all source after the first test-gated item. The migrated lived-turn caller guard in cognition/experience/tests.rs:698 now uses this projection. Previously that guard scanned all non-comment source outside experience.rs, so an additional production record_lived_turn call after a test helper was detected; now it is invisible. For example, a separate source file containing a cfg(test)-gated helper followed by fn extra() { record_lived_turn(...); } projects to an empty string. With the legitimate settle-driver caller still present, the exactly-one assertion stays green. This is a guard regression, not a claim that this PR already double-records turns.

The fix is small and shared: core already has source-hygiene as a dev-dependency. Reuse its reviewed production_half projection instead of maintaining a second truncation rule, preserving moved-test exclusion/comment handling. Add a fixture with a gated helper or module followed by production and exercise the caller guard against a second caller there.

#5227 is now cleared at 6ac1a84. All eight #5228 checks are verified green, but do not exercise this counterexample. Existing scoped source passes (trigger constructor, host readiness, serving_plan, adapter and lifecycle test extractions) remain valid: the delta from reviewed f20d06a to this head contains only the scanner integration. Full mechanical sweep coverage is still being checked; this finding is independently reproduced by source review. No local compilation, merge or deployment.

joelteply and others added 2 commits October 20, 2026 23:07
…versized-file

# Conflicts:
#	core/source-hygiene/src/head_cuts.rs
#	core/source-hygiene/src/production_reachability.rs
#	core/source-hygiene/src/unwrap_justification.rs
…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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed exact head 7bcdb2b, specifically the source_tree correction. The reported P2 is resolved in source: production() delegates to source_hygiene::production_half rather than truncating at the first cfg(test); the regression explicitly retains a production caller after a mid-file test module and excludes the gated caller. code_only also reuses split_code_and_comment, preserving string literals. This clears my specific source-projection finding. CI is still required; this is not a blanket approval of the entire sweep or a deployment receipt.

…s #![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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ing 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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Independent whole-PR review (the reviewer did not author the sweep): PASS at b4db6ed.

Claims verified:

  • Moved code matches canary after module plumbing (25 files plus the full diff).
  • No cfg gate lost and no visibility widened.
  • The six decompositions are equivalent.
  • Comments are restored. The 37 lines still absent are the omissions disclosed in the PR body.
  • diff of canary benchmark.rs 3930-3940 against head resolve_solver_dir.rs 67-77 is empty.
  • Both narrowed source contracts still read the code they guard.

Earlier: REQUEST CHANGES at 7bcdb2b (dropped comments), then one remaining block at ad6dc73; both are resolved.

joelteply added a commit that referenced this pull request Oct 21, 2026
…ast run left behind (#5242)

Card 4c820b46. tmp_config numbered paths with a per-process counter that
restarts at 0, so continuum-config-env-test-0/config.env from an earlier run
was read back: read_all_on_a_missing_file_is_empty_not_a_panic failed locally
(M5, 2026-10-21, cargo test on #5228 7bcdb2b: 9004 passed, this 1 failed)
while CI's clean runners passed. tempfile::Builder gives an empty, unique dir.


Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

Co-authored-by: Claude Opus 5.5 <[email protected]>
@joelteply
joelteply merged commit 437ee5f into canary Oct 21, 2026
8 checks passed
@joelteply
joelteply deleted the fable/split-every-oversized-file branch October 21, 2026 07:13
joelteply added a commit that referenced this pull request Oct 21, 2026
Rebuilt as canary plus this PR's own commits (cherry-picked with -x). The
old branch carried #5227/#5228's pre-squash history. Each changed count is
traced to its cause in the comment beside it. cargo test -p source-hygiene
passes 43/43 on a fresh per-worktree build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 21, 2026
Rebuilt as canary plus this PR's own commits (cherry-picked with -x). The
old branch carried #5227/#5228's pre-squash history. Each changed count is
traced to its cause in the comment beside it. cargo test -p source-hygiene
passes 43/43 on a fresh per-worktree build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 21, 2026
Rebuilt as canary plus this PR's own commits (cherry-picked with -x). The
old branch carried #5227/#5228's pre-squash history. Each changed count is
traced to its cause in the comment beside it. cargo test -p source-hygiene
passes 43/43 on a fresh per-worktree build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Oct 21, 2026
Rebuilt as canary plus this PR's own commits (cherry-picked with -x). The
old branch carried #5227/#5228's pre-squash history. Each changed count is
traced to its cause in the comment beside it. cargo test -p source-hygiene
passes 43/43 on a fresh per-worktree build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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