feat(drift): gate semantics v2 — intra-domain cycles, gate_failed, tolerance precedence (#176, #170)#221
Conversation
|
/guardian review |
There was a problem hiding this comment.
LGTM — no defects found in this diff.
Reviewed all changes against engineering standards, ontology compliance, and test coverage. The diff implements intra-domain cycle_ratio, gate_failed semantics, hygiene baselines, and per-domain tolerance precedence correctly. All type annotations, docstrings, and test updates align with the spec. No real defects found.
🤖 mistral-medium-latest · 36,624 prompt + 70 completion = 36,694 tokens · graph 7/13 files (54%)
There was a problem hiding this comment.
Code Review
This pull request implements Drift Gate Semantics v2, introducing intra-domain cycle ratio calculations using Tarjan's SCC, a new gate_failed status for hygiene breaches, support for per-domain hygiene_baseline debt acknowledgments, and relative classification based on effective tolerances. Feedback on the changes identifies a potential KeyError in tarjan_scc within the _intra_domain_cycle_ratio method due to missing keys for sink nodes in the filtered adjacency map, and provides a robust code suggestion to initialize the adjacency dictionary safely.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Code review — gate semantics v2 (#176, #170)Dense, well-specified change; the separate-hygiene-check design and the per-domain tolerance precedence read cleanly, and the SDD trail + dual repros are strong. I ran the finders plus a ✅ Refuted via dogfood —
|
… rounding; boundary pin (#221 review) Colleague: acknowledged-debt reports no longer show the raw breach alongside the note; min baselines floor (ceil inverted the round-trip), exact skipped (pins improvement); score==tolerance boundary pinned+tested. Sonar: approx float asserts, dead label params dropped. Plus pipeline-ingested cycle integration test (resolver-uplift guard). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Re: the dogfood review — disposition (df29366):
Sonar round folded into the same commit (approx float asserts; 🤖 Generated with Claude Code |
…is_analyze_impact) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tive status (#170 task 2) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lerance (#170 task 3) - _drift_status_label: gate_failed branch added FIRST; second param renamed max_drift → tolerance; call sites pass r.tolerance; _render_drift_table drops its max_drift parameter - drift --max-drift help: demoted to default tolerance for domains without drift_tolerance - MCP cgis_drift docstring: same semantic note - guardian/collector.py: deliberate-fallback comment at scorer.score() sites - tests/unit/conftest.py: promote module_with_funcs from test_fingerprint (Sonar dup lesson); test_fingerprint.py updated to import from conftest - tests/unit/test_cli.py: test_status_label_gate_failed + CLI run-level pair (gate failed exit 1 / acknowledged exit 0) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…es (#176/#170 task 4) - _baseline_lines(): new helper extracted from _domain_entry to avoid C901 complexity; checks each hygiene constraint in _PARSED_HEADER["hygiene"] against the measured fingerprint value using the same operator semantics as DriftScorer._hygiene_check (max → measured > bound) - _domain_entry: calls _baseline_lines(fp) and emits hygiene_baseline block with _ceil2'd values and the "acknowledged at baseline by init-ontology" comment; applies to BOTH labeled and hygiene-only entries - _ceil2 direction is load-bearing: floored value would gate_fail the proposal on its own graph (round-trip guarantee, spec §2.2) - test: test_cyclic_domain_proposal_emits_baseline_and_round_trips (depth=2 forces unified domain; verifies baseline present + analyze_drift any_critical is False + no gate_failed status) - #174 round-trip test (test_hygiene_only_cyclic_domain_round_trips) stays green untouched Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… rounding; boundary pin (#221 review) Colleague: acknowledged-debt reports no longer show the raw breach alongside the note; min baselines floor (ceil inverted the round-trip), exact skipped (pins improvement); score==tolerance boundary pinned+tested. Sonar: approx float asserts, dead label params dropped. Plus pipeline-ingested cycle integration test (resolver-uplift guard). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
df29366 to
6198f27
Compare
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements Drift Gate Semantics v2, introducing intra-domain cycle ratio calculations, undilutable gate_failed statuses with acknowledgeable hygiene baselines, and per-domain tolerance precedence. Key changes include updating FingerprintExtractor to compute its own intra-domain import cycles via Tarjan's SCC, separating hygiene and template constraint evaluations in DriftScorer, making classification relative to the domain's effective tolerance, and updating ontology_init to emit operator-aware rounded hygiene_baseline blocks for measured breaches. Additionally, the CLI, MCP server, and analyze_drift service were updated to support these status-driven gate semantics. Since no review comments were provided, there is no feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.



Summary
Closes #176, closes #170 (roadmap #179 P1 — "make the gate correct across topologies").
Corrected diagnosis first (spec §1.1): the httpx "wall of criticals" was never call cycles —
cycle_ratiomeasured the blast radius of FILE-level IMPORTS cycles, propagated per-node and denominated per-domain, so any single-file domain touching a cross-domain cycle read 1.00.call_cycle_ratiofrom the issue is explicitly NOT built (it would gate a thing the metric never measured).cycle_rationow counts only the domain's OWN import cycles (shared_scctarjan, no HealthScorer coupling). Single-file domains → 0.0 by construction (httpx wall vanishes, zero config); intra-package cycles (owner-api shape) still caught. Cross-domain cycles route to the quotient layer — pinned bytest_cross_domain_signal_routes_to_quotient⛔ gate_failed: hygiene breaches force it regardless of TV score, evaluated separately from template constraints (the merged-dict design had a liveunresolved_ratioprovenance collision — colleague catch on the spec). Acknowledgeablehygiene_baselineper domain (operator-aware max/min/exact, ratchet-down convention) keeps Add cgis init-ontology: auto-propose patterns.yaml from measured graph #174's round-trip alive:init-ontologyemits_ceil2-rounded baselines for measured breaches; NEW debt beyond baseline fails absolutelydrift_tolerancebinds;--max-driftdemoted to the default for domains that omit one; classification relative (warning > 0.75×tol); the gate is uniformly status-based and enforce-respecting (also retires the cgis_drift: zero-match / no-signal domains report 'clean' instead of 'empty' (silent mis-targeted ontology passes green) #178-era enforce-blind score term)Verification highlights
cgis_analyze_impact(dogfood) — caught the guardian collector consumer the plan missedSDD
5 tasks × (implementer → review), Task 2 with a ULP-deep opus pass; final holistic review READY FOR PR.
🤖 Generated with Claude Code