Description
Wave 3 found get_networks returns cached dictionaries directly. Collectors append organization fields, permanently enriching the shared raw cache until refresh and exposing caller-owned mutations to unrelated consumers.
Acceptance Criteria
- #1 Every get_networks return path gives callers per-record shallow copies
- #2 Mutating one caller result cannot affect a later inventory read
- #3 NetworkFilter behavior remains unchanged
Definition of Done
- #1 just check (ruff format –check, ruff check, mypy, generated-doc drift, offline API conformance, and the marker-filtered pytest run with the 80% coverage floor — this is exactly what the CI
testjob runs) - #2 just gen, when metrics, config, endpoints, collectors, the settings schema or the chart config changed —
just checkincludes the drift gate and CI fails the build on it - #3 Grafana queries in grafana/dashboards/*.json and grafana/alerts/ updated, if a metric or label name changed
Implementation Plan
Add a failing cache-isolation regression, return per-record shallow copies from every get_networks path, and verify NetworkFilter behavior remains unchanged.
Implementation Notes
The failing regression proved a caller-added orgName persisted into a later cache read. get_networks now shallow-copies each selected record on filtered and unfiltered paths; the full inventory and NetworkFilter suites pass.
Final Summary
Isolated network inventory consumers from shared raw cache dictionaries with test-first mutation coverage; just check and just ci pass.