docs/architecture/size-split-rest.md records the mapping of the 24 oversize files and the test-id parity (27 crates, 0
missing / 0 new / 0 outcome changes on Linux). render_request_with now delegates the template call to render_messages
(gateway-domain fn>30 16 -> 15, cx>10 13 -> 12). limits-allowlist.json gains 80 entries (owner STRA-338, reason "moved
verbatim ... not yet decomposed"); limits-baseline.json and architecture-baseline.json re-run with --update-baseline
(no total raised). Oversize files in the crates of this batch: 0.
Helpers extracted from test functions that were moved verbatim by the split (their allowlist entries are gone):
native_pack one_layer, service_install unix tests, request_monitor streams, vision fetch, config control_vector_file,
kar_writer, node_reconnect launch, worker lifecycle, model hub token, kar_codec f16, the backend_worker_http prompt
limits, wire gen lines, lifecycle admission, service_switch journal, node_contract proxy, memory_gate reconfigure,
the ggml Q6/Q2 block builders, gguf_f32_stream IQ3/IQ4 truncation and the control-token rendering test.
docs/architecture/size-split-control-plane-desktop-core.md records where every oversize file went and how test ids moved.
Test ids: 543 before and after, 0 missing, 0 outcome changes; warnings in the two crates 0.
Tests become directory modules named after what they test, with a shared fixtures/harness module:
control-plane/src/{responses,ggml_bridge,gguf_f32_stream,prepare_preview}/tests/, desktop-core/src/runtime_rpc/tests/;
integration targets become tests/<name>/main.rs plus topic modules and a harness (backend_worker_http, vision_http,
memory_gate_http, tool_corpus, mcp_hub, api_over_runtime, runtime_gateway_sdet, native_tools_sdet,
native_tools_retry_sdet, managed_worker, gateway); target names are unchanged. Sources: leleka-inference.rs becomes
src/bin/leleka-inference/ (main.rs plus one module per operator option group), the cp_replay example becomes
examples/cp_replay/, and the tonic service impl of runtime_rpc delegates to session_rpc, model_rpc and generate_rpc
(bodies unchanged). impl_* modules are renamed after what they hold (base_provenance, count_tokens, manifest_fetch,
fetcher, record, capture, in_flight, tool_policy, tool_plan, server). The self-spawning tests that name themselves
(credential_child, the managed worker fixture) use the new module path or stay at the target root.
Test ids: 543 before and after in both crates (strata-control, strata-desktop-core, --all-targets), 0 missing, 0 new,
0 outcome changes; 241 ids differ only in the module path. Warnings in the two crates: 0 before and after.
Counts (strata-control / strata-desktop-core): oversize files 19 -> 0 (13 + 6). Functions over 30 lines, complexity 10,
nesting 4, wide lines, prod: 187/135/17/199 -> 187/135/17/196 and 81/59/6/54 -> 81/59/6/54; test: 214/17/30/133 ->
214/17/30/133 and 65/3/3/30 -> 65/3/3/27. The 211 functions that moved verbatim are in limits-allowlist.json (owner
STRA-338) because the diff gate treats a moved function as added; the entries fall as the functions are shortened.
SmokeInventory failed three tests at a4ceeab69 and 8890db316.
test_gates_values_and_classes_on_known_tests (caused by the S12c/S17 splits, seen after S22): the
fixture helper of actual_expert215_native_resident_gu_and_same_source_down_diagnostic moved from
mmq_native_resident_gpu.rs into mmq_native_resident_gpu/digest_fn.rs, and only `read` there opens
files. The scanner looked for file-reading helpers in the test's own file and one call deep, so a
test that reads a private fixture was classified device instead of assets. The rule is now the
module tree (x.rs with x/*.rs, or x/y.rs with x.rs) and the helper search is transitive. The
test expectation is unchanged: the smoke needs LELEKA_REAL_GU_DIR and is an assets test. Checked
against the merge base with main: every name that exists in both has the same class, gates and
needs.
test_every_smoke_lands_in_a_declared_group_and_dependencies_precede (51 smokes, 45 of them
already ungrouped on main): smoke-groups.json declares them. Unlisted cuda-driver smokes go to
transport (src/tests.rs and device_slab/tests.rs, which were lib.rs inline tests before S17,
mapped_file_dma_stress_gpu, native_head), qsa (late selection, mapped journal), mtp (scalar short
path), dispatch (qwen_dispatch/ children after the split) and runtime-moe (expert tier
residency). New groups: prefill-stage (depends on gr, gdn), pcie-copy, serve-probes (depends on
seal-loads) and cpu-probes, kind cpu: benchmarks, scale simulations and timing probes of
native-cpu-expert, engine-core and engine-qwen35-cuda that need no GPU and stay out of the default
device run. LELEKA_PLE_PROBE_ARCHIVE, LELEKA_PLE_PROBE_ROWS and LELEKA_SYNTH_KAR are asset
variables now, so the smokes that read the 55 GB archive are no longer classed as device.
CRATE_PACKAGE names leleka-engine-core, leleka-model-format and leleka-deploy (the plan used the
directory name as package).
test_doc_table_is_current: docs/gpu-bringup.md regenerated with smoke_inventory.py --update-doc
under WSL; the section on group order mentions the new groups and the cpu kind.
run_backend_worker (twice per request) and the stdio worker's run_session (once per request) stamp last_activity with
ObsHandle::now(). The stamps at attach or READY and the per-engine-line stamp keep Instant::now(). The instant-now ratchet
of strata-control falls from 26 to 23. Docs: gateway-ports.md lists what is and is not behind the Clock.
messages/request.rs (the Messages request types and Request::into_responses, CountRequest, text and block helpers) and
messages/reply.rs (message, stop reason, tool_use block, usage, the error type table and envelope as functions of the
status number) are in crates/gateway-domain. strata-control keeps the route layers, the SSE adaptation and the HTTP errors;
error_value(StatusCode, ..) is a wrapper over the domain function. The adapter tests stay where they are and pass on the
moved code (same test ids). The long functions are added to docs/architecture/tech-debt.md, the continuation is recorded in
docs/experiments/stra-338-gateway-track.md (90 golden cases; an earlier commit message says 96, which was a miscount).
harmony_conversation (the Responses input as Harmony messages), harmony_render (developer message, tools, rendering through
leleka-harmony, the date given by the caller) and prompt_date (PromptDate, its parser, civil_date) are in
crates/gateway-domain/src/responses/. strata-control keeps the process-wide prompt date, today() and render(request) in
responses/harmony_prompt.rs with the inline tests, so the byte-exact Harmony prompt tests keep their ids and pass on the
moved code. render_at lost its cfg(test) because the tests live in the other crate. Function texts are unchanged; the long
ones are added to docs/architecture/tech-debt.md.
ReqCtx (the per-request record behind the structured request line) holds the Clock from Observe and stamps admitted,
engine_start, first_token and the line itself with it; Record::from_state takes the time as an argument. The backend
worker (serve_one start, conclude end) and the stdio worker (combine_done start) read the request's own clock through
ObsHandle::now(), which falls back to the system clock when the request has no record. These are request-level stamps;
the per-event stamps (last_progress, drain and stop deadlines, activity stamps) keep calling Instant::now() and stay on
the instant-now ratchet, which fell from 31 to 26 for strata-control.
New test: the_record_stamps_come_from_the_injected_clock (a ManualClock gives queue_ms 40 and ttft_ms 100).
Docs: gateway-ports.md says which stamps are behind the port, describes the serve() phases, and records the S10 default
(the offline CLI groups stay in strata-control).
responses.rs is 97 lines (311 at the start of this step, after the domain move); the mechanical child names impl_* and
*_fn are gone. Function texts are moved without change; the fields and constants that sibling modules read became
pub(super). Public paths (responses::create, create_route, retrieve, delete, input_items, count_input_tokens,
ResponseHistory, HistoryResponseStore, TracedJson, PromptDate, set_prompt_date, set_tool_call_recovery and the domain
types) are unchanged. Functions that still miss the limits are listed in docs/architecture/tech-debt.md.
Linux test ids of strata-control, strata-desktop-core, leleka-gateway-text and leleka-gateway-domain: 0 changed,
0 missing against the tip before S21 wider (2 new: the golden test and its ignored regenerator).
CreateRequest, TextOptions, TextFormat, its validation and tool-choice rules, OutputItem, Usage, ResponseTrace with its
event stream, the prompt rendering (render_request_with), the output parsing and reasoning split (parse_output_items_with,
decode_generation_noted), reasoning_effort and the schema checks now live in crates/gateway-domain/src/responses/.
strata-control re-exports the types under responses::* and keeps thin wrappers with the old signatures for the places that
need a process flag, a stage span or a log line. The text of the moved functions is unchanged; the edits are listed in
docs/architecture/tech-debt.md (S21 wider).
Evidence: the golden fixture committed just before this (control-plane/tests/fixtures/golden/responses_pure.json, recorded
from the old code, 96 cases of render, validate, trace and parse) passes on the new code, and the Linux test ids of
strata-control, strata-desktop-core, leleka-gateway-text and leleka-gateway-domain are unchanged (0 changed, 0 missing).
Gate: --update-baseline --allow-increase was used for two entries. process-global:leleka-gateway-domain 0 -> 3 is the
memo of tool_schema_accepted moving with its function (process-global:strata-control fell 14 -> 11, the sum is unchanged).
render.rs is a new moved file of 405 lines (one 385-line legacy function), listed as debt.
generate takes any ServeDevice (the stack delegates to its own methods, once per request); FakeStack/FakeDevice implement RequestOwners, ServeDevice, OriginalServePort and PrefixDevice over a ManualClock script. 14 lifecycle tests: completion, length, eos, partial acceptance, cancel, deadline, device errors, refusal, timing, prefix reuse. S15 notes and the S19 design in tech-debt.md.
The CPU pool fields of the memory topic move into MemorySettings::pool (CpuPoolSettings) so each constructor
stays short; no key and no spelling changes.
Golden tests for the parsers that read the captured namespace: the speculative engine (the numeric and the
set-ness reading of LELEKA_SPEC, clamps, the adaptive switch, arm lists, adaptive constants, legacy policy),
the NaN guard, the conversation cache policy (including a value that is not unicode), and the memory
governor keys. Long test tables carry #[rustfmt::skip] so each test stays within 30 lines.
docs/architecture/tech-debt.md: what S13 left outside the port and why (settings::process(), the other crates'
readers), the keys whose spellings differ on purpose, the reads that became snapshots, the functions this step
touched that were already over the limits.
serve_load (about 1000 lines, 1170 after rustfmt) becomes load.rs (a 20-line order of
the phases) plus: load_admit (every refusal that needs no model byte, the memory
governor start), load_sources + load_bind (verify, bind, identity digest chain, expert
bank), load_identity, load_cuda (driver, context, probes, hand-over to the Original
serve stack), load_weights + load_moe + load_moe_gates (output head, KAR PLE, dense and
MoE caches; the adaptive and learned-main witness gates), serve_loop + serve_generate +
serve_run + serve_report (the command loop and one Generate), serve_close (teardown).
owner() is split the same way. Each phase takes a small context (LoadEnv, Bound,
Identity, Weights, Serving, Exchange) and returns a typed result.
Order and side effects are kept: the admission checks, the env reads
(LELEKA_ORIGINAL_SERVE_GGUF_PLE is still read in gguf_ple_load and in the refusal
detail line), the log texts (including the load-gate detail line and the
KAR_MTP_PROFILE / NATIVE_MTP_PROFILE logic of the kar-off-ab branch), the cancellation
checks, the lap marks, and the drop order of the CUDA objects (Weights drops dense, MoE,
KAR PLE, output head; the context is closed after the weights and outlives the binding).
The three conditions of the former execution gates are one match, the policy flags one
PolicyFlags::of. No GPU or numerical path was touched.
New tests (backend/load_tests.rs): PolicyFlags against the former expressions, the
execution gates against the former three sequential checks for all 6 executions x 8
boolean combinations, and the weight-cache log line against its exact text and the
saturating subtraction. Test ids: 689 before the S5 work, 694 now (the five added), the
same 2 environment-dependent failures and 58 ignored; cargo check --all-targets for
leleka-runtime and leleka-deploy gives the same warning counts, clippy reports nothing
in backend/. All new and changed functions are within 30 lines, complexity 10, nesting 4,
except one 127-column line that is a 119-character MoeWeightCache constructor name
(docs/architecture/tech-debt.md, which also lists what S5a moved verbatim and still misses
the limits). moe_weight_cache.rs gains three pub(crate) use lines for the witness types.
The architecture baseline loses the transient backend/load.rs entry.
server_api::{ensure_loaded, model_busy, load_post} stamp last_activity from state.services.clock instead of
tokio::time::Instant::now() (instant-now:strata-control 34 -> 31; SystemClock returns the same value). The baseline is
tightened. docs/experiments/stra-338-gateway-track.md records the commands, the per-step test-outcome comparison (Linux:
597 ok before, 615 ok after, 0 changed, 0 missing), the gate movement and what was not done;
docs/architecture/gateway-ports.md shows the AppState groups and the domain crate.
AppState now holds ports instead of concrete types: `engine: Option<SharedEngine>` replaces the
mpsc::Sender<GenerationCommand>, `responses: SharedResponseStore` replaces Arc<RwLock<ResponseHistory>>,
`clock: SharedClock` serves queue deadlines, uptime and response timestamps, `mcp` is a ToolHub and `vision` a
VisionEncoder. The channel (adapters::ChannelEngine), the history with its disk snapshot
(responses::HistoryResponseStore), the system clock, mcp::Hub and vision::Vision are the adapters; main.rs serve()
composes them. No behaviour change: the HTTP handlers make the same calls in the same order, the queue claim race is
unchanged, only the deadline now reads the injected clock.
Ports are called per request, never per token or stream event (docs/architecture/gateway-ports.md).
ports/fakes has an in-memory adapter per port; control-plane/tests/ports_fakes.rs (12 tests), queue.rs and
adapters/channel_engine.rs add tests that drive the real handlers through them.
Architecture gate: dyn-trait:strata-control fell 35 -> 21 (a BoxError alias replaces 20 `Box<dyn Error>` spellings,
which pays for the 6 new port aliases); main.rs 1156 -> 1155 lines. Also adds scripts/dev/test-outcomes.py (per-test
outcome comparison of two cargo test logs) and scripts/dev/wsl-cargo.sh.
control-plane/src/{prompt,response_tools,tool_output}.rs (pure text logic: pinned chat template renderer, tool catalog, tool-call
parser) move by git mv to the new leaf crate crates/gateway-text. strata-control re-exports them under the same module paths
(crate::prompt, crate::tool_output keep working for tests and callers); strata-desktop-core replaces its three #[path] includes with
imports. The leleka-runtime GPU proof modules that hash prompt.rs follow the new location. The only text change in the moved files is
the relative include_str path to engine/strata. serde_json features (preserve_order + float_roundtrip) equal what both hosts already
got through unification.
Verified: cargo test strata-control + strata-desktop-core + gateway-text on the host: 504 tests, 0 failed; the 30 tests that vanish
are exactly the duplicate runtime_prompt/runtime_tool_catalog/runtime_tool_parser copies of the same 30 tests (11+2+17), which now run
once. WSL x86_64-linux cargo check --tests leleka-runtime: 62 warnings, unchanged. fmt clean on the new crate.
rust_bench_cuda.rs and the native_expert_parity bin (the only users of leleka-cuda-driver in the CPU expert adapter) become the new
tool crate crates/native-parity-bench (L4, cargo-checked in the product gate). leleka-native-cpu-expert no longer depends on
leleka-cuda-driver; the architecture baseline drops that violation. Code moved byte-for-byte except the use paths.
Verified (WSL x86_64-linux): cargo check --all-targets for the new crate, native-cpu-expert and leleka-runtime; cargo test -p
leleka-native-cpu-expert all ok (22+2+4+... tests, 0 failed); check-architecture and check-ci-coverage pass.
chat template (prompt bytes): ChatTemplate.render (#843) drops completed empty assistant turns
(no text after strip, no picture, no tool calls; the final message is kept; STRATA_KEEP_EMPTY_TURNS=1
keeps them) before the template runs. prompt.rs now does the same in Renderer::render and in the typed
render_with_images path. diff_chat_template: 136/3000 -> 0 (also 2 x 12000). chat_template_oracle.json
regenerated from the Original; one responses.rs test asserted the old behaviour.
gguf: block_geometry knows the APR trellis types 143-146 (PTQ1_0, TQ2_T, TQK6, TQK7); gguf_headers.json
regenerated. diff_gguf_header: 188/400 -> 0.
native pack: NATIVE_PLE_KEY gained IQ3_XXS/IQ4_XS (#381); NVFP4 expert tails and prism.hadamard experts
are refused (not ported, the runtime reads neither). diff_native_pack f16_nan uses a quiet NaN (numpy's
widening of a signaling NaN differs between builds). The live differential still needs one run on Linux.
smoke-mtp-pack.py reads the Q8_0 names from required[]/wq(); Dockerfile.systemd-smoke drops its apt
version pins. docs/ci-audit.md findings 14, 15, 16, 18 updated in place.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>