Repository navigation
Conversation
…comparison A file marked viewed and then edited kept its viewed state on the next run, with no indicator, because the stored record's hash was never compared with the file's current hash. The "changed since you viewed" check ran only against the cross-comparison hash index, and skipped every path loaded from storage. Such a file now becomes un-viewed and flagged, so its diff is expanded again; the per-repo hash index is left intact, so reverting the edit restores the viewed state. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
Hi @yoshiko-pg, do you think this PR is ok? |
This was referenced Oct 22, 2026
This branch has not been deployed
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.
Mark a file viewed, edit it, open difit again at the same HEAD: the file is still
Viewed, still collapsed, and carries no changed indicator, so the edit is hidden. This is
the ordinary review-edit-look-again loop, where the storage key
${repositoryId}:${diffSelectionKey}:${currentCommitHash}does not change.Records loaded from that key went into the viewed set by path, with their
diffContentHashnever compared against the file's current hash. The"changed since you viewed" loop then skipped every path loaded from storage
(
if (knownPaths.has(file.path)) continue), so the indicator only ever fired for fileshydrated from the cross-comparison hash index.
useViewedFilesnow hashes the displayed files before buildingknownPaths, drops therecords whose file no longer hashes to the recorded value, and seeds
changedSinceViewedFilesfrom those paths as well as from the index.Such a file becomes un-viewed and flagged, rather than viewed and flagged, because the
Updatedbadge is hidden while a file is marked viewed — leaving it viewed would keep thenew content behind a collapsed entry, which is the bug. Nothing is discarded: the per-repo
hash index keeps the (path, old hash) entry, so reverting the edit re-hydrates the viewed
state, and a record for a path absent from the diff is left untouched.
Test:
useViewedFiles.test.ts,describe('changed since viewed within one comparison'),two cases — a stored record whose hash no longer matches is flagged and un-viewed, and one
whose hash still matches stays viewed and unflagged. The first fails before the change.