Skip to content

feat: share thread sort options across clients - #12895

Open
Dwite wants to merge 2 commits into
pingdotgg:mainfrom
Dwite:t3code/thread-sort-options
Open

Dwite wants to merge 2 commits into
pingdotgg:mainfrom
Dwite:t3code/thread-sort-options

Conversation

@Dwite

@Dwite Dwite commented Sep 21, 2026

Copy link
Copy Markdown

The new sidebar removed the choice to sort active threads by recent messages. This restores that choice while keeping the configured arrangement as the default.

Adds Configured order / Last message to the web/desktop sidebar and the iOS/Android thread list options, including the tablet sidebar and older iOS toolbar. Last message uses the latest user message, with creation time as the fallback. The environment persists and broadcasts the choice to its clients. Changes fan out to connected environments that advertise support, and older servers are gated by a capability. Switching back restores saved arrangement keys; dragging into active positions is disabled while message sorting is selected. Pinned, snoozed, settled, and legacy-list ordering stay unchanged. Active move actions are disabled while sorting by message; switching back preserves the saved arrangement.

Validation: 491 focused sorting/settings tests passed, including persistence and broadcasts to two subscribers; web, mobile, contracts, and client-runtime typechecks passed; targeted lint completed with existing warnings. Browser verification on isolated fixture data confirmed message sorting, persistence, and live updates between two clients in both directions. All clients use shared sorting logic and existing thread summaries. The server settings stream carries the preference across local and remote clients. Native iPhone 16 Pro (iOS 18.5) and Pixel 9 Pro (Android 16) builds and verification passed. Android changes were observed live on iOS and web; iOS changes were observed on web. The tablet sidebar and newer iOS toolbar were typechecked but not separately exercised on a device. Desktop packaging and remote/relay paths were not separately exercised.

Before Last message
Before: configured sidebar without sort control After: last-message ordering and sort menu

Configured order restored

Native client Configured order Last message
iOS iOS configured order iOS last-message order and menu
Android Android configured order Android last-message order

Native recordings (2x playback): iOS · Android.

Model: GPT-6. Harness: Codex.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 21, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a persisted, user-facing active-thread sorting mode and changes when active drag reordering is available. The default behavior remains configured order, but the production sidebar and shared settings contract now carry new capability and state, warranting human review.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: fe1bd307-1c6f-4a86-9821-443485ea1cca

📥 Commits

Reviewing files that changed from the base of the PR and between 59b0201 and d00906d.

📒 Files selected for processing (22)
  • apps/mobile/src/features/home/HomeHeader.android.tsx
  • apps/mobile/src/features/home/HomeHeader.tsx
  • apps/mobile/src/features/home/HomeScreen.tsx
  • apps/mobile/src/features/home/home-list-filter-menu.ts
  • apps/mobile/src/features/home/useThreadListActions.ts
  • apps/mobile/src/features/threads/ThreadArrangementSheet.tsx
  • apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
  • apps/mobile/src/features/threads/threadListV2.test.ts
  • apps/mobile/src/features/threads/threadListV2.ts
  • apps/mobile/src/features/threads/use-active-thread-sort.ts
  • apps/server/src/environment/ServerEnvironment.ts
  • apps/server/src/serverSettings.test.ts
  • apps/web/src/components/Sidebar.logic.ts
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/hooks/useActiveThreadSort.ts
  • docs/user/thread-sidebar.md
  • packages/client-runtime/src/state/sharedSettings.test.ts
  • packages/client-runtime/src/state/sharedSettings.ts
  • packages/client-runtime/src/state/threadSort.ts
  • packages/contracts/src/environment.ts
  • packages/contracts/src/settings.test.ts
  • packages/contracts/src/settings.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/user/thread-sidebar.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a server-backed active-thread sort preference with manual and last_message modes. Shared settings, sorting logic, web controls, mobile controls, reorder eligibility, tests, and documentation now support the preference.

Changes

Active thread sorting

Layer / File(s) Summary
Sort preference contract and synchronization
packages/contracts/..., packages/client-runtime/src/state/sharedSettings.*, apps/server/...
Defines the sort values, stores the preference in server settings, filters it by capability, resolves shared values, and tests persistence and broadcasts.
Active-thread sorting behavior
packages/client-runtime/src/state/threadSort.ts, apps/web/src/components/Sidebar.logic.ts, apps/mobile/src/features/threads/threadListV2.ts, .../*test.ts
Centralizes manual and last-message sorting. Invalid message timestamps fall back to createdAt. Saved activeOrderKey values remain unchanged.
Mobile sort controls and reorder gating
apps/mobile/src/features/home/*, apps/mobile/src/features/threads/*
Adds the shared sort hook and menus. Passes the selected order through Thread List v2. Active-section reordering remains available only in manual mode.
Web sort controls and sidebar integration
apps/web/src/components/Sidebar.tsx, apps/web/src/hooks/useActiveThreadSort.ts, apps/web/src/components/sidebar/SidebarThreadHeader.tsx, docs/user/thread-sidebar.md
Adds the web sort menu and persisted updates. Clears optimistic drag state when the order changes. Documents cross-client preference sharing.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Sidebar
  participant useActiveThreadSort
  participant ServerSettings
  participant sortActiveThreads
  User->>Sidebar: select active-thread sort
  Sidebar->>useActiveThreadSort: setOrder
  useActiveThreadSort->>ServerSettings: update activeThreadSortOrder
  ServerSettings-->>useActiveThreadSort: shared setting update
  Sidebar->>sortActiveThreads: sort active threads
  sortActiveThreads-->>Sidebar: return ordered threads
Loading

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: ⚪ Minimal · up to d0090

No actionable merge-blocking risk remains; differing environments can be aligned by selecting the preferred option.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 52.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 23 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the primary change: sharing thread sort options across clients.
Description check ✅ Passed The description explains the change, motivation, UI impact, validation, screenshots, recordings, and known testing limits. It omits the template headings and checklist, but it provides the required in…
Full details: Docstring Coverage

Explanation

Docstring coverage is 52.17% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 23 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

@Dwite Dwite changed the title feat(web): restore thread sort options feat: share thread sort options across clients Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant