Extract independent web cleanup from mobile stack#2855
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
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)
Comment |
Co-authored-by: codex <codex@users.noreply.github.com>
ApprovabilityVerdict: Approved Low-risk cleanup PR containing mechanical performance optimizations (Array.includes → Set.has), minor responsive CSS tweaks, and small bug fixes with accompanying tests. All changes are self-contained with clear intent. You can customize Macroscope's approvability policy. Learn more. |
Summary
Validation
bun fmtbun lint(passes with existing warnings)bun typecheckbun run test --filter=@t3tools/web --filter=@t3tools/sharedStack
mainNote
Fix thread sorting, LRU cache, and context window snapshot handling in web app
deriveLatestContextWindowSnapshotin contextWindow.ts now acceptsusedTokens === 0as valid instead of skipping it.LRUCache.setin lruCache.ts rejects entries whose size exceeds the memory budget, preserving any existing entry for that key.createdAtorupdatedAtis invalid.ChatHeaderin ChatHeader.tsx is made responsive, wrapping and truncating on small screens.Array.includesmembership checks are replaced withSet.hasin ChatView.tsx and OpenInPicker.tsx.Macroscope summarized 3ca1460.
Note
Low Risk
Targeted client-side logic and styling with added unit tests; no auth, API, or protocol changes.
Overview
This PR pulls web-only correctness and polish out of a larger mobile stack: behavior fixes, small performance tweaks, and responsive UI adjustments—without platform/runtime protocol work.
Data & sorting:
deriveLatestContextWindowSnapshotnow acceptsusedTokens === 0so empty usage still shows in the composer.LRUCache.setskips entries larger than the memory budget and leaves existing keys intact on oversized updates.sortThreads/getThreadSortTimestampusegetFirstSortableTimestampso invalid ISO dates fall back (created_at→updatedAt, and the reverse where needed).State & attachments:
uiStateStorededupes persisted project order and per-logical-key cwd lists with **Set**s.handoffAttachmentPreviewsandOpenInPickeruseSetmembership instead ofArray.includes.UI:
ChatHeaderstacks on narrow viewports (title, badge, actions). Sidebar thread rows are slightly shorter on mobile; remote cloud icon and thread list padding are toned down.Tests: New coverage for zero-usage context snapshots, LRU oversized entries, thread sort fallbacks, and stable trace file ordering in shared observability tests.
Reviewed by Cursor Bugbot for commit 3ca1460. Bugbot is set up for automated code reviews on this repo. Configure here.