mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
refactor(p1): one source-facts module owns function ranges, callers, declaration tables and language aliases
src/openultrasast/source.py replaces the copies in semantic/functions.py, plane/tasks/repo_facts.py, learn/features.py, learn/excerpt.py and plane/tasks/verify.py. Two engines share one sentinel (<module>), one DECLARATION/KEYWORDS/RESERVED set and one alias map: the parser engine (ranges, enclosing, bounds, call_sites, callers_of, facts_for) for the scorer, the overlay and the hunter's annotations; the line-pattern engine (declared_functions, enclosing_at, function_span, function_bounds, the brace matcher) that labels, features, roles, excerpts and plane facts were built on. learn no longer imports plane.tasks. Frozen records that store the old sentinel are mapped on read (module_function). Gate: labels rebuilt before and after are identical, 7,921 rows, after sentinel normalisation (benchmarks/measurements/2026-10-13-source-module- label-diff/record.json). 490 targeted tests pass; 3,312 collect. Net: 657 lines deleted, 212 added. benchmarks/unseen keeps <global> for its own frozen manifests. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
f63703a604
commit
062a7b780e
@@ -0,0 +1,23 @@
|
||||
"""Compare the baseline labels (old modules) with the labels built on source.py, sentinel-normalised."""
|
||||
import glob, json, collections, sys
|
||||
def load(pattern):
|
||||
files = glob.glob(pattern)
|
||||
if not files:
|
||||
sys.exit(f"no labels file for {pattern}")
|
||||
rows = [json.loads(l) for l in open(files[0]) if l.strip()]
|
||||
return files[0], rows
|
||||
bfile, before = load("/home/mc/ousast-results/fossil/p1-baseline/out/labels-*.jsonl")
|
||||
afile, after = load("/home/mc/ousast-results/fossil/p1-after/out/labels-*.jsonl")
|
||||
def key(r):
|
||||
s = json.dumps(r, sort_keys=True).replace("<global>", "<module>")
|
||||
return s
|
||||
B = collections.Counter(key(r) for r in before); A = collections.Counter(key(r) for r in after)
|
||||
only_b = B - A; only_a = A - B
|
||||
print("baseline:", bfile, len(before), "rows"); print("after: ", afile, len(after), "rows")
|
||||
print("identical after sentinel normalisation:", len(only_b) == 0 and len(only_a) == 0)
|
||||
print("rows only in baseline:", sum(only_b.values()), " rows only in after:", sum(only_a.values()))
|
||||
def summarize(c, title):
|
||||
print(f"--- {title} (first 8)")
|
||||
for s, n in list(c.items())[:8]:
|
||||
r = json.loads(s); print(" ", {k: r.get(k) for k in ("candidate", "family", "label", "source", "unit", "pin_role") if k in r})
|
||||
summarize(only_b, "only baseline"); summarize(only_a, "only after")
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"date": "2026-10-13",
|
||||
"what": "Label diff gate for P1 (PATHFINDER-2026-10-13/04-handoff-prompts.md): labels built by `ousast learn labels` with the modules before source.py (HEAD f63703a, exported pristine) and after, compared row by row after mapping the legacy module-level sentinel <global> to <module>.",
|
||||
"before": {
|
||||
"file": "labels-c3d9c302eadf79de.jsonl",
|
||||
"rows": 7921,
|
||||
"sha256": "c3d9c302eadf79dedd3b91b5545ee4f2d91d634dafe244eb7f7cf73e76d3f1f4",
|
||||
"code": "f63703a"
|
||||
},
|
||||
"after": {
|
||||
"file": "labels-7701cc7339a0d0f7.jsonl",
|
||||
"rows": 7921,
|
||||
"sha256": "7701cc7339a0d0f7aff036581c8417f5afc645d9e45bc067787fbf767425f02a",
|
||||
"code": "working tree before the P1 commit"
|
||||
},
|
||||
"result": "identical after sentinel normalisation (0 rows only-before, 0 rows only-after)",
|
||||
"iterations": [
|
||||
"1: Codex's parser-first rewrite of the learn and plane modules: 18 test failures (function bounds semantics), reverted those modules to the line-pattern engine moved into source.py",
|
||||
"2: 4 rows missing: KEYWORDS had been widened to the parser's reserved set; restored the 22-word set (no change in output, kept for correctness)",
|
||||
"3: 4 rows still missing: frozen population records store declared sites as path::<global>; normalised on read (module_function) in labels and in function_bounds/function_span",
|
||||
"4: identical"
|
||||
],
|
||||
"sources": "src/openultrasast/learn/sources.toml (population-v1, population-v2, dev-php, pairs, advisory-fixes, ...; v3 excluded unread)",
|
||||
"note": "The label files themselves stay outside the repo (they name functions in private repositories): ~/ousast-results/fossil/p1-{baseline,after}/out/."
|
||||
}
|
||||
Reference in New Issue
Block a user