Repository navigation
refactor(sidebar): main keeps sleeping retention only, no order of its own (dark) - #30404
Conversation
… or saved order (dark) With ORCA_SIDEBAR_INPUTS=main the window's sort hook is a pure read of the rows' stamps: no settled-epoch store listener, no Smart latch, no saved Smart order writes, no class telemetry over the old attention map. Switch off: the existing hook, unchanged. Co-Authored-By: Claude <[email protected]>
…-on tests Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…anup' into jinwoo/sidebar-stamps-main-cleanup
… renderer layout literal The layout-writer ratchet counts layout field keys written in the renderer; the empty sources object now lives beside SmartSortSources in shared code. Co-Authored-By: Claude <[email protected]>
…s own (dark) Clients sort by the owning host's stamps, so main's temporal owner loses its settle window, Smart latch, create grace and catalog-listing classifier, and the shadow check stops comparing order. Retention, its clock and its shadow comparison stay. Co-Authored-By: Claude <[email protected]>
…anup' into jinwoo/sidebar-stamps-main-cleanup
…anup' into jinwoo/sidebar-stamps-main-cleanup
…ter the first Co-Authored-By: Claude <[email protected]>
…-main-cleanup # Conflicts: # src/renderer/src/components/sidebar/worktree-list/listing/use-sort-order.ts
Co-Authored-By: Claude <[email protected]>
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3a4bdffe-f802-4504-86c8-26770fe25697
📒 Files selected for processing: 22
config/tsconfig.tc.web.jsonsrc/main/runtime/sidebar-inputs/catalog-listing-change.tssrc/main/runtime/sidebar-inputs/orca-runtime-sidebar-inputs-feed.test.tssrc/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.tssrc/main/runtime/sidebar-inputs/runtime-smart-sort-sources.test.tssrc/main/runtime/sidebar-inputs/runtime-smart-sort-sources.tssrc/main/runtime/sidebar-inputs/sidebar-inputs-feed-domains.tssrc/main/runtime/sidebar-inputs/sidebar-retention-owner.test.tssrc/main/runtime/sidebar-inputs/sidebar-retention-owner.tssrc/main/runtime/sidebar-inputs/sidebar-temporal-owner-stamps.test.tssrc/main/runtime/sidebar-inputs/sidebar-temporal-owner.test.tssrc/main/runtime/sidebar-inputs/sidebar-temporal-owner.tssrc/main/runtime/sidebar-inputs/smart-sort-agent-entries.test.tssrc/main/runtime/sidebar-inputs/smart-sort-agent-entries.tssrc/renderer/src/components/sidebar/worktree-list/listing/use-sleeping-sweep-retention.main-parity.test.tsxsrc/renderer/src/components/sidebar/worktree-list/listing/use-sort-order.main-parity.test.tsxsrc/renderer/src/components/sidebar/worktree-list/listing/use-sort-order.tssrc/renderer/src/lib/sidebar-list-session.tssrc/renderer/src/lib/sidebar-shadow/sidebar-temporal-shadow.tssrc/renderer/src/lib/sidebar-shadow/window-sidebar-temporal-readout.tssrc/shared/sidebar-list/sidebar-temporal-snapshot.tstests/e2e/sidebar-inputs-feed.spec.ts
💤 Files with no reviewable changes: 10
- src/main/runtime/sidebar-inputs/smart-sort-agent-entries.test.ts
- src/main/runtime/sidebar-inputs/sidebar-temporal-owner-stamps.test.ts
- src/main/runtime/sidebar-inputs/runtime-smart-sort-sources.test.ts
- src/renderer/src/components/sidebar/worktree-list/listing/use-sort-order.main-parity.test.tsx
- src/main/runtime/sidebar-inputs/sidebar-temporal-owner.test.ts
- src/shared/sidebar-list/sidebar-temporal-snapshot.ts
- src/main/runtime/sidebar-inputs/smart-sort-agent-entries.ts
- src/main/runtime/sidebar-inputs/catalog-listing-change.ts
- src/main/runtime/sidebar-inputs/sidebar-temporal-owner.ts
- src/main/runtime/sidebar-inputs/runtime-smart-sort-sources.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.
| (event) => { | ||
| if (event.type === 'worktreesChanged' || event.type === 'reposChanged') { | ||
| this.noteSidebarCatalogChange(event.type) | ||
| this.sidebarTemporal.noteCatalogChange() |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -eu
printf '%s\n' '--- runtime sidebar temporal ---'
nl -ba src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts | sed -n '1,190p'
printf '%s\n' '--- retention owner ---'
nl -ba src/main/runtime/sidebar-inputs/sidebar-retention-owner.ts | sed -n '1,210p'
printf '%s\n' '--- metadata handler ---'
nl -ba src/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.ts | sed -n '1,125p'
printf '%s\n' '--- metadata domain definitions and relevant references ---'
rg -n -F --glob '*.ts' -e 'WORKTREE_METADATA_DOMAINS' -e 'noteRowsWritten' -e 'invalidateResolvedWorktreeCache' -e 'notifyWorktreesChangedForRemoteClients' src/main src/sharedRepository: stablyai/orca
Length of output: 27765
🏁 Script executed:
set -eu
printf '%s\n' '--- reviewed diff for temporal owner ---'
git diff --no-ext-diff --unified=30 63f0cb9570f581b7589534d9c630e54bd41debf7 d64b779e00ebf5d25a1c0c4643825f38f4048373 -- src/main/runtime/sidebar-inputs/orca-runtime-sidebar-temporal.ts
printf '%s\n' '--- surviving state-write listener ---'
nl -ba src/main/runtime/sidebar-inputs/workspace-rows-producer.ts | sed -n '1,75p'
printf '%s\n' '--- onStateWritten declaration and store metadata write path ---'
rg -n -F --glob '*.ts' -e 'onStateWritten' -e 'setWorktreeMetaForHost' -e 'setWorktreeMeta(' src/main/persistence src/main/runtime src/main/ipc | head -80Repository: stablyai/orca
Length of output: 25665
Restore metadata-write invalidation and retention relisting.
A non-display-name worktrees:updateMeta write can change WorktreeMeta.hostId. The current path updates the store and bumps WorkspaceRowsProducer.revision, but it does not invalidate resolvedWorktrees or relist SidebarRetentionOwner.
Workspace and review readers can therefore receive stale resolved rows. The retention owner can also publish the old host-qualified identity until another catalog event triggers a relist.
Restore the metadata-write handler. Invalidate the cache before notifying the owner to relist.
Suggested fix
import { SortStampsProducer } from './sort-stamps-producer'
+import { WORKTREE_METADATA_DOMAINS } from '../../persistence/loading-store/worktree-identity-metadata'
...
this.workspaceActivityFacts.revision.onChange(() => this.sidebarTemporal.noteActivityChange())
this.store?.onUIChanged?.(() => this.sidebarTemporal.noteViewChange())
+ this.store?.onStateWritten?.((domains) => {
+ if (
+ ORCA_SIDEBAR_INPUTS_IS_MAIN &&
+ (domains === undefined ||
+ WORKTREE_METADATA_DOMAINS.some((domain) => domains.includes(domain)))
+ ) {
+ this.invalidateResolvedWorktreeCache()
+ this.sidebarTemporal.noteCatalogChange()
+ }
+ })
// Every catalog change, from IPC or the runtime, reaches clients through this one bus.
ELI5
In the new sidebar build (still switched off for everyone), every client sorts the workspace list by notes the owning computer writes on each workspace. Main used to keep its own copy of the old timer-based order so a test-only "shadow" check could compare it with the window's. That copy is no longer needed, so this PR deletes it. Main keeps the one piece still in use: which sleeping workspaces "Hide sleeping" keeps for a moment while a terminal reconnects.
What Changed
Behind the build switch
ORCA_SIDEBAR_INPUTS=mainonly (main's sidebar layer does not exist in a switch-off build):SidebarTemporalOwnerbecomesSidebarRetentionOwner(sidebar-retention-owner.ts): sleeping retention only. Gone: the settle window, the Smart latch, create grace, the sort sample and its deadline.catalog-listing-change.ts,runtime-smart-sort-sources.ts,smart-sort-agent-entries.ts, and the runtime layer's graph-sync sort causes and saved-metadata re-sort listener.SidebarTemporalSnapshotdropssortSnapshot(thesidebarInputs.temporalresult and the feed'stemporaldomain).useSidebarListSession()no longer records the window's order; the shadow readout keeps the window's retention even when the sweep commits before the list's session begins (it was dropped before). The window/main parity test is now retention-only.Unchanged: the sidebar clock (activity facts still use it), the host's sort stamps and the startup reconcile.
Why
Plan step 4 of the sort-stamps note. After #30284 and #30401 the order is a pure read of the stamps on every client, so main's copy of the old time rules only cost work on every catalog change, agent row change and graph sync, and a comparison that was meant to differ.
Wire: the only parser of
sortSnapshotwas the renderer's dev/test shadow check, behind the same switch. A newer client reading an older dark host strips the extra key; an older dark client reading this host stops comparing that domain. Nothing user-facing reads it, so no null placeholder was kept.Linked Issue
Follow-up to #30284 and #30401 (sidebar sort stamps plan, PR 4).
Visual Proof
N/A: dark behind a build switch; no shipped build changes.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
sidebar-retention-owner.test.ts: idle until a session and after dispose; a live row held through a rebind gap then released; the show-sleeping reset; nothing published until a listing lands (with a revision bump when it does); a slow session listing never overwrites a newer catalog listing. Positive control: with the sequence check removed, the last test fails.use-sleeping-sweep-retention.main-parity.test.tsx: main and window keep and release the same sleeping rows on one fake clock.Sidebar, sidebar-inputs and shadow suites;
pnpm tc.e2e on a switch-on build, hidden window, all shadow-checked specs (workspace rows, sort-stamps order/stamps/startup, inputs feed, creation registry, review facts, repo icons, agent row identity, folder keyboard navigation, collapse, measured scroll, paired mobile mirror visibility, paired-server rows): pass.
paired-server-rows-shadowtimed out once and passed on rerun.All
check:*ratchet*scripts (launcher protocol with--base origin/main),check:code-quality:changed, anti-slop lint (config/oxlint-anti-slop.json --deny-warnings), oxlint: pass. macOS only.Review
Opus review of the diff and the fix delta. Fixed from review: every listing goes through one sequence (catalog listings could land out of order), retention is not published before the first listing, a revision assertion.
Agent skill upstream boundary
Notes
worktree.ps) are back to its 1 s lifetime for window-side renames and pins, as before feat(sidebar): sort Recent and Smart by the owning host's stamps, hold order under the pointer (dark) #30284. The phone'sworkspacesdomain reads uncached rows and is unaffected.sort-settle.ts,settled-sort-epoch.ts,smart-sort-phase.tsand create grace remain for the switch-off build.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)