Files
leleka/architecture.json
T
Pavlo Ratushnyi ff6cb3dcbf STRA-338 S21: leleka-gateway-domain (layer L2): the pure gateway domain leaves strata-control
New crate crates/gateway-domain, the first member of layer L2 in architecture.json (L2 is now a pure layer: tokio, axum,
reqwest, libc and the other adapter crates are forbidden dependencies there). It depends on serde, serde_json,
leleka-sampler-ref and leleka-tokenizer only. Moved out of control-plane/src with git mv, content unchanged apart from
paths: sampling (request sampling extensions, validation) and EngineTune (was in wire.rs), reasoning_budget (the budget
driver and its tests), codec (Family, TextCodec, TokenDecoder, QwenCodec), json_order, and the Chat Completions
translation (chat_completions: Request -> Responses request, reply fields; the axum handlers stay in chat.rs).
strata-control re-exports codec, json_order, reasoning_budget and sampling under their old paths, and wire.rs re-exports
EngineTune, so no caller and no test outside the moved modules changed. 4 new tests cover the chat translation.

Architecture gate: layer entry added; dyn-trait:leleka-gateway-domain = 5 appears because the five dyn in the moved
code (Box<dyn TokenDecoder>, Box<dyn Iterator> in the budget driver, &dyn Fn, ...) change crate; dyn-trait:strata-control
fell 21 -> 16 in the same step, so the total is unchanged (--allow-increase was needed for the new per-crate key only).
Test outcomes: 597 ok / 2 ignored before, 615 ok / 2 ignored after (18 new tests); the 13 moved tests keep their ids in the
new crate and their outcome.
2026-11-05 20:42:48 +01:00

49 lines
3.1 KiB
JSON

{
"_comment": "Policy read by scripts/check-architecture.py (STRA-338 ADR). Layers are ordered low to high; a normal dependency must point to the same or a lower layer. L2 (core) holds the extracted domain crates: leleka-gateway-domain (S21); the engine domain crates follow (S19). Every workspace package appears in exactly one layer.",
"max_lines": 400,
"adapter_layer": "L3",
"pure_layers": ["L0", "L1", "L2"],
"forbidden_in_pure": ["tokio", "axum", "tonic", "tonic-prost", "reqwest", "hyper", "libc", "rustix", "windows-sys", "sysinfo", "wgpu"],
"layers": {
"L0": ["leleka-backend-api", "leleka-worker-protocol"],
"L1": [
"leleka-obs", "leleka-context", "leleka-sampler-ref", "leleka-quant-core", "leleka-serving-policy", "leleka-harmony",
"leleka-tokenizer", "leleka-gguf", "leleka-kar-codec", "leleka-experimental-ref", "leleka-cpu-sys", "leleka-cpu-kernels",
"leleka-shm", "leleka-openvino", "leleka-memory", "leleka-gateway-text"
],
"L2": ["leleka-gateway-domain"],
"L3": [
"leleka-libc-shim", "leleka-model-format", "leleka-cuda-driver", "leleka-native-cpu-expert", "leleka-gptoss", "leleka-igpu",
"leleka-gptoss-igpu", "leleka-gptoss-npu", "leleka-npu-service", "leleka-cpu-worker", "leleka-igpu-worker", "leleka-npu-worker",
"leleka-gpu-npu-worker", "leleka-offline-tools", "leleka-runtime-client"
],
"L4": ["leleka-runtime", "strata-desktop-core", "strata-control", "leleka-deploy", "leleka-native-parity-bench"]
},
"adapter_edges": [
["leleka-cuda-driver", "leleka-libc-shim"],
["leleka-cuda-driver", "leleka-model-format"],
["leleka-model-format", "leleka-libc-shim"],
["leleka-native-cpu-expert", "leleka-libc-shim"],
["leleka-cpu-worker", "leleka-gptoss"],
["leleka-gptoss-igpu", "leleka-gptoss"],
["leleka-gptoss-igpu", "leleka-igpu"],
["leleka-gptoss-npu", "leleka-gptoss"],
["leleka-igpu-worker", "leleka-cpu-worker"],
["leleka-igpu-worker", "leleka-gptoss-igpu"],
["leleka-npu-worker", "leleka-cpu-worker"],
["leleka-npu-worker", "leleka-gptoss-npu"],
["leleka-gpu-npu-worker", "leleka-cpu-worker"],
["leleka-gpu-npu-worker", "leleka-gptoss"],
["leleka-gpu-npu-worker", "leleka-gptoss-igpu"],
["leleka-gpu-npu-worker", "leleka-gptoss-npu"],
["leleka-offline-tools", "leleka-model-format"]
],
"source_patterns": [
{"id": "env-read", "regex": "\\benv::var(_os)?\\(", "why": "configuration must be parsed once into a Settings struct (S13), not read all over the code"},
{"id": "instant-now", "regex": "\\bInstant::now\\(\\)", "why": "time must come from an injected Clock in core logic (S14)"},
{"id": "path-include", "regex": "#\\[path\\s*=\\s*\"(?![^\"]*tests\\.rs\")(?![A-Za-z0-9_]+/[A-Za-z0-9_]+\\.rs\")", "why": "a file compiled into two crates must be one crate (S8); a tests.rs or a child module file of the form dir/name.rs is not an include"},
{"id": "process-global", "regex": "\\b(OnceLock|LazyLock|OnceCell)\\b|\\bstatic\\s+mut\\b|Governor::global\\(|serving_cells\\(\\)", "why": "process globals make core logic untestable without a GPU (S14)"},
{"id": "dyn-trait", "regex": "\\bdyn\\s+[A-Z]", "why": "no dynamic dispatch per round or token; dyn is for startup composition only"}
]
}