feat: add --fresh flag to parse for forced reparse#38
feat: add --fresh flag to parse for forced reparse#38joshbouncesecurity wants to merge 4 commits into
Conversation
Manual verification
|
Local test resultsBuilt the Go CLI from this branch and exercised Commands run: Outcome:
|
|
Hey @joshbouncesecurity — running through your draft batch, this one's the easiest to land. Sharing a quick review now since it looks essentially mergeable: Things done quietly well:
Three small things before flipping out of draft:
Nit (optional): Address #1-#3 and this is good to flip out of draft. Nice work. |
|
Thanks @ar7casper, addressed in 56ce18b:
Also fixed a regression I'd introduced relative to upstream: the branch had reverted the |
The parse step's unit generator merges new units into an existing dataset.json, preserving old units as-is. This means changes to the parser (e.g., improved call graph resolution) don't take effect for previously-parsed units unless the dataset is deleted manually. Add --fresh flag to parse (and ensure scan --fresh also clears the dataset) so users can force a full reparse when needed. - Go CLI: add --fresh flag to parse command, pass through to Python - Python CLI: add --fresh arg to parse subparser - parser_adapter: delete existing dataset.json when fresh=True - scanner: include dataset.json in fresh cleanup alongside checkpoints - unit_generator: add stderr note when existing units are reused Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
- Extract buildParsePyArgs from runParse so the helper is the source of truth (tests no longer keep a parallel copy with 'keep in sync') - Replace exists()+remove() with try/except FileNotFoundError to avoid TOCTOU race when two --fresh parses run concurrently - Clarify --fresh help text and docstring: only dataset.json is deleted; other artifacts in the output dir are preserved
- Restore --level default to "reachable" and guard to level != "reachable" (reverts regression introduced when branch diverged from upstream fix #35) - Restore upstream parse_test.go level tests, updated to 7-arg signature - Fix JS duplicate-units hint to say 'openant parse --fresh' not --fresh - Add test: --fresh + --diff-manifest compose correctly Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
56ce18b to
7ece34f
Compare
Summary
Adds
--freshtoopenant parseto force a full reparse from scratch without manually deletingdataset.json. Useful when parser improvements are deployed and the existing dataset needs to be regenerated.The JS parser also now logs a hint pointing at
--freshwhen existing units are reused, so users discover the flag when they need it.Addresses item 19 from #16 (does not close the issue).
Test plan
openant parse <repo>reuses existing units whendataset.jsonalready exists (default).openant parse <repo> --freshdeletes the cached dataset and reparses from scratch.--fresh, the JS parser hint about reused units no longer fires for that run.