Skip to content

fix: make the full activity history queryable (server-side pagination) - #82

Merged
DominikPinsel merged 2 commits into
mainfrom
fix/activity-pagination
Aug 10, 2026
Merged

fix: make the full activity history queryable (server-side pagination)#82
DominikPinsel merged 2 commits into
mainfrom
fix/activity-pagination

Conversation

@DominikPinsel

Copy link
Copy Markdown
Owner

Problem

The Activity page (/activity) fetched only the 100 most recent events and paginated/fitered them client-side. Anything older than the newest 100 events was unreachable — ?page=5 etc. only scrolled within the same 100-row window, and the API's total was just the page length.

Changes

Hub (GET /api/v1/events)

  • New offset parameter alongside limit (capped at 500 per page), with stable (received_at DESC, id DESC) ordering so pages don't shift on timestamp ties.
  • total now reports the number of all events matching the filters.
  • New server-side filters: status (matched / unmatched / error, derived from agent_tasks) and agent; existing connector/since unchanged.
  • Store: QueryEvents/CountEvents with a shared EventFilter; RecentEvents kept as a thin wrapper (other callers unchanged).

Frontend (Activity page)

  • Server-driven pagination: each page is fetched with limit/offset; the pager is driven by the server total, so the entire history is reachable.
  • Status/connector/agent filters are sent to the API and thus apply across the whole history. Outcome and free-text search remain page-local (they depend on in-memory invocation state and resolved display names).
  • Pager collapses long page ranges into first / window-around-current / last instead of rendering one button per page.

Testing

  • New hub tests (testcontainers): pagination across pages, filtered totals, status/agent filters, invalid offset/status → 400. Full internal/api + internal/eventqueue suites pass.
  • Frontend: activity tests updated to a server-simulating fetch mock; new tests for offset navigation, pager windowing, and listEventsPage. All 585 frontend tests pass; tsc -b and eslint --max-warnings=0 clean.

Note

The deployment at /ainsel-dev needs the hub-backend and frontend images rebuilt from main after merge to take effect.

The activity UI could only ever see the most recent events because
GET /api/v1/events had no way to page beyond the limit window and
reported the page length as total. Add limit/offset pagination with a
stable (received_at, id) ordering, a matching event count, and
server-side status/agent filters next to the existing connector filter,
so the full event history becomes queryable.
The activity page fetched only the 100 most recent events and paginated
them client-side, so anything older was unreachable. Request one page at
a time via limit/offset instead, drive the pager from the server-reported
total, and move the status/connector/agent filters to the API so they
apply across the whole history (outcome and free-text search stay
page-local, as they depend on invocation state and resolved names).

Also collapse the pager into a window around the current page for long
page ranges instead of rendering one button per page.
@DominikPinsel
DominikPinsel merged commit b720605 into main Aug 10, 2026
5 checks passed
@DominikPinsel
DominikPinsel deleted the fix/activity-pagination branch August 10, 2026 22:45
DominikPinsel added a commit that referenced this pull request Aug 12, 2026
Resolve merge conflicts by integrating the PR's SubjectFilter feature into
main's new EventFilter/QueryEvents/CountEvents architecture (PR #82):

- store.go: keep SubjectFilter/ParseSubjectFilter/Matches from the PR;
  add Subject field to EventFilter; apply subject filter in conditions()
  so both QueryEvents and RecentEvents honor it; RecentEvents keeps its
  5-param signature and delegates to QueryEvents with the Subject set.
- handlers_events.go: use main's QueryEvents with EventFilter (the
  listEvents endpoint does not use subject filtering).
- handlers_eventqueue.go: auto-merged, calls the 5-param RecentEvents.
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.

1 participant