mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 12:39:28 +00:00
chore(p0): retire regress, the skill router, the module audit tool and vocabulary.sc
Off every active line (PATHFINDER-2026-10-13/03-unified-proposal.md, cuts). Deleted: src/openultrasast/regress/ and the deep-mode REGRESS branch (deep now records a regress_retired degradation and equals standard; proof is the search-with-proof arm's job), the sandbox docker runner and probe that only regress used, --fail-on worth-fixing, RegressConfig, the two ledger helpers only regress called; skills.py and index.py with the hunter pool's skill routing; model/audit.py; cpg/queries/vocabulary.sc with benchmarks/push/ontology_gap.py. Docs and the scan skill describe the retirement. Net: 3,895 lines deleted, 86 added. Targeted tests: 180 passed, 28 skipped; 3,331 tests collect. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
94e96c6885
commit
f5a904b7f2
@@ -8,8 +8,6 @@ from dataclasses import asdict, dataclass, replace
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ..findings import StaticFinding
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .map import Hotspot
|
||||
|
||||
@@ -19,8 +17,6 @@ VERDICT_DELTAS = {
|
||||
"triggerable": TRIGGERABLE_DELTA,
|
||||
"not_triggerable": NOT_TRIGGERABLE_DELTA,
|
||||
}
|
||||
FORCED_CANDIDATE_SEVERITY = 5
|
||||
FORCED_CANDIDATE_REACHABILITY = frozenset({"reachable", "inferred-file-surface"})
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -57,27 +53,6 @@ def write_ledger(path: Path, ledger: Mapping[str, LedgerEntry | Mapping[str, obj
|
||||
path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
||||
|
||||
|
||||
def persist_verdicts(path: Path, verdicts: Sequence[object]) -> dict[str, LedgerEntry]:
|
||||
"""Record triggerable / not_triggerable outcomes into the loop-owned complexity ledger."""
|
||||
ledger = load_ledger(path)
|
||||
changed = False
|
||||
for item in verdicts:
|
||||
verdict = str(getattr(item, "verdict", ""))
|
||||
if verdict not in VERDICT_DELTAS:
|
||||
continue
|
||||
raw_function = getattr(item, "function_name", None)
|
||||
ledger = record_verdict(
|
||||
ledger,
|
||||
path=str(getattr(item, "path", "")),
|
||||
function_name=raw_function if isinstance(raw_function, str) else None,
|
||||
verdict=verdict,
|
||||
)
|
||||
changed = True
|
||||
if changed:
|
||||
write_ledger(path, ledger)
|
||||
return ledger
|
||||
|
||||
|
||||
def record_verdict(
|
||||
ledger: Mapping[str, LedgerEntry | Mapping[str, object]],
|
||||
*,
|
||||
@@ -130,49 +105,6 @@ def apply_overlay(
|
||||
return tuple(sorted(adjusted, key=lambda item: (-item.score, item.path, item.function_name or "")))
|
||||
|
||||
|
||||
def must_keep_as_candidate(
|
||||
finding: StaticFinding,
|
||||
policy_severity: int | object,
|
||||
reachability: str | None = None,
|
||||
) -> bool:
|
||||
status = finding.reachability_status if reachability is None else reachability
|
||||
return _as_severity(policy_severity) >= FORCED_CANDIDATE_SEVERITY and status in FORCED_CANDIDATE_REACHABILITY
|
||||
|
||||
|
||||
def select_forced_candidates(
|
||||
findings: Sequence[StaticFinding],
|
||||
policy: Mapping[str, object],
|
||||
*,
|
||||
rule_cwe: Mapping[str, str] | None = None,
|
||||
) -> tuple[StaticFinding, ...]:
|
||||
cwe_by_id = rule_cwe or {}
|
||||
return tuple(
|
||||
finding
|
||||
for finding in findings
|
||||
if must_keep_as_candidate(finding, _policy_severity_for(finding, policy, cwe_by_id), finding.reachability_status)
|
||||
)
|
||||
|
||||
|
||||
def _policy_severity_for(finding: StaticFinding, policy: Mapping[str, object], cwe_by_id: Mapping[str, str]) -> int:
|
||||
if finding.finding_id in policy:
|
||||
return _as_severity(policy[finding.finding_id])
|
||||
cwe = cwe_by_id.get(finding.finding_id)
|
||||
if cwe is not None and cwe in policy:
|
||||
return _as_severity(policy[cwe])
|
||||
return 0
|
||||
|
||||
|
||||
def _as_severity(value: object) -> int:
|
||||
if isinstance(value, bool):
|
||||
return 0
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
severity = getattr(value, "severity", None)
|
||||
if isinstance(severity, bool) or not isinstance(severity, int):
|
||||
return 0
|
||||
return severity
|
||||
|
||||
|
||||
def _coerce_entry(value: object) -> LedgerEntry | None:
|
||||
if isinstance(value, LedgerEntry):
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user