mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-12-04 10:48:19 +00:00
chore(p0): drop never-enabled hunter tools, test-only functions and receiver delivery
Off every active line (PATHFINDER-2026-10-13/03-unified-proposal.md, cuts). Deleted: the four hunter tools no caller enables (read_definition, entry_points, flows, obligations) with their schemas and dispatch, the dead mapping branch of find_refs; 20 functions whose only caller was one test (mapping task records, compute_ranking_metrics, build_quick_hunter_prompt, validate_evidence_transition, should_fuse, harness processors, rank_targets_with_model, model/report slice rendering, taxonomy hierarchical/related, config_value.verdict, taint.verdict, roles.load_roles, features.language_of and build_for_scan, folds.leave_one_*, features.recorded_case, search BatchExecutor and the three __main__ shims, delivery.put_input); the receiver delivery mode of the plane. push_inputs.py moved to benchmarks/push. memory.purge stays: the live-S3 test cleanup uses it. Net: 2,730 lines deleted, 207 added. 473 targeted tests passed; 3,282 tests collect. breadth.toml records the removals. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
f5a904b7f2
commit
f63703a604
@@ -4,7 +4,7 @@ import json
|
||||
from collections.abc import Collection
|
||||
from dataclasses import asdict, dataclass, replace
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Protocol
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from .preprocess import FileTarget
|
||||
|
||||
@@ -28,11 +28,6 @@ class RankingScore:
|
||||
static_boosts: list[str]
|
||||
|
||||
|
||||
class RankerClient(Protocol):
|
||||
def complete_json(self, *, model: str, messages: list[dict[str, str]], timeout_seconds: int = 60) -> object:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def rank_targets(targets: list[FileTarget], model_rankings: object | None = None, model_id: str | None = None) -> list[RankingScore]:
|
||||
model_by_path = parse_ranker_response(model_rankings, model_id) if model_rankings is not None else {}
|
||||
rankings: list[RankingScore] = []
|
||||
@@ -43,32 +38,6 @@ def rank_targets(targets: list[FileTarget], model_rankings: object | None = None
|
||||
return sorted(rankings, key=lambda item: (-item.priority, item.path))
|
||||
|
||||
|
||||
def rank_targets_with_model(
|
||||
targets: list[FileTarget],
|
||||
*,
|
||||
client: RankerClient,
|
||||
model: str,
|
||||
chunk_size: int = 150,
|
||||
timeout_seconds: int = 60,
|
||||
) -> list[RankingScore]:
|
||||
if chunk_size < 1:
|
||||
raise RankingError("chunk_size must be at least 1")
|
||||
model_rankings: list[dict[str, object]] = []
|
||||
for start in range(0, len(targets), chunk_size):
|
||||
chunk = targets[start : start + chunk_size]
|
||||
response = client.complete_json(
|
||||
model=model,
|
||||
messages=[
|
||||
{"role": "system", "content": _ranker_system_prompt()},
|
||||
{"role": "user", "content": json.dumps([_target_prompt_payload(target) for target in chunk], sort_keys=True)},
|
||||
],
|
||||
timeout_seconds=timeout_seconds,
|
||||
)
|
||||
for ranking in parse_ranker_response(response, model).values():
|
||||
model_rankings.append(asdict(ranking))
|
||||
return rank_targets(targets, {"rankings": model_rankings}, model_id=model)
|
||||
|
||||
|
||||
def write_rankings(rankings: list[RankingScore], path: Path) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
payload = {"rankings": [asdict(ranking) for ranking in rankings]}
|
||||
@@ -205,25 +174,6 @@ def _clamp_score(value: int) -> int:
|
||||
return min(5, max(1, value))
|
||||
|
||||
|
||||
def _ranker_system_prompt() -> str:
|
||||
return (
|
||||
"Score each file for security review priority. Return JSON only with a rankings array. "
|
||||
"Each item must include path, surface, influence, reachability, rationale, and optional static_boosts. "
|
||||
"Scores must be integers from 1 to 5."
|
||||
)
|
||||
|
||||
|
||||
def _target_prompt_payload(target: FileTarget) -> dict[str, object]:
|
||||
return {
|
||||
"path": target.path,
|
||||
"language": target.language,
|
||||
"loc": target.loc,
|
||||
"tags": target.tags,
|
||||
"has_fuzz_entry_point": target.has_fuzz_entry_point,
|
||||
"reachability_hints": target.reachability_hints,
|
||||
}
|
||||
|
||||
|
||||
def _reachability_from_hints(hints: list[dict[str, object]]) -> int:
|
||||
score = 0
|
||||
for hint in hints:
|
||||
|
||||
Reference in New Issue
Block a user