Repository navigation
fix(scan): persist safe dedup checkpoints on resume - #1035
Conversation
|
🔍 OpenCodeReview found 1 issue(s) in this PR.
|
lizhengfeng101
left a comment
There was a problem hiding this comment.
Great fix for the resume determinism problem — could you move error to the last position in dispatchBatch's return signature to follow Go convention, and add a brief comment on the error-path recordBatchCheckpoints call explaining why we still persist checkpoints when ctx is cancelled (to avoid re-scanning already-completed files on next resume)? Thanks for the thorough work and tests!
Thank you for the review! Addressed in
|
* fix(scan): persist deduplicated comments on resume * fix(scan): preserve dedup checkpoint provenance * refactor(scan): return batch error last
Summary
This PR fixes scan checkpoint timing around batch deduplication. Per-file checkpoints were written before
maybeRunDedup, soocr scan --resumerestored pre-dedup comments and had to invoke the best-effort dedup LLM again.The repeated call can change the resumed result when batch inputs, configuration, model output, or availability differ from the original run.
Fixes #1034.
Corrected behavior
Restored comments are included in the resumed batch's dedup input. The earlier PR description incorrectly said resume did not deduplicate them again.
The real problem is that pre-dedup checkpoints make resume depend on an additional LLM call. If that call fails or is disabled, comments merged in the original run can reappear.
Persistence contract
Dedup can merge findings within one file or across several files, but resume checkpoints are stored per file. A canonical cross-file comment cannot safely be assigned only to its first file: if that file changes later, invalidating its checkpoint could also erase another file's finding.
The safe behavior is:
Implementation
dispatchBatchfor checkpointing.Regression tests
The tests cover:
The minimal reproduction sets
DEDUP_MIN_COMMENTS=2; the default scan template uses4.Scope
Verification
make checkmake testmake coverage(91.0% total coverage)make buildAutomated review identified the reused-item provenance problem in the initial patch; the persistence contract above incorporates that feedback.