mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
fix(hunt): label every verified target of a change; undo an inherited sparse-checkout in the worktree
label_rows honoured only a change's primary site, so 43 of the 48 accepted access-control locations were unlabelled; every entry of targets is now a positive with its own label_ref and span. The training clones were emptied with sparse-checkout to save disk and a new worktree inherits it: every file read failed and the source and semantic producers reported an unread tree on all 599 rows. The runner now disables sparse-checkout in the worktree it adds. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
30921a12b9
commit
499f6c4474
@@ -45,3 +45,22 @@ def test_positive_requires_traceable_reference():
|
||||
del change["case_id"]
|
||||
with pytest.raises(ValueError, match="case_id"):
|
||||
label_rows([], change)
|
||||
|
||||
|
||||
def test_every_verified_target_of_a_change_is_a_positive():
|
||||
change = {
|
||||
**positive(),
|
||||
"case_id": "c1",
|
||||
"targets": [
|
||||
{"case_id": "c1", "path": "app.py", "function": "handle", "function_lines": [10, 20]},
|
||||
{"case_id": "c2", "path": "lib.py", "function": "check", "function_lines": [3, 8]},
|
||||
],
|
||||
}
|
||||
rows = [
|
||||
{"path": "app.py", "line": 12, "function": "handle"},
|
||||
{"path": "lib.py", "line": 5, "function": "check"},
|
||||
{"path": "lib.py", "line": 40, "function": "other"},
|
||||
]
|
||||
out = label_rows(rows, change)
|
||||
assert [r["label"] for r in out] == [1, 1, None]
|
||||
assert out[1]["label_ref"] == "c2" and out[1]["fix_span"] == [3, 8] and out[2]["label_ref"] is None
|
||||
|
||||
Reference in New Issue
Block a user