Skip to content

cgis_drift: hygiene-gate breaches (cycles) should force critical; per-domain tolerance vs global max_drift precedence #170

Description

@zaebee

Summary

Two related gaps in how cgis_drift decides status / any_critical, both hit during a real audit of a FastAPI backend (10,190 nodes / 37,864 edges).

A. Hygiene hard-gate breaches don't force critical

The ontology declares cycle_ratio: {max: 0.0} as a hygiene invariant. Two domains breached it:

app.services         cycle_ratio 0.0746 > 0   → status: "warning"
app.api.dependencies cycle_ratio 0.0157 > 0   → status: "warning"

The breach is listed in violations ("cycle_ratio 0.0746 > max 0.0"), but status stays warning because the TV drift score is under threshold. A hard-gate breach (a real import cycle) is categorically different from soft topological drift and shouldn't be downgradable by a low TV score.

Proposal: a hygiene-gate violation forces status: "critical" (or a dedicated gate_failed status) and sets any_critical: true, independent of TV drift.

B. Global max_drift overrides the more-specific per-domain drift_tolerance

Observed:

crud          drift 0.527  per-domain tolerance 0.55  → status: "critical"
notifications drift 0.608  per-domain tolerance 0.62  → status: "critical"

Both are under their per-domain drift_tolerance, yet flagged critical because they exceed the global max_drift=0.5 passed to the tool. So raising a per-domain tolerance above the global cap silently has no effect — the more-specific value loses to the global one.

Proposal: per-domain drift_tolerance should take precedence for that domain's status; max_drift acts only as the default for domains without a declared tolerance. Or, if current behavior is intended, document the precedence explicitly (it's surprising).

Why it matters

Drift-as-CI-gate needs predictable status semantics: cycles must never be silently "warning", and per-domain ratchets must actually bind. Otherwise teams can't trust a green run.

Environment

  • Tools: cgis_ingest / cgis_validate / cgis_drift
  • Patterns: 5-template alphabet (v2.1.0 ontology), Python profile

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions