feat(model-grounded-detection): group 1, subtract the noise architecture

99 source modules -> 81. 832 tests -> 646. The whole learning/ package (16
modules, ~4,100 lines) and six semantic/ modules removed, with the three gates
byte-identical to 2026-09-06-gate-baseline.txt at every step.

The sequence is what made it safe: vocabularies ported first (1.1), importers
detached second (1.2-1.3), deletion third (1.4). Every import break during the
deletion was therefore a detachment miss in the importer and was fixed there --
no module was restored to satisfy one. Both misses were the same shape and were
fixed as a class: operations.py and shapes.py each imported trailing_name from
the deleted variants.py, so it moved to semantic/ir.py, its natural home, and
both importers changed in one edit.

Ported before deleting: the closed guard vocabulary (verbatim, nothing else
holds it) into model/specs.py, which derives TaintSpec and DominanceSpec from
the retained ruleset facts rather than copying them. Re-homed: families ->
model/taxonomy, candidates -> model/candidates, endpoint -> model/endpoint,
plus Region, labeled_family and labeled_spans. labeled_family no longer falls
back to the LLM classifier -- an unlabeled pair is honestly unknown.

Four deviations, each recorded in the spec notes with its reason. improve/
evolve.py and validator.py were stripped, not deleted: each mixes the mechanism
lever (gone) with the deterministic rule-status loop `ousast improve` still
runs, which has no LLM in it; a test now asserts the lever's absence by symbol
so it cannot creep back. The learning CLI group became `model candidates`,
because deleting it outright would have orphaned the retained enumerator by
removing its only entry point. thinking moved from [learning] to [models].

A gap named rather than papered over: no retained sink fact routes by CWE to
path, output_encoding, untrusted_destination or prototype -- the same hole the
entailment ceiling diagnosed. The test asserts the seeded set and the gap set
exactly, so task 4.2 must update it when it authors those sinks.

The audit found exactly one genuine orphan: vectorstore.py, a bakeoff harness
with no production caller and no CLI, alive only through its own test. The five
named subsystems each carry an explicit decision. Manifest committed, with a
test asserting the tree still matches it.

Group 2 (the Joern go/no-go) has not started.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
Marius Ciepluch
2026-09-08 12:15:54 +02:00
co-authored by Claude Opus 5
parent fc4dab97fb
commit 9ed0e45c5f
86 changed files with 1710 additions and 12158 deletions
+10 -23
View File
@@ -115,37 +115,24 @@ def test_path_records_gate_reachability_and_a_dominating_hop_discharges() -> Non
assert covered.findings # without the hop witness the finding stands
def test_findings_become_suspicion_static_findings_with_known_fix_and_labels(tmp_path: Path) -> None:
from openultrasast.semantic.mechanisms import MechanismStore, append_from_pair
from openultrasast.semantic.obligations.check import findings_to_static
from openultrasast.semantic.obligations.shapes import ObligationShape, obligation_mechanisms
def test_findings_become_suspicion_static_findings_with_labels() -> None:
"""The finding-id contract, the suspicion rung and the tags, without the deleted mechanism store.
store = MechanismStore(tmp_path / "m.jsonl")
shape = ObligationShape(
language="python",
operation_kind="protected_read",
discharger_kind="identity_constraint",
provenance="authenticated_context",
resource_class="owned",
mechanism="missing_auth_guard",
)
record = append_from_pair(store, shape, summary="s", cwe="CWE-639", pair="vampi", provenance="human", tier="seeded")
result = _check(store_shapes=obligation_mechanisms(store.load()))
The original also asserted `known_fix` — a hint the store supplied. The store is gone, so the hint is gone
with it; everything the checker establishes on its own is still pinned here.
"""
from openultrasast.semantic.obligations.check import findings_to_static
result = _check()
leaky = next(f for f in result.findings if f.operation.function == "leaky" and f.missing == "identity_constraint")
assert leaky.known_fix == record.id
guarded = next(f for f in result.findings if f.operation.function == "guarded" and f.missing == "identity_constraint")
statics = findings_to_static(result)
ids = {s.finding_id for s in statics}
guarded = next(f for f in result.findings if f.operation.function == "guarded" and f.missing == "identity_constraint")
assert f"obligation:protected_read:app.py:{leaky.operation.line}:identity_constraint" in ids # exact id contract
assert f"obligation:protected_read:app.py:{guarded.operation.line}:identity_constraint" in ids
static = next(s for s in statics if s.line == leaky.operation.line and "discharger:identity_constraint" in s.tags)
assert static.evidence_level == "suspicion"
assert {
"obligation:protected_read",
"discharger:identity_constraint",
"obligation_evidence:consistency_violation",
f"mechanism:{record.id}",
} <= set(static.tags)
assert {"obligation:protected_read", "discharger:identity_constraint", "obligation_evidence:consistency_violation"} <= set(static.tags)
assert "app.py::constrained" in static.rationale