feat(web): filter sessions by last activity#1083
Merged
Merged
Conversation
There was a problem hiding this comment.
Findings
- [Minor] Hard-coded calendar dates make the new UI tests time-dependent — the picker opens on
new Date()when no range is selected, while the test searches for July 2026 day buttons and usesDate.now()for the session timestamp. Once the runner date is outside that month/range, these buttons will not exist or the “recent” session will be filtered out. Evidence:web/src/components/SessionList.directory-action.test.tsx:137andweb/src/components/SessionList.directory-action.test.tsx:166.
Suggested fix:import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' describe('SessionList time filter', () => { beforeEach(() => { vi.useFakeTimers() vi.setSystemTime(new Date(2026, 6, 18, 12)) }) afterEach(() => { vi.useRealTimers() }) // existing July 2026 assertions stay deterministic })
Questions
- None.
Summary
- Review mode: initial
- One test determinism issue found. No product-code correctness, security, data-loss, or performance findings with >=80% confidence from the changed lines.
Testing
- Not run (automation; PR content was not executed).
HAPI Bot
| expect(screen.getByRole('button', { name: /Old session/ })).toBeInTheDocument() | ||
|
|
||
| fireEvent.click(screen.getByRole('button', { name: 'Filter sessions by last activity' })) | ||
| fireEvent.click(screen.getByRole('button', { name: new Date(2026, 6, 17).toLocaleDateString() })) |
There was a problem hiding this comment.
[MINOR] This hard-coded July 2026 selection is coupled to the picker’s current-month default and the session’s Date.now() timestamp. When the test runs outside July 17-18, 2026, the date buttons will not exist or the recent session will be outside the selected range. The same issue appears in the second added test’s July 2026 clicks.
Suggested fix:
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
describe('SessionList time filter', () => {
beforeEach(() => {
vi.useFakeTimers()
vi.setSystemTime(new Date(2026, 6, 18, 12))
})
afterEach(() => {
vi.useRealTimers()
})
// existing July 2026 assertions stay deterministic
})
Contributor
Author
There was a problem hiding this comment.
Fixed in 672cc71 by pinning the system clock with Vitest fake timers for the date-range UI tests. Focused tests and the web typecheck pass.
There was a problem hiding this comment.
Findings
- None.
Questions
- None.
Summary
- Review mode: follow-up after new commits
- No issues found with >=80% confidence in the latest diff. The prior test determinism finding appears addressed by the new fake-timer setup. Residual risk: date-picker keyboard behavior and mobile layout were inspected statically only.
Testing
- Not run (automation; PR content was not executed).
HAPI Bot
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a compact last-activity date-range filter to the web session list.
Motivation
Long-running HAPI installations can accumulate many sessions. Text search helps when a title or path is known, but it is less useful when the user only remembers when a session was active. The filter stays out of the way until needed and preserves the compact mobile layout.
Test plan
43 passed1281 passedtsc --noEmitbun run buildAI disclosure
Implementation and tests were assisted by OpenAI Codex (GPT-5.6).