tools/classify_carve.py: normalize head case, accept argv, and validate resolved report path #2279
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2279
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/classify-carve-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: CLASSIFY-CARVE-ARGV-CASE-HEAD-AND-REALPATH-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191951624)
What and why
argv=Noneparameter tomain(argv=None)intools/classify_carve.pyso callers can invoke it directly without mutatingsys.argvwhile keepingsys.argv[1:]as the default..lower()inclassify()so uppercase hex headers (52424630...,42400000...,DEADBEEF...) match known signatures andother:<hex>buckets instead of creating duplicate uppercase buckets.dest = os.path.realpath(report)and check bothos.path.isdir(...)andnot os.path.isdir(dest_dir)upfront before scanning per-archiveindex.jsonfiles.\nafterjson.dump(out, f, indent=1)when writingtypes.json.tests/test_classify_carve.pycovering uppercase signatures, explicitmain([root])invocation with trailing LF verification, and upfront rejection of resolved directory/non-directory-parent report paths.Tested
python -I tests/test_classify_carve.py -v: 36 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 1 failure and 3 errors).python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/classify_carve.py tests/test_classify_carve.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
tests/test_classify_carve.py: 35 passed, 1 skipped, 12 subtests passed (main: 32 passed, the same skip).(AI-assisted test run; output checked by hand.)
Approving 6861c7d36.
Lowercasing
headcannot change a match, since the three prefixes are digits only; it only merges heads that differed in letter case into oneother:bucket.maintakes argv, and the resolved report path and its folder are checked before the carve is walked.Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_classify_carve.py: 35 passed, 1 skipped (main: 32). AI-assisted (Claude Code, Claude Opus 5.5).Red/green: classified READY by oreo-lot3 (red on main b1619e0a3, green on head merged with main); head 6861c7d36c2e unchanged since 2026-11-26, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)