mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-16 03:49:26 +00:00
feat(learning-harness): fix dates and the post-cutoff slice
The catalog generator fills `fix_date` from the recipe at the precision the recipe has -- a full ISO day when one was recorded, otherwise the year. Every harvested recipe carries a year and almost none carries a day, and writing `-01-01` would turn a year into a claim about a month. A row counts as post-cutoff only when its earliest possible date is after the cutoff, so a coarse date can under-claim the clean slice but never over-claim it. Each family now reports the same numbers over the rows fixed after the cutoff, beside the whole number and never instead of it, with the undated count on its own line. Without a configured cutoff every scoreboard says so rather than inventing one: guessing a model's training cutoff and then publishing a contamination number from the guess would be worse than reporting none. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
co-authored by
Claude Opus 5
parent
d1faa04771
commit
3e71e9e88b
@@ -93,6 +93,9 @@ def catalog_text(slice_name: str, recipes: list[dict[str, object]]) -> str:
|
||||
lines.append(f'reviewer = "{_q(reviewer)}"')
|
||||
if recipe.get("known_limit"):
|
||||
lines.append(f'known_limit = "{_q(recipe["known_limit"])}"')
|
||||
fix_date = _fix_date(recipe)
|
||||
if fix_date:
|
||||
lines.append(f'fix_date = "{_q(fix_date)}"') # Req 10.5: the post-cutoff slice needs a date to sort by
|
||||
for relpath, context_vuln, context_fixed in context_rel(recipe):
|
||||
lines += [
|
||||
"",
|
||||
@@ -123,6 +126,19 @@ def catalog_text(slice_name: str, recipes: list[dict[str, object]]) -> str:
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def _fix_date(recipe: dict[str, object]) -> str:
|
||||
"""The date of the fix at the precision the recipe recorded it: a full ISO day, or the year, or nothing.
|
||||
|
||||
Every harvested recipe carries a year; almost none carries a day, and inventing `-01-01` would turn a year into
|
||||
a claim about a month. The post-cutoff comparison reads the earliest possible date of whatever precision is
|
||||
here, so a coarse date can only ever under-claim (learning-harness Req 10.5)."""
|
||||
recorded = str(recipe.get("fix_date", "") or "")
|
||||
if recorded:
|
||||
return recorded
|
||||
year = recipe.get("year")
|
||||
return str(year) if isinstance(year, int) and 1990 <= year <= 2100 else ""
|
||||
|
||||
|
||||
_DEFAULT_TIER = {"vibe-py": "seeded", "vfc-js": "advisory", "agent-vfc": "title", "vfc": "advisory", "sast": "advisory"}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user