Skip to content

feat(prompts): Query Fan-out — By prompt grouped view with expandable… - #358

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
d180:feature/fanout-by-prompt
Jul 8, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
d180:feature/fanout-by-prompt

Conversation

@d180

@d180 d180 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

On the Prompts page → Query Fan-out tab, the view showed a single flat list of sub-queries with no way to see which tracked prompts drove the most fan-out. Added a By prompt toggle that pivots the same data — one collapsible row per prompt, expanding to reveal the sub-queries that prompt's answers actually triggered. The "High frequency" flat list is unchanged; the two lenses share the tab via a segmented toggle.

Data is derived client-side by inverting the existing sourcedPrompts array on each FanoutSubQuery — no new server action or DB columns required.

Also adds fan-out seed data to supabase/seed.sql so the tab is populated on a local db reset.

Related issue

Closes #350

Type of change

  • feat — New feature

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really clean work — the shared components (TrackCell / EngineBadges / IntentBadge), the useMemo inversion for the By prompt view, the expandable rows, keeping the pagination + setPage(1), and the seed.sql fan-out data all look great. 🎉

One fix before merge: in ByPromptView, groups.map(...) returns a bare <> fragment with no key, which triggers React's "unique key" warning (the inner TableRow keys don't satisfy the map's root element). Please switch it to <Fragment key={prompt.id}>…</Fragment> (import Fragment from react).

Everything else LGTM — ping me once that's in and I'll re-review.

Heads-up on sequencing: this touches _fanout-tab.tsx (same as PR #357, still open), so whichever merges second will need a small rebase.

@d180
d180 force-pushed the feature/fanout-by-prompt branch from 541fe7b to 38f3dd3 Compare July 7, 2026 19:41
@d180

d180 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @gkhngyk , I've rebased the branch on top of main and resolved the conflicts. Also applied the fix you suggested — replaced <> with in ByPromptView's groups.map() so the key is now on the root element. Please review and let me know if anything needs attention!

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — the Fragment key fix is in (<Fragment key={prompt.id}>, no more React key warning). I re-ran everything in an isolated worktree: typecheck, Prettier, and the fanout tests all pass, and the rebase correctly keeps the pagination (#355), the intent column (#353), and the onTracked wiring (#357) while adding the By-prompt grouped/expandable view. Clean work — LGTM! 🎉

@gkhngyk
gkhngyk merged commit b270081 into ansvisor:main Jul 8, 2026
3 checks passed
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.

feat(prompts): "Query Fanouts by Prompts" — group the fan-out by prompt with expandable rows

2 participants