fold/scripts/benchmarks/fold_eval/differential.py
trvon 2dcbdbc75d
feat: harden Fold quality guard
Preserve source, binary, and runtime evidence boundaries while making precision and performance regressions reproducible.

- decompose analysis orchestration into bounded modules
- add differential, metamorphic, organic, and Yams change-time gates
- fix detector, P-Code, fuzz sanitizer, and report identity precision
2026-07-13 15:05:35 -04:00

27 lines
801 B
Python

"""Small, testable classification primitives for differential comparator lanes."""
from __future__ import annotations
import re
from typing import Pattern
def diagnostic_detected(output: str, pattern: Pattern[str]) -> bool:
return pattern.search(output) is not None
def vulnerable_runtime_detected(
returncode: int, output: str, pattern: Pattern[str]
) -> bool:
return returncode != 0 and diagnostic_detected(output, pattern)
def fixed_runtime_reported(returncode: int, output: str, pattern: Pattern[str]) -> bool:
"""Classify only explicit sanitizer evidence, not application exit status."""
del returncode
return diagnostic_detected(output, pattern)
def compile_diagnostic_pattern(expression: str) -> Pattern[str]:
return re.compile(expression, re.IGNORECASE)