Repository navigation
Sidebar P2: main publishes without waiting on git, and every source announces its changes (inert) - #31513
Conversation
…lip) The fixes found while the sidebar ran from main's feed, without turning that on: ORCA_SIDEBAR_INPUTS_IS_MAIN stays false, and none of flip-a's stop-gaps come along. - Main stops counting a closed tab's terminal once it was asked to stop and no pane shows it; a failed or refused stop takes the request back, and a host out of contact stays unverifiable. - Main fetches a paired server's rows with the transport's normal bound, so a server slower than 5 s still lists. - A deferred unread raise flips the folder row it was decided for, and a read while the owner check is out cancels it. - Phone: no worktree.ps flash before the feed; a host's last installed feed stands in while a fresh read is out; it highlights its own last-opened workspace and a fold never scrolls; projects file under their project group with the desktop's indent; the collapse spinner shows only after 500 ms; "Reopen to update" keeps the rows on screen. - e2e helpers and journeys for the switch-on suite.
…d prune pending unread raises - A stop-and-wait that throws takes its stop request back, like one that fails. - A final stop the legacy relay still owes stays marked, since the relay retries it. - Pending unread raises are tracked only while one waits, so the map no longer grows. - The paired-server fallback poll test gives its third fetch a reply and asserts live.
…stores; detected, view and live-content domains (inert)
…n metadata writes, no phone wait on detected checkouts
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
77522c93-3d1c-4ba2-951c-56816fbccbc1
📒 Files selected for processing: 33
src/main/persistence/loading-store/profile-preferences.tssrc/main/persistence/loading-store/store-runtime-state.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/repo-worktree-row-resolution.tssrc/main/runtime/rpc/methods/sidebar-inputs.tssrc/main/runtime/runtime-store-contract.tssrc/main/runtime/sidebar-inputs/cached-scan.test.tssrc/main/runtime/sidebar-inputs/cached-scan.tssrc/main/runtime/sidebar-inputs/detected-checkouts-producer.tssrc/main/runtime/sidebar-inputs/orca-runtime-detected-checkouts-live-content.tssrc/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.tssrc/main/runtime/sidebar-inputs/producer-revision.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed-announcements.test.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed.test-fixture.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed.test.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed.tssrc/main/runtime/sidebar-inputs/workspace-activity-facts-producer.tssrc/main/runtime/sidebar-inputs/workspace-git-identity.test.tssrc/main/runtime/sidebar-inputs/workspace-git-identity.tssrc/main/runtime/sidebar-inputs/workspace-live-content-producer.tssrc/main/runtime/sidebar-inputs/workspace-rows-producer.test.tssrc/main/runtime/sidebar-inputs/workspace-rows-producer.tssrc/main/runtime/sidebar-inputs/workspace-rows-publish-cost.test.tssrc/main/runtime/workspaces/resolved-worktree-scan-join.tssrc/main/runtime/workspaces/workspace-catalog.tssrc/main/wsl/wsl-host-service.tssrc/renderer/src/components/sidebar/sidebar-list-parity-project-catalog.test-fixture.tssrc/renderer/src/components/sidebar/sidebar-list-parity.test-fixture.tssrc/renderer/src/store/slices/worktrees/listing/worktree-slice-types.tssrc/renderer/src/store/slices/worktrees/metadata/hosted-review-link-mutation.tssrc/shared/sidebar-list/workspace-live-content.tssrc/shared/worktree/hosted-review-links.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| watch(listener: () => void): () => void { | ||
| const detach = this.revision.onChange(listener) | ||
| if (!this.listings.current) { | ||
| this.listings.request() | ||
| } | ||
| return detach | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make watch refresh a stale listing as well as a missing one.
The producer has demand only while a listener exists. Without demand, a catalog event calls this.listings.request(), and CachedScan.request only sets stale = true.
On the next attach, watch rescans only when current is null. A reader that reconnects after a catalog change therefore gets the old listing. The listing stays old until another worktreesChanged/reposChanged event arrives.
CachedScan.ready() already forces a scan when the value is null or stale. Use it here; it never rejects.
🐛 Proposed fix
--- "a/src/main/runtime/sidebar-inputs/detected-checkouts-producer.ts"
+++ "b/src/main/runtime/sidebar-inputs/detected-checkouts-producer.ts"
@@ -46,13 +46,12 @@
}
/** Listens and starts the first listing; a reader shows nothing for this domain until it lands. */
watch(listener: () => void): () => void {
const detach = this.revision.onChange(listener)
- if (!this.listings.current) {
- this.listings.request()
- }
+ // Scans when nothing has applied yet, or when a change landed while no one listened.
+ void this.listings.ready()
return detach
}
/** Null before the first listing applies. */
snapshot(): Record<string, DetectedWorktreeListResult> | null {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| watch(listener: () => void): () => void { | |
| const detach = this.revision.onChange(listener) | |
| if (!this.listings.current) { | |
| this.listings.request() | |
| } | |
| return detach | |
| } | |
| watch(listener: () => void): () => void { | |
| const detach = this.revision.onChange(listener) | |
| // Scans when nothing has applied yet, or when a change landed while no one listened. | |
| void this.listings.ready() | |
| return detach | |
| } |
ELI5
The phone (and, later, the desktop window) reads the sidebar from a feed that the desktop's main process publishes. Today that feed has two weak spots. First, every publish waits for fresh git scans, so a pin or rename can sit behind a slow repo or a stalled SSH host. Second, some sources never say when they change, so the feed re-reads them whenever a phone asks. That means a PR merging on a quiet desktop does not reach the phone until something else happens.
This PR fixes both inside main and adds three new feed sections. Nothing reads the new sections yet. The sidebar's switch is off on main, so users see no change.
What Changed
Publishing never waits on git
Every store announces its own writes
onGitHubCacheWritten). The review section listens for it, and also for workspace-row and paired-server changes.onStatusesChanged, fired fromhandleConnectionChange, Add and Remove).Branch switches are decided in main
checkout -bsurvives the next real scan.New feed sections, no readers yet
detected: each repo's detected checkouts, from the same listingworktree.detectedListserves.view: the sidebar view settings, the same fieldsui.getreturns.liveContent: live terminal count and attached-terminal state per workspace.What runs with the switch off: the PR cache save and WSL status change now loop over their listener sets. With the switch off, nothing registers a listener, so both loops are empty. The scan/join split adds new methods only. The listing everything else uses (
computeResolvedWorktrees) is unchanged.Why
sidebarInputs.workspaceRowsreply now waits for queued scans, so it is never older than the fresh listing it replaced.Linked Issue
Part of the sidebar one-owner design, P2 (producer preparation). Stacked on #31466.
Visual Proof
N/A: main-side only, behind the switch, and nothing reads the new sections yet.
Testing
pnpm tc: clean (node, cli, web).New unit tests:
Quiet-desktop PR grouping: with no other activity, a PR cache save alone reaches the phone's review fact and its group ("done"). It fails if the cache announcement is removed.
Timing: with a scan held for 2 s, a metadata write published in 0.22 ms, in one microtask turn (the test asserts under 20 ms).
Cost at 1000 workspaces (real store, join, filters and feed diff; git stubbed as its cached scan), 60 metadata writes: median 9.9 ms, max 13.3 ms. That is inside the 100 ms bar; a 5-writes-per-second burst costs about 5% of one core.
The 1000-workspace cost test gates on the median: a max gate flaked when the machine's load average was 40–60. On a quiet machine: 9.9 ms median, 13.3 ms max.
Link-wipe sequence: first scan, then
checkout -b, PR linked, cached rescan, then a real scan on the new branch. The PR is kept. The test fails if links are recorded on every scan.vitest --project nodeoversrc/main/runtime,src/main/wsl,src/main/persistence/loading-store, the parity fixture and the hosted-review renderer tests: all pass except 2 cases inorca-runtime.test.ts(the existing-folder imports). Those 2 fail the same way on the base commit, because macOS resolves/varto/private/var.Lane static gate (lint, formatting, anti-slop, code quality, ratchets, typecheck:ci, mobile typecheck): all pass.
The full switch-on e2e suite was not run for this PR.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Notes
worktree.psand get reconciled when a reader adopts them (P8a).