mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 12:39:28 +00:00
feat(corpus-seeded-mechanisms): the mechanisms lever runs from ousast improve
Review rounds 3-5 remediations (Req 5, 7). - ousast improve resolves candidates from the target's calibration dir, then the working directory's (where `mechanisms export` writes), and admits into <target>/.openultrasast/calibration/mechanisms.jsonl, where a scan of that target reads; --mechanism-candidates, --mechanism-store, --no-mechanisms; --dry-run redirects the store to scratch; accepted rounds print admit/retract <id>. - run_improvement threads the store paths; RoundOutcome carries the mechanism edits; reverted mechanism keys are blocked outright; a no-gain admission is rejected as mechanism_no_gain; a retraction may name an admitted record that left the candidate set. - leave-one-out forwards variant-search degradations and pins the containment and label rules; mechanisms export defaults to the candidates file so it never re-admits a tombstone. - design §Lever rewritten to the implemented gate; README and docs show export -> improve -> scan. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
624024e72a
commit
b3b47ad757
@@ -118,13 +118,20 @@ class EvolveValidator:
|
||||
else:
|
||||
raise StrictValidationError(f"unknown edit type {type(edit).__name__}", kind="rule_change")
|
||||
|
||||
def validate_mechanism(self, edit: MechanismEdit, candidates: Mapping[str, object]) -> None:
|
||||
"""Req 5.2: only records the exporter derived from trusted pairs, with a closed guard and identifier-only shape text."""
|
||||
def validate_mechanism(
|
||||
self, edit: MechanismEdit, candidates: Mapping[str, object], admitted: Mapping[str, object] | None = None
|
||||
) -> None:
|
||||
"""Req 5.2: only records the exporter derived from trusted pairs, with a closed guard and identifier-only shape text.
|
||||
|
||||
A retraction may also name a record that is admitted in the scan store but no longer in the candidate set.
|
||||
"""
|
||||
from ..semantic.variants import GUARD_KINDS, SOURCE_KINDS
|
||||
|
||||
if edit.action not in MECHANISM_ACTIONS:
|
||||
raise StrictValidationError(f"mechanism edit action {edit.action!r} is not admit or retract", kind="mechanism_change")
|
||||
record = candidates.get(edit.mechanism_id)
|
||||
if record is None and edit.action == "retract" and admitted is not None:
|
||||
record = admitted.get(edit.mechanism_id)
|
||||
if record is None:
|
||||
raise StrictValidationError(
|
||||
f"unknown mechanism {edit.mechanism_id!r}: not in the exporter candidate set", kind="mechanism_change"
|
||||
|
||||
Reference in New Issue
Block a user