mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 11:49:28 +00:00
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
46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
"""model-grounded-detection Req 3: outgrowth is visible and checkable, not noticed two specs later."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
SRC = Path("src/openultrasast")
|
|
MANIFEST = Path("benchmarks/measurements/2026-09-08-module-audit.json")
|
|
|
|
|
|
def test_no_module_in_the_tree_is_orphaned() -> None:
|
|
from openultrasast.model.audit import audit
|
|
|
|
orphans = [row.module for row in audit(SRC) if row.classification == "orphaned"]
|
|
assert not orphans, f"orphaned modules must be removed, not carried: {orphans}"
|
|
|
|
|
|
def test_every_module_is_classified() -> None:
|
|
from openultrasast.model.audit import audit, module_name
|
|
|
|
classified = {row.module for row in audit(SRC)}
|
|
on_disk = {module_name(path, SRC) for path in SRC.rglob("*.py") if "__pycache__" not in path.parts}
|
|
assert on_disk - classified <= {""}, f"unclassified: {sorted(on_disk - classified - {''})}"
|
|
|
|
|
|
def test_the_named_subsystems_each_carry_an_explicit_decision() -> None:
|
|
"""Req 3.3: the five older-phase subsystems get a decision, not silence."""
|
|
from openultrasast.model.audit import audit
|
|
|
|
rows = {row.module: row for row in audit(SRC)}
|
|
for name in ("fusion", "mcp", "skills", "harness_ext", "hunter_harness"):
|
|
assert name in rows, f"{name} vanished without a recorded decision"
|
|
assert rows[name].reason, f"{name} has no stated reason"
|
|
|
|
|
|
def test_the_manifest_matches_the_tree() -> None:
|
|
"""A later reader can check the tree against the committed manifest (Req 3.4)."""
|
|
from openultrasast.model.audit import audit, to_dict
|
|
|
|
assert MANIFEST.is_file(), "the audit manifest is committed evidence, not a local artifact"
|
|
committed = json.loads(MANIFEST.read_text())
|
|
current = to_dict(audit(SRC))
|
|
assert committed["counts"] == current["counts"], "the tree drifted from its committed audit"
|
|
assert committed["orphaned"] == current["orphaned"] == []
|