Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Add LIFO sorting option for hunks in the Review panel based on when each hunk's content was first observed. This makes the review panel reflect the order of edit events in the chat, showing the most recently edited hunks first.

Changes

  • New hook: useHunkFirstSeen - Tracks first-seen timestamps per hunk ID (content address) with LRU eviction
  • ReviewControls: Added sort dropdown with options "File order" (default) and "Last edit"
  • HunkViewer: Displays relative timestamps in hunk headers (e.g., "5 minutes ago") with tooltip showing full timestamp
  • ReviewPanel: Integrates sorting logic and first-seen tracking
  • Storybook: Added stories for both sort modes (ReviewTabSortByLastEdit, ReviewTabSortByFileOrder)

How it works

  1. The hunk ID already serves as a content address (hash of path + line range + content)
  2. When hunks are loaded, we record the first time we see each ID
  3. Sorting by "Last edit" orders hunks by first-seen timestamp (newest first = LIFO)
  4. Sort preference persists globally via localStorage
  5. New hunks without first-seen data default to Date.now() for backwards compatibility

Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

@ammar-agent ammar-agent force-pushed the review-panel-tw2j branch 2 times, most recently from 9bf2bbd to f6c3392 Compare December 26, 2025 16:50
Add LIFO sorting option for hunks in the Review panel based on when
each hunk's content was first observed. This makes the review panel
reflect the order of edit events in the chat.

Changes:
- Add useHunkFirstSeen hook to track first-seen timestamps per hunk ID
- Add sort dropdown to ReviewControls (File order / Last edit)
- Display relative timestamps in hunk headers (e.g., '5 minutes ago')
- Persist sort preference globally via localStorage
- Add storybook stories for both sort modes

The hunk ID already serves as a content address (hash of path + lines +
content), so we track first-seen time per ID. New hunks default to now
for backwards compatibility.
@ammario ammario merged commit 638cf4a into main Dec 26, 2025
20 checks passed
@ammario ammario deleted the review-panel-tw2j branch December 26, 2025 18:14
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.

2 participants