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.
27 lines
1.4 KiB
Python
27 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Dependency-direction and size gate for the hexagonal architecture (LeaseVibe STRA-338, ADR on that item).
|
|
|
|
Rules, read from `architecture.json` (the policy) and `architecture-baseline.json` (the debt that exists today):
|
|
|
|
layers every workspace package has exactly one layer (L0 contract .. L4 host); a normal dependency must point to
|
|
the same or a LOWER layer.
|
|
adapters inside L3 a crate may depend on another L3 crate only through an edge listed in "adapter_edges".
|
|
pure packages in "pure_layers" must not use the "forbidden_in_pure" external crates.
|
|
size no .rs file over "max_lines"; a file already over it may not grow beyond its baseline entry.
|
|
ratchet counts of "source_patterns" (env reads, Instant::now, #[path], process globals, dyn) may only fall.
|
|
|
|
A violation listed in the baseline is debt and does not fail. The baseline can only be lowered with --update-baseline;
|
|
raising it needs --allow-increase and is visible in review. Pure stdlib Python, no network, no GPU: a build-time check.
|
|
|
|
Usage: scripts/check-architecture.py [--update-baseline [--allow-increase]] [--report]
|
|
"""
|
|
import pathlib
|
|
import sys
|
|
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent))
|
|
|
|
from archcheck.cli import main # noqa: E402
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main(sys.argv[1:], pathlib.Path(__file__).resolve().parent.parent))
|