feat: let a project keep its own review notes - #16
Merged
Conversation
Review notes lived only in ~/.diffity/<repo-hash>, which is wrong for two cases: several worktrees of one repository each want their own notes, and notes that belong to a project should be able to travel with it rather than with the machine. DIFFITY_DATA_DIR, or dataDir in a committed .diffity.json, now chooses the directory. Relative paths resolve against the repository root and the environment wins over the file. A directory chosen for one project is used as given - the hashed subdirectory only exists to keep repositories apart inside the shared default. diffity warns at startup when the data directory sits inside the working tree without being ignored, since the notes would otherwise appear as untracked files in the diff being reviewed. The database quotes the code under review through anchor_content, so it and its WAL are created readable only by the owner, and so is the directory. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
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.
Review notes lived only in
~/.diffity/<repo-hash>, which is wrong for two of your cases: severalworktrees of one repository each want their own notes, and notes belonging to a project should be
able to travel with the project rather than the machine.
DIFFITY_DATA_DIR, ordataDirin a committed.diffity.json, now chooses the directory. Relativepaths resolve against the repository root, the environment wins over the file, and a directory
chosen for one project is used as given — the hashed subdirectory only exists to keep
repositories apart inside the shared default, and there is nothing to disambiguate in a project's
own directory.
Point it outside the working tree, or ignore it: otherwise the notes appear as untracked files in
the diff being reviewed, since a bare-ref diff includes untracked files. diffity now warns at
startup when that is the case.
Also closes audit P2-4: the database quotes the code under review through
anchor_content, soit, its WAL and the directory are created readable only by the owner. They were 0664/0775 under the
ambient umask.
Verified by moving a live review's notes to
~/nc/SendgridIdempotency/.diffity— beside theworktree, not inside it — with
DIFFITY_DATA_DIR=../.diffity; the worktree stayed clean and thenotes were served from the new location. Worth recording for anyone migrating: copying
reviews.dbalone loses everything, because WAL mode keeps recent writes in
reviews.db-waluntil a checkpoint.Stacked on #15.
🤖 Generated with Claude Code
https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs