You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-refresh PR diffs when GitHub head/base SHAs move
When DiffViewer is showing a GitHub pull request, the diff was previously
frozen at the SHAs the resolver pinned on launch. Force-pushing the PR
or advancing the base branch had no visible effect until the user
relaunched. This commit ships PR auto-refresh end-to-end in three
phases, all in one ship:
Phase 1 - Manual refresh extension. The existing F5 (RefreshCommand)
now also kicks IPullRequestWatcher.RequestImmediatePoll in PR mode
before re-running the change-list enumerate; the existing title-bar
toast continues to confirm the action.
Phase 2 - Periodic polling. A new IPullRequestWatcher (sibling to
IRepositoryWatcher) polls GitHub's PR endpoint via an ETag-aware
GetPullRequestPolledAsync addition to IGitHubClient. The coordinator
subscribes to Changed events and rebuilds the context via the existing
SwitchContextCoreAsync path when head or base SHAs move - the same
atomic-swap recents-row clicks use. Lifecycle changes (closed / merged)
surface as toasts without rebuilding. PullRequestAutoRefresh and
PullRequestPollIntervalSeconds (default 300s, clamp 30..3600) ship as
new AppSettings fields (schema v10), exposed in the Settings dialog
under a new Pull requests section. The toolbar Live ToggleButton is
context-aware: in PR mode it routes to PullRequestAutoRefresh; in
working-tree mode it routes to LiveUpdates. Ctrl+L follows the same
routing.
Phase 3 - Polish. IWindowVisibilityProbe pauses polling while the
window is hidden (restoring visibility kicks one immediate poll).
X-RateLimit-Remaining < 100 triggers 4x backoff. 401/403 stops polling
permanently with a one-time toast carrying the GitHub message.
Conditional-get via If-None-Match keeps unchanged polls to one
round-trip with zero body bytes. Recents recording is suppressed on
auto-refresh - only initial open and explicit re-clicks update the
timestamp.
45 new tests across PullRequestWatcherTests (poll cadence, snapshot
diff, suspend semantics, visibility pause, rate-limit backoff,
terminal stop), PullRequestAutoRefreshSettingsTests (round-trip,
clamp, v9->v10 migration), GitHubClientTests (304, ETag, rate-limit
header), MainWindowCoordinatorTests (subscription wiring, rebuild on
SHA move with no recents re-record, toast-only paths), and
MainViewModelKeyboardShortcutTests (F5 calls RequestImmediatePoll,
Ctrl+L routes correctly in PR mode, re-enabling kicks one poll).
Also fixes a latent bug in the shared test-helper ManualTimer that
clobbered a callback-re-armed schedule with the post-callback
"one-shot done" branch; existing tests don't trigger it because
RepositoryEventDebouncer's callback never re-arms its own timer.
AI-Local-Session: 6df9761f-b968-469a-87e4-376987d4353a
AI-Cloud-Session: 4080c61e-0c31-4ba9-9c66-2bbaf6fb6bf6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments