feat(comments): delete .dunk/comments.json when the review is empty#12
Merged
Conversation
Resolving the last comment left an empty `{ "schema": 1, "comments": [] }`
file that an agent or human reviewer still had to reason about. Reads
already treat a missing file as "no comments", so `writeCommentsFile`
now deletes the file on an empty review and round-trips cleanly.
Because deletion is now part of the normal write path and the TUI and
agent CLI ping-pong on the same review, a concurrent deletion could land
between an `existsSync` check and the read. The read/fingerprint helpers
now do a single ENOENT-safe read instead, and the comments-file path has
one source of truth via `commentsFilePath`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Resolving the last comment left an empty
{ "schema": 1, "comments": [] }file behind — noise an agent or human reviewer still has to open and reason about.What was changed
writeCommentsFiledeletes.dunk/comments.jsonwhen the review has no comments instead of writing an empty array. Reads already treat a missing file as "no comments", so this round-trips cleanly (CLIresolve, TUI delete, drift clear).existsSync-then-read, closing a concurrent-deletion race.commentsFilePath.mutateCommentsFileand CLIresolveof the last comment delete the file, and a deterministic concurrent-deletion-mid-mutation regression test.Reviewed with Doistbot (2 rounds): fixed the P1 ENOENT race, added the concurrent-deletion test and path helper.
Refs
CHANGELOG under
## [Unreleased].🤖 Generated with Claude Code