feat(admin): annotation filters and sorts on session list#158
Conversation
WalkthroughSession summaries now include annotation recency and active counts. Admin users can filter annotated sessions, sort by annotation metadata, and see active annotation counts in session rows. ChangesAnnotated session administration
Sequence Diagram(s)sequenceDiagram
participant AdminSessionFilters
participant AdminPanel
participant filterAdminSessions
participant AdminSessionRow
AdminSessionFilters->>AdminPanel: toggle annotatedOnly or choose annotation sort
AdminPanel->>filterAdminSessions: apply annotation filter and sort
filterAdminSessions-->>AdminPanel: return ordered session summaries
AdminPanel->>AdminSessionRow: render session summary
AdminSessionRow-->>AdminPanel: display active annotation count
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
35215ab to
24dc16b
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/domain/admin/adminSessionFilters.test.ts`:
- Around line 114-123: Extend the admin session filter tests around
filterAdminSessions to cover lastAnnotation sorting with annotatedOnly disabled,
preserving the existing sort configuration and asserting session IDs in the
order many, few, none so the null lastAnnotationAt case is exercised.
In `@src/routes/AdminPanel.test.tsx`:
- Around line 126-127: Add a behavior-focused route test in AdminPanel.test.tsx
using sessions with both annotated and unannotated values, then click the
Annotated filter and assert only annotated sessions remain along with a visible
positive “N ann” count. Update the related fixtures currently using null/zero
annotation fields so the test exercises the annotation UI filtering and count
paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ff71ac8b-895b-46b1-a2a5-a9dd1ab552cb
📒 Files selected for processing (9)
functions/admin/listActiveSessions.mjssrc/components/admin/AdminSessionFilters.tsxsrc/components/admin/AdminSessionRow.tsxsrc/domain/admin/adminSessionFilters.test.tssrc/domain/admin/adminSessionFilters.tssrc/routes/AdminPanel.test.tsxsrc/routes/AdminPanel.tsxsrc/services/admin/adminSessions.test.tssrc/services/admin/adminSessions.ts
| expect( | ||
| filterAdminSessions(sessions, { | ||
| query: "", | ||
| liveOnly: false, | ||
| annotatedOnly: true, | ||
| mode: "all", | ||
| state: null, | ||
| sort: "lastAnnotation", | ||
| }).map((entry) => entry.sessionId), | ||
| ).toEqual(["many", "few"]); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Cover lastAnnotation sorting when the timestamp is missing.
annotatedOnly: true removes none before sorting, so the lastAnnotationAt: null branch is untested. Add an unfiltered assertion expecting many, few, then none.
As per path instructions, **/*.test.{ts,tsx} requires edge cases for new logic.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/domain/admin/adminSessionFilters.test.ts` around lines 114 - 123, Extend
the admin session filter tests around filterAdminSessions to cover
lastAnnotation sorting with annotatedOnly disabled, preserving the existing sort
configuration and asserting session IDs in the order many, few, none so the null
lastAnnotationAt case is exercised.
Source: Path instructions
| lastAnnotationAt: null, | ||
| activeAnnotationCount: 0, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Exercise the annotation UI behavior.
These fixtures only use null/zero annotation values. Add a route test with annotated and unannotated sessions that clicks Annotated and verifies filtering plus a visible positive N ann count.
As per path instructions, **/*.test.{ts,tsx} requires behavior-focused assertions on changed code paths.
Also applies to: 169-170, 228-229, 271-272
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/routes/AdminPanel.test.tsx` around lines 126 - 127, Add a
behavior-focused route test in AdminPanel.test.tsx using sessions with both
annotated and unannotated values, then click the Annotated filter and assert
only annotated sessions remain along with a visible positive “N ann” count.
Update the related fixtures currently using null/zero annotation fields so the
test exercises the annotation UI filtering and count paths.
Source: Path instructions
Summary
lastAnnotationAtandactiveAnnotationCounttolistActiveSessionssummaries.· N ann.Test plan
npm test -- src/domain/admin/adminSessionFilters.test.tsnpm run typecheckSummary by CodeRabbit
New Features
Tests