Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
4d0842f to
dc8fed5
Compare
|
Useful feature for threads, since they can’t normally be sorted. This way, you can pin them in a project and move important stuff above. |
|
++ |
- add `pinned` to orchestration contracts, projector, and projection persistence (with migration) - support `thread.meta.update` pin toggles via sidebar context menu and `mod+shift+p` - sort sidebar threads with pinned items first and show a pin indicator
Remove mod+shift+p keybinding for thread.togglePinned from contracts, server defaults, and web handler. Pinning remains available via the sidebar context menu.
Use ProjectionThread.mapFields(Struct.assign(...)) for the DB row schema instead of manually duplicating every field, matching the pattern used elsewhere in the codebase.
fc69425 to
7311ae8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| if (byDate !== 0) return byDate; | ||
| return right.id.localeCompare(left.id); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Duplicate sortThreadsForSidebar function prevents pinned sorting
High Severity
A new sortThreadsForSidebar function (line 65) was added to handle pinned-thread sorting, but the existing sortThreadsForSidebar function (line 284) was not removed or merged. This creates two exported functions with the same name, which is a duplicate function implementation error. Additionally, the new SidebarThreadSortInput type on line 20 duplicates the existing type on line 18. The callers in Sidebar.tsx invoke sortThreadsForSidebar with a sortOrder argument that the new function doesn't accept. Pinned-thread sorting needs to be integrated into the existing function rather than added as a conflicting duplicate.
Additional Locations (1)
There was a problem hiding this comment.
🔴 Critical
t3code/apps/web/src/components/Sidebar.tsx
Line 100 in 7311ae8
sortThreadsForSidebar is imported twice at lines 100 and 103 in the same import statement, which causes a compile-time error: "Identifier 'sortThreadsForSidebar' has already been declared." Remove the duplicate import.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/components/Sidebar.tsx around line 100:
`sortThreadsForSidebar` is imported twice at lines 100 and 103 in the same import statement, which causes a compile-time error: "Identifier 'sortThreadsForSidebar' has already been declared." Remove the duplicate import.
Evidence trail:
apps/web/src/components/Sidebar.tsx lines 91-104 at REVIEWED_COMMIT - import statement shows sortThreadsForSidebar at line 100 and again at line 103


What Changed
Closes #698
Why
My workflow means that I am often creating lots of small threads, with potentially one larger thread running in the background in case I need to make changes with the full context of the plan. This larger thread was often getting buried by the smaller threads. This thread is also often where I would have my terminal running in dev mode, which would be tricky to find sometimes to cancel it.
UI Changes
Checklist
Note
Add thread pinning to sidebar with persistence across server and client
pinnedboolean field to theThreadtype,OrchestrationThreadschema, andprojection_threadsDB table (via a new migration).thread.meta.updatecommand; pinned threads show a pin icon and are sorted to the top of the list via a newsortThreadsForSidebarutil.pinned: falseon newthread.createdevents and forwards thepinnedfield onthread.meta-updatedevents when provided by the command.pinnedstate; the client store syncs it from the server snapshot.projection_threadsgetpinned = 0(false) via the migration default, and historicalthread.createdevent payloads decode withpinned: falseby default.📊 Macroscope summarized 7311ae8. 25 files reviewed, 2 issues evaluated, 1 issue filtered, 1 comment posted
🗂️ Filtered Issues
apps/server/src/orchestration/Layers/ProjectionPipeline.ts — 0 comments posted, 1 evaluated, 1 filtered
thread.createdcase (line 423),event.payload.pinnedis directly assigned without a fallback default. If this code replays events from the event store that were created before thepinnedfield was added to the event schema,event.payload.pinnedwill beundefined. SinceProjectionThread.pinnedis defined asSchema.Boolean(not nullable/optional), this would cause a schema validation failure duringprojectionThreadRepository.upsert(). Thethread.meta-updatedcase at line 446 correctly handles this with a conditional spread...(event.payload.pinned !== undefined ? { pinned: event.payload.pinned } : {}), but thethread.createdcase should similarly provide a default value likepinned: event.payload.pinned ?? false. [ Failed validation ]Note
Medium Risk
Adds a new persisted
pinnedfield to threads across contracts, event projection, and the DB, plus UI behavior changes in the sidebar; schema/migration and sorting logic changes carry moderate risk of data/UX regressions.Overview
Adds thread pinning end-to-end by introducing a
pinnedboolean on threads (defaulting tofalsefor backward compatibility) and allowing it to be updated viathread.meta.update/thread.meta-updated.Persists pin state in the server projection layer by adding a
pinnedcolumn toprojection_threads(new migration) and wiringpinnedthrough the decider, projector, projection pipeline, snapshot hydration, and projection thread repository.Updates the web sidebar to display a pin icon for pinned threads, add a context-menu action to pin/unpin (dispatching
thread.meta.update), and sort threads so pinned threads appear first; state syncing now hydratespinnedfrom the server read model, with tests updated/added accordingly.Written by Cursor Bugbot for commit 7311ae8. This will update automatically on new commits. Configure here.