Skip to content

feat(filter): expose branch filters in client surfaces - #974

Closed
prateek wants to merge 1 commit into
kenn-io:mainfrom
prateek:split-branch-filter-surfaces
Closed

feat(filter): expose branch filters in client surfaces#974
prateek wants to merge 1 commit into
kenn-io:mainfrom
prateek:split-branch-filter-surfaces

Conversation

@prateek

@prateek prateek commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Adds branch filtering to the session-browsing surfaces. The CLI accepts --branch on session list, session search, and activity report; each requires --project because branch names are project-scoped. MCP tools accept the same human inputs: a plain project plus a plain git_branch. Both surfaces encode the internal (project, branch) token at the edge, so callers never need to see or construct token separators.

On the web, the shared sidebar filter gets a Branch section with multi-select, client-side search, selected branches floated to the top, removable chips, a numeric active-filter badge, and URL round-trip. The same selection flows into Analytics and usage filtering.

Sidebar Branch filter: selection floated to top, count badge, and the Analytics dashboard filtered by that branch (synthetic data)

Branch metadata now sorts by most recent session activity in SQLite, PostgreSQL, and DuckDB, with project and branch tiebreakers for deterministic lists. cmd/testfixture seeds synthetic branch data so screenshots and e2e fixtures exercise the branch surfaces.

Known limitation: branch filters still travel as an uncapped token list, matching the existing CSV-style filters rather than adding a separate cap in this PR.

Part of #928; parallel to the activity-rollups and usage-grouping PRs.

@roborev-ci

roborev-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (1d0d16d)

Summary: Branch filtering is partially wired; URL round-tripping and analytics behavior have medium-severity gaps.

Medium

  • Location: frontend/src/lib/stores/sessionRouteParams.ts:6 (also frontend/src/lib/stores/router.svelte.ts:72, frontend/src/lib/components/usage/UsagePage.svelte:174)

    • Problem: filtersToParams now emits git_branch, but the URL allowlists still omit it. Branch-only deep links are ignored, branch-only filter changes may be considered equal and skipped from URL writes, session links can drop the branch param, and Usage page URL init filters it out.
    • Fix: Add git_branch to the shared session filter/route param sets and UsagePage’s supported session param set, with URL round-trip tests.
  • Location: frontend/src/lib/components/filters/SessionFilterControl.svelte:396

    • Problem: The shared filter dropdown now exposes Branch on the Analytics page, but AnalyticsStore never syncs sessions.filters.branch or sends gitBranch in analytics requests. Selecting a branch appears active in the filter UI while analytics results remain unfiltered.
    • Fix: Wire branch through Analytics store/page/active filters and include gitBranch in analytics params, or hide the branch section for analytics until supported.

Reviewers: 2 done | Synthesis: codex, 9s | Total: 10m17s

@prateek
prateek force-pushed the split-branch-filter-surfaces branch from 1d0d16d to 9cb8887 Compare July 3, 2026 07:29
@roborev-ci

roborev-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (9cb8887)

Summary verdict: No Medium, High, or Critical findings to report.

Both reported findings are Low severity, so they are omitted per the requested threshold.


Reviewers: 2 done | Synthesis: codex, 4s | Total: 6m33s

@prateek prateek changed the title feat(filter): expose branch filters in clients feat(filter): expose branch filters in client surfaces Jul 3, 2026
@prateek
prateek force-pushed the split-branch-filter-surfaces branch from 9cb8887 to e6138c3 Compare July 3, 2026 07:58
@prateek

prateek commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the automated review findings: git_branch was missing from the session-param allowlists in sessionRouteParams.ts, router.svelte.ts, and UsagePage.svelte, so a shared URL with a branch filter would drop it on load — all three now include it, with an allowlist test. Also reworded the git_branch row in docs/session-api.md to document the opaque token format (the CLI --branch flag encodes it for you).

@roborev-ci

roborev-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (e6138c3)

Reviewed branch-filter changes: no Medium, High, or Critical findings to report.

Only one Low-severity documentation issue was reported, so it is omitted per the requested threshold.


Reviewers: 2 done | Synthesis: codex, 7s | Total: 10m58s

@prateek
prateek marked this pull request as ready for review July 3, 2026 08:21
@wesm

wesm commented Jul 3, 2026

Copy link
Copy Markdown
Member

I'll take a closer look at this. My agentsview archive has thousands of branches so this selector has a lot higher cardinality than any of the other selectors in the project at this point

Exposes the scoped (project, branch) filter everywhere sessions are
browsed: --branch flags on session list, session search, and activity
report (rejected without --project, since a branch name only identifies
work within a project); git_branch parameters on the MCP tools; and a
Branch section in the web sidebar filter with multi-select, search,
selected entries floated to the top, removable chips, a numeric
active-filter badge on the filter button, and URL round-trip. The
sidebar selection also drives the Analytics dashboard, and the usage
endpoints receive the same session-scoped branch filter.

Branch filters travel as opaque (project, branch) tokens because the
shared filter field carries multiple pairs and project or branch names
can contain commas; CLI and MCP accept two plain parameters and encode
internally, so callers never see the token format. Branch metadata is
ordered by most recent session activity so pickers surface current
work first, and cmd/testfixture seeds git branches so e2e suites and
screenshots exercise the branch surfaces with synthetic data.
@wesm
wesm force-pushed the split-branch-filter-surfaces branch from e6138c3 to d344518 Compare July 4, 2026 01:25
@roborev-ci

roborev-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (d344518)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 11m27s

@wesm

wesm commented Jul 4, 2026

Copy link
Copy Markdown
Member

Took a closer look. In my agentsview database I have 1066 branches — we don't want to stuff this much data into the DOM for the branch selector control on page render so we will need to do some virtualization work cc @mariusvniekerk

@wesm

wesm commented Jul 7, 2026

Copy link
Copy Markdown
Member

superseded by #1017

@wesm wesm closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants