Skip to content

refactor(sidebar): the stamp-sorted window list runs no settle, latch or saved order (dark) - #30401

Merged
Jinwoo-H merged 5 commits into
mainfrom
jinwoo/sidebar-stamps-window-cleanup
Oct 18, 2026
Merged

Jinwoo-H merged 5 commits into
mainfrom
jinwoo/sidebar-stamps-window-cleanup

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​89
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70 $\color{#cf222e}{\Huge{\mathbf{−}}}$​16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54

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=main only:

  • use-sort-order.ts now picks one of two hooks at build time:
    • switch on: 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.
    • switch off: 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_switch telemetry 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 lastActivityAt writes 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.ts and smart-sort-phase.ts now. 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 leaves settledSortEpoch alone (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

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Jinwoo-H and others added 3 commits October 18, 2026 14:58
… 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]>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d45f55f-01d6-4ddf-a1fb-db47524f2e95
📥 Commits

Reviewing files that changed from the base of the PR and between 446c6c5 and 7625d9a.

📒 Files selected for processing: 2
  • src/renderer/src/components/sidebar/worktree-list/listing/use-sort-order.ts
  • src/shared/sidebar-list/smart-sort.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The sort hook now selects a stamp-based implementation when main sidebar inputs are enabled and retains settled-epoch sorting otherwise. Store initialization skips settled-sort epoch installation when main inputs are enabled. New tests cover stamp-driven sorting, order-array identity after an unrelated row write, repository renames, and the absence of persistence calls for the tested updates.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 7625d

This change moves sidebar worktree sorting to a stamp-based path only when the main sidebar-inputs switch is on, and the shipped behavior is reported as unchanged. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: removing settle, latch, and saved-order behavior from the stamp-sorted sidebar path.
Description check Passed The description covers the required sections, explains the change and rationale, identifies the linked issue, documents testing and visual proof, and records review considerations. The testing scope i…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the required sections, explains the change and rationale, identifies the linked issue, documents testing and visual proof, and records review considerations. The testing scope is clearly stated as macOS only.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Jinwoo-H and others added 2 commits October 18, 2026 15:18
… 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]>
@Jinwoo-H
Jinwoo-H merged commit 63f0cb9 into main Oct 18, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant