fix(review): keep unsent PR review comments across new commits (#1590) (#1592)
* fix(review): keep unsent PR review comments across new commits (#1590) PR-mode review drafts are now also stored under a stable target key (platform + host + repo + PR number + diff scope), so a draft saved before a push is found after it. The content-hash key stays the first lookup; an unchanged diff restores exactly as before. Local reviews are unchanged. Line comments record the text of their anchored diff lines. A draft served for a different patch marks comments whose lines no longer match as outdated (never dropped, never moved); outdated comments stay in the sidebar with an Outdated chip and an edit action, are labelled in the export, and post to the PR review body instead of inline. Submit, approve and close clear the draft under both keys, and the target key's tombstone rejects late saves under both keys. Mirrored in the Pi server via the vendored shared module. * fix(review): address review of PR draft persistence (#1590) - Decisions clear every PR draft target the server session saved to or restored from, so an in-place PR or scope switch cannot leave the earlier target's comments to reappear after a push. - /api/pr-switch and /api/pr-diff-scope report draftState for the new target; the client adopts its generation floor and offers any draft there as a merge. Rejected PR-mode saves answer 409 instead of ok. - Line comments also record two lines of context each side and the review snapshot they were anchored on; re-checks require text and context to match, run on restore and whenever the snapshot changes, and only comments stamped with the PR's known snapshot are posted inline. Everything else goes to the review body with the code it was written on. - Target copies remember every patch key they were saved under, so deletes without a generation still remove older patch copies. - Clicking an outdated comment opens its file without a dead scroll. - prFetcher test seam on both review servers for in-place switch tests. * fix(review): hold PR draft autosave while a switch merge offer is pending (#1590) - After an in-place PR or scope switch onto a target that holds a draft, autosave neither saves nor deletes until the reviewer answers the merge offer, so the switch's viewed-files update can no longer overwrite or tombstone the new target's draft unseen. - Comments deleted during the session are never offered back by a later merge offer. - Anchor context also compares the hunk header's function context, so an identical block in a different function is outdated, not still valid. * fix(review): auto-merge a switched-onto PR draft instead of holding autosave (#1590) Replace the merge-offer hold with a simpler shape. After an in-place PR or scope switch onto a target that holds a draft, the draft hook loads it and hands its new items (skipping ids already held or deleted this session) to the app, which merges them, re-checks their anchors and shows a small toast; autosave then saves normally. No banner after a switch. The only wait left: while that one load is in flight, autosave skips writing under the new target and resumes when the load settles on success, failure, or a newer switch. A per-switch counter ignores stale loads, and every switch resets the previous switch's state. The page-load restore banner is unchanged. * fix(review): bound and retry the switched-onto PR draft read (#1590) - Each read of a switched-onto target's draft is bounded by a 5s timeout, so a hung GET /api/draft takes the failure path instead of pausing autosave. - A failed read is retried once. If both attempts fail, autosave never writes over the unread draft; it retries the read on each later save attempt and saves normally once a read succeeds. The next switch or unmount supersedes the read, so nothing can stick. - A debounced save armed before the read settled is dropped and redone from the merged state.
M
Michael Ramos committed
2d6c864f6876975947f2a73f0f20bb90386a23fc
Parent: e42e0e3
Committed by GitHub <noreply@github.com>
on 9/22/2026, 9:21:43 PM