Repository navigation
refactor(sidebar): the stamp-sorted window list runs no settle, latch or saved order (dark) - #30401
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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
… 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]>
ELI5
In the new sidebar build (still switched off for everyone), the window sorts Recent and Smart by notes the owning computer writes on each workspace. The window still carried its old machinery for guessing an order: a 3 second "settle" timer, a "Smart is now live" latch, saving its Smart order back to disk, and a five minute grace for new workspaces. With the switch on none of it was used any more. This PR stops running it there. The build people use is unchanged.
What Changed
Behind the build switch
ORCA_SIDEBAR_INPUTS=mainonly:use-sort-order.tsnow picks one of two hooks at build time:useStampSidebarWorktreeSortOrder, a pure read of the rows' stamps that re-sorts when the rows, repo labels or sort mode change. No settled epoch, no latch, no saved Smart order writes, no Smart class telemetry over the old attention map, no clock and no live terminal sources.useSettledSidebarWorktreeSortOrder, the existing hook, unchanged (minus a selector that already returned a constant with the switch off).store/index.ts: the settled-sort-epoch store listener (and its timer) is not installed with the switch on.smart_to_recent_switchtelemetry is kept in both through a small shared hook.Create grace and the comparator's clock were already unread on the switch-on path (#30284), and the window's own
lastActivityAtwrites were already gated there.Why
Plan step 3 of the sort-stamps note: once the window sorts by stamps, the timer-based pieces only cost work and risk (a store listener on every write, a timer, order saves). Keeping them on the switch-off path leaves today's build byte-identical until the switch flips, when the off path and these files can be deleted.
Alternative considered: deleting
sort-settle.ts,settled-sort-epoch.tsandsmart-sort-phase.tsnow. Not possible while the switch-off build still uses them.Linked Issue
Follow-up to #30284 (sidebar sort stamps plan, PR 3).
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
New
use-sort-order-stamps.test.tsx(switch mocked on): a new tier re-sorts at once; a sort-epoch bump with a new row leavessettledSortEpochalone (fails with the old store wiring, positive control run); no order save; an unrelated row write keeps the same order array; a repo rename re-sorts in Repo mode.Sidebar renderer suite (374 files) incl. both golden suites: switch-off and switch-on goldens unchanged (no golden file in the diff).
e2e on a switch-on build, hidden window: sort-stamps order, sort-stamps, workspace-rows (shadow check clean), creation registry, recent sort, manual sort: pass.
pnpm tc,check:code-quality:changed, anti-slop lint (config/oxlint-anti-slop.json --deny-warnings), oxlint, focus-read ratchet: pass. macOS only.Review
Opus review of the diff and the fix delta. Fixed from review: the stamp hook reads a frozen empty sources constant instead of the live store; the no-save assertion mocks the real save module; identity-reuse and repo-rename cases.
Agent skill upstream boundary
Notes
smart_sort_class_1_promotionandsmart_sort_class_distributiondo not fire (true since feat(sidebar): sort Recent and Smart by the owning host's stamps, hold order under the pointer (dark) #30284). A stamp-tier distribution could replace them when the switch flips.sortEpoch,sortOrderEpoch) are still bumped by slices; they cost a store write and trigger no re-sort.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)