mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-17 20:19:29 +00:00
feat(semantic): the hunter's semantic producer covers Java and PHP
Java parsed already, but the producer failed every Java row because no obligation facts existed for the language and that failure took roles and def_use down with it. PHP had no grammar. Now: tree-sitter-php in the semantic extra with PHP node kinds in the CST reader; obligation facts for Jenkins/Stapler, Spring Security and Servlet code (java.toml) and for Laravel, WordPress and Symfony (php.toml), each header naming the training clones and references the names were checked against; a language with an IR but no obligation facts keeps roles and def_use and records obligations as unchecked (None), which the engineered features treat as missing, never as zero. Proven on the committed pool: 6 of 6 Java rows and 33 of 33 PHP rows of one fix change each now carry semantic features. Implemented by Codex; gated here with ruff, mypy and the full suite. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
6fe46c3062
commit
4063fd1562
@@ -100,3 +100,14 @@ def test_screen_reports_the_strongest_feature_per_annotation():
|
||||
assert out.loc["hunks", "strongest_feature"] == "diff.distance" and out.loc["hunks", "auc"] == 0.0
|
||||
assert out.loc["callers", "strongest_feature"] == "source.caller_count" and out.loc["callers", "auc"] == 1.0
|
||||
assert out.loc["roles", "auc"] == 0.5 # constant: no signal
|
||||
|
||||
|
||||
def test_unchecked_obligations_are_missing_while_checked_empty_is_zero():
|
||||
frame = features.feature_frame([{**ROW, "feature.semantic.obligations": value} for value in (None, [])])
|
||||
for column in ("semantic.obligations", "semantic.obligations_undischarged"):
|
||||
assert pd.isna(frame.iloc[0][column])
|
||||
assert frame.iloc[1][column] == 0
|
||||
for row in frame.to_dict("records"):
|
||||
assert row["ok.semantic"]
|
||||
assert row["semantic.sources"] == 1
|
||||
assert row["semantic.calls"] == 2
|
||||
|
||||
Reference in New Issue
Block a user