Repository navigation
Mark files as viewed during review - #6739
brennanb2025 wants to merge 1 commit into
Conversation
Add a per-file "viewed" toggle to the combined diff review viewer, mirroring GitHub's PR "Viewed" checkbox. A checkbox appears on each file in the Changes file tree and in each diff section header; viewed files dim with a checkmark, the file-tree header shows an "N / M viewed" progress count, and the existing "Viewed files" filter now hides viewed files. Viewed state persists per worktree (local and SSH, via the same updateMeta / worktree.set path used by diff notes) so it survives navigation, viewer remount, tab close/reopen, and app restart. A file's viewed state auto-resets when its diff changes again: identity is derived from live git status for uncommitted files and from compare oids for branch/commit reviews. On the hosted PR review surfaces (PullRequestPage, GitHubItemDialog) the file-tree toggle drives GitHub's native viewed state rather than the local store, keeping both controls in sync. Closes #4540 Co-authored-by: Orca <help@stably.ai>
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (30)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-06-29T10:36:27Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes. |
What changes
Adds a per-file "viewed" toggle to the combined diff review viewer (Source Control → Review Changes), mirroring GitHub's PR "Viewed" checkbox. Each file in the Changes file tree — and each diff section header — gets a viewed checkbox; viewed files dim with a filled checkmark so unreviewed files stand out; the file-tree header shows an "N / M viewed" progress count; and the previously inert "Viewed files" filter now actually hides viewed files.
Viewed state persists per worktree across navigation, viewer remount, tab close/reopen, and app restart, and auto-resets when a file's diff changes again after being marked viewed.
What does not change: This is a local review-progress marker only. Viewed state is never sent to an agent and is independent of the desktop's commit/branch diff content — it is keyed by file + a diff identity, not by full file content. On the hosted GitHub PR review surfaces, the toggle drives GitHub's existing native viewed state, not the new local store (so the two stay in sync rather than diverging).
Closes #4540
Design approach
Mirror the existing mobile per-file "reviewed" system (
MobileDiffReviewState) on desktop with a dedicated, independent persisted field rather than reusing the mobile record (the file-key schemes differ and cross-surface sync was not requested). State is persisted on the worktree via the same proven path diff notes use:updateMetalocally and theworktree.setRPC over SSH.CombinedDiffReviewState({ version, updatedAt, files: Record<key, { key, reviewedAt, diffIdentity }> }) onWorktree+WorktreeMeta. The map stores only viewed files (no tombstones); a file is "viewed" iff its entry exists and its storeddiffIdentitymatches the file's current identity.Design-review outcome
Ran an automated design-review/fix loop to convergence (clean after 3 iterations, both reviewers). The load-bearing correction: auto-reset for same-area uncommitted edits must key off an ungated live-git-status signature, because the tab-open entry snapshot (and
entrySignature) is deliberately frozen for same-area edits and the existing gated status signature is empty on the snapshot-backed Review Changes surface. Implemented as a separateuncommittedStatusSignature, leaving the existing gated memo untouched.Implementation & deviations
Implemented per the reviewed design. Deviations, all additive and sound:
PullRequestPage,GitHubItemDialog) to their existing GitHub-native viewed mutation, since those surfaces already track viewed state via GitHub and must not diverge.Completeness verification
Read-only verification confirmed all four headline behaviors execute in production code (not scaffolding), the data model is on both
WorktreeandWorktreeMeta, andcombinedDiffReviewis forwarded at all five metadata sites (a missed one silently drops the field over SSH). No missing or partial items.Headline behavior status
Implemented. Per-file viewed toggle (tree + diff header), dimmed/checkmark styling, "N / M viewed" count, auto-reset on diff change, and per-worktree persistence (local + SSH) all run in production code and were verified on screen.
Perf audit
Audited the touched hot path (the virtualized combined diff viewer). No actionable regressions. The new store selector returns a frozen stable-reference sentinel (same pattern as diff notes), so unrelated git polls / worktree updates don't re-render the viewer; the
presentReviewFilesmemo recomputes only when the changeset actually changes; the reconcile effect no-ops (returns the same reference → no IPC) in steady state; toggles persist through a bounded per-worktree serialized queue. No measurements/tests needed beyond the deterministic unit coverage. No fixes applied.Code-review loop
Two rounds, two independent reviewers each round. Round 1 surfaced one low-severity finding (the read selector returned persisted state un-normalized, so a malformed cross-version/hand-edited record could crash the viewer); fixed by gating the selector to the empty sentinel for malformed input while preserving referential stability, plus a regression test. Round 2: both reviewers clean (only non-actionable nits).
brennan-test-changes (merge-confidence)
Validated end-to-end in a dedicated Electron dev instance against a multi-file changeset. PASS on all checks: tree checkbox dims/checks + count increments; in-diff "Viewed" toggle stays in sync with the tree; state persists across closing/reopening the diff (and
combinedDiffReviewpopulates in the store); auto-reset fired when a viewed file's diff changed (count dropped, that file reset, others stayed viewed); the "Viewed files" filter hides viewed files. Recommendation: land.Accepted gap: durable persistence across a full app restart could not be verified because the test host's disk was 100% full (ENOSPC broke
orca-data.jsonwrites for all instances). The in-memory persistence path and persisted shape are correct and unit-tested; a cross-restart check should be redone on a machine with free disk. (Separately flagging the disk-full condition — it appears to have crashed an unrelated dev instance during testing.)Static checks & focused tests
tsgoweb + node typecheck: passoxlint: clean (one pre-existing unrelated warning)verify:localization-catalog: pass (6 new keys, parity across en/es/ja/ko/zh)vitest: 52 tests pass across the new identity/state/slice modules, the file-tree filter, the diff-notes slice, and the feature-interaction parity test.Validation evidence
Screenshots captured during validation (file tree with viewed count + dimmed/checked row, in-diff toggle, auto-reset before/after, filter hiding viewed files). Available on request; not committed per repo evidence policy.
Remaining risks / non-actionable notes