Files
leleka/docs
Pavlo Ratushnyi 7699138a6e STRA-338 S5b: decompose serve_load into ordered phase functions
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.
2026-11-05 21:39:26 +01:00
..
2026-10-25 14:14:47 +01:00
2026-10-24 02:03:29 +02:00