Commit Graph
5 Commits
Author SHA1 Message Date
Pavlo Ratushnyi c347d46b80 STRA-338 S13: diagnostics settings, and the ratchets follow modules declared inside test-only files
Diagnostics topic of Settings: the bring-up trace, the driver-error trace (the nine driver_error functions
share crate::driver_errors_traced), the PLE, prefill-residual, seed and prefix traces, the serve profile
and the prefill profile sync. A set-ness switch is on for any value, as before; the serve profile and the
spec traces stay off for 0 and the empty string. The OnceLock readers are gone.

measure.py: a module declared inside a file that is itself compiled only for tests (for example
fivecase_frames.rs under native_down_candidate_only.rs, through #[path]) is test-only too. Unit test added.
Accounting only; env-read of leleka-runtime is now 1 (ProcessEnv::get_os, the one place that calls std::env),
instant-now 45 to 42, path-include 102 to 101, process-global 69 to 61.
2026-11-05 22:41:12 +01:00
Pavlo Ratushnyi 82d31e68da STRA-338 S13: the source ratchets also skip an inline module under a test cfg
An inline `#[cfg(all(test, ...))] mod x {` proof module in a production file (gdn_chain, gdn_verification,
mtp_expert_workspace, kar_ple_cache) was counted. production_lines now skips it up to its closing brace
and still counts the code after it. Accounting only: env-read leleka-runtime 101 to 93, leleka-cuda-driver
77 to 76, instant-now strata-control 37 to 35; nothing rose.
2026-11-05 21:44:34 +01:00
Pavlo Ratushnyi a389ebb0eb STRA-338 S13: the source ratchets count production code only, not modules compiled for tests
The ratchet counted `#[path]` proof harnesses (gpu_proofs/, backend_original_serve_replay.rs) and
`#[ignore]` test files that sit outside a column-0 `#[cfg(test)] mod`, so the env-read count of
leleka-runtime (261) was mostly test-only reads that Settings cannot and should not remove.

measure.py now also skips a file declared as `mod x;` under a test cfg attribute (with or without
`#[path]`, multi-line `cfg(all(...))` included) and every file below such a module. A cfg(not(test))
module still counts. Unit test added. This is an accounting correction, not a code change: every
ratchet of the baseline can only fall (env-read leleka-runtime 261 to 101, leleka-cuda-driver 130
to 77, instant-now 79 to 45 and 45 to 31, dyn-trait, path-include, process-global), nothing rose.
2026-11-05 21:43:43 +01:00
Pavlo Ratushnyi f78b89757c STRA-338 S12a: inline unit-test modules move to sibling tests.rs files in 118 oversize files
scripts/dev/extract_tests.py moves a trailing cfg(test) mod tests block into foo/tests.rs for 118 files of leleka-runtime, cuda-driver, control-plane, gateway-text, deploy and nine smaller crates (31,000 lines), leaving production code and test ids untouched; 22 files that are themselves loaded through a path attribute carry an explicit path to their tests file. Not touched: the files the kar-off-ab branch edits (backend.rs, backend_original_serve.rs, backend_original_serve_replay.rs, qwen4exp_resident_expert_source.rs and seven deploy files).

Verified: cargo check --all-targets for the whole workspace on x86_64 Linux and on the Windows host; the 2429 library unit-test ids of the workspace are identical before and after (Linux listing diff empty); the loadable sections of leleka-inference, leleka-daemon, leleka-cli and strata-next are byte-identical between a release build before and after (scripts/dev/elf-sections-equal.sh), so the shipped code is the same. The architecture ratchets exclude tests.rs from the path-include count; the baseline drops from 329 to 311 oversize files and from 302,000 to 273,600 lines.
2026-11-05 15:00:09 +01:00
Pavlo Ratushnyi 52d554e72c STRA-338 S6 part 2: SSE streaming leaves responses.rs; architecture gate rewritten to the 301 limits
The text, buffered and tool-call streaming code of the Responses API (750 lines) moves from control-plane/src/responses.rs to responses/stream.rs without a logic change, and the architecture gate becomes a small package (scripts/archcheck) whose functions stay within 30 lines, complexity 10, nesting 4 and 5 parameters.

The source counters now stop only at a column-0 cfg(test) module, so a single cfg(test) function no longer hides the code after it; that raises some measured baselines (cuda-driver, runtime, model-format, strata-control) without any code change, and the baseline was rewritten using --allow-increase for that reason alone.

Verified: cargo test -p strata-control 277 lib tests, 0 failed; 18 gate self-tests pass; fmt clean.
2026-11-05 13:47:14 +01:00