I have analyzed the codebase and the confusion stems from filter being overloaded to represent both the "View Mode" (Highlights vs. Everything) and specific "Content Filters" (e.g., user_message).
Here is the plan to resolve this by splitting the state into two explicit concepts:
Plan: Split View Mode & Content Filters
1. Refactor frontend/app/s/[id]/page.tsx
- Remove the confusing
rawFilter / rawFilters / filter variables.
- Add unified state parsing:
viewMode: Derived as "highlights" if the "highlights" filter is present, otherwise "all".
activeFilters: A list of all other selected filters (excluding "highlights").
- Update
createFilterLink and updateFilter to handle these two states cleanly (toggling "highlights" mode vs. toggling specific filters).
- Remove dead code (e.g.,
toggleFilter is passed to pills but unused).
2. Update Component Interfaces
TraceOverview.tsx: Rename filter prop to viewMode.
TraceFilterToggle.tsx: Rename filter prop to viewMode and simplify logic to check viewMode === "highlights".
TraceFilterPills.tsx: Rename filter prop to viewMode to clarify it checks the global view state.
Outcome
This makes the code self-documenting: viewMode tells you if you are seeing the "Highlights" preset, and activeFilters tells you which specific content types are selected when in "Everything" mode.
Shall I proceed with these changes?