AppState (app/state.rs) is now lifecycle + EngineLink (client port, control channel, worker status, pool, queue timeout) + HttpPolicy (api key, CORS, trusted origins) + ModelView (name, aliases, tokenizer, template, vision port, prefix-cache and memory views) + Services (response store, monitor, MCP port, settings, clock, started_at). Field uses were rewritten mechanically (state.worker -> state.engine.worker, ...); no handler logic changed. The old impl_default_for_appstate.rs, which held the route table and the admin handlers, is app/routes.rs, app/admin_routes.rs and app/readiness.rs. main.rs (1156 lines: an 840-line argument match, the serve function, two helpers) is now 8 lines. The argument match is split into command groups under src/cli/ (operations, model_fetch, model_inspect, model_ensure, model_prepare, kar_inspect, kar_verify, kar_overlay, model_text; each owns its arms in their old order and answers Ok(false) for a line it does not own), serve() and shutdown_signal() are src/serve.rs (the composition root), the usage text is cli/usage.rs. The binary name and every command line are unchanged. Architecture gate: control-plane/src/main.rs leaves the oversize list (1156 -> 8). --allow-increase was used because the type change forces the AppState struct literals in seven already-oversize test/example files to nest by group: cp_replay.rs +7, responses/tests.rs +11, backend_worker_http.rs +14, mcp_hub.rs +3, memory_gate_http.rs +7, vision_http.rs +6, desktop-core api_over_runtime.rs +6 (55 lines in all, against 1148 lines removed from main.rs). Test outcomes are unchanged (597 ok / 2 ignored before and after, 14 new tests from S16).
19 lines
635 B
Rust
19 lines
635 B
Rust
//! Output shared by the KAR preparation commands.
|
|
|
|
use strata_control::prepare_preview;
|
|
|
|
pub(super) fn print_top_tensor_distortions(distortions: &[prepare_preview::TensorDistortion]) {
|
|
let mut ranked = distortions.iter().collect::<Vec<_>>();
|
|
ranked.sort_by(|a, b| b.relative_l2.total_cmp(&a.relative_l2));
|
|
println!(
|
|
"highest relative L2 by KAR record (top 20 of {}):",
|
|
ranked.len()
|
|
);
|
|
for tensor in ranked.into_iter().take(20) {
|
|
println!(
|
|
" {:.8} kind={} bytes={} {}",
|
|
tensor.relative_l2, tensor.source_kind, tensor.section_bytes, tensor.name
|
|
);
|
|
}
|
|
}
|