Add Studio Query Insights#1515
Conversation
|
Compute preview deployed. Branch: |
tylerhogarth
left a comment
There was a problem hiding this comment.
FYI from a local review pass: three things I'd flag as worth a look before merge. Not blockers, just heads-up.
|
Caution Review failedFailed to post review comments Summary by CodeRabbit
WalkthroughAdds an optional Queries view powered by BFF query-insights, wires adapters and demo, updates navigation, implements polling/AI analysis, replaces Chart.js with Bklit React charts, introduces extensive chart components, adds AI SQL validation/correction, updates docs/config/scripts/tests. ChangesQueries, AI validation, and Bklit visualization
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
|
Summary
Adds Studio-owned Query Insights and moves the Console Query Insights experience into the Studio surface behind the optional adapter/BFF bridge. The new
Queriesnavigation item appears directly underVisualizeronly when the adapter providesqueryInsights; stale#view=queriesURLs fall back to the normal default view when the capability is absent.Also updates the SQL view AI flow so generated SQL is validated and corrected before it is shown, and replaces SQL result visualizations with Studio-owned Bklit chart configs/components.
Screenshots
Queries view
Query analysis details
SQL result visualization
Query Insights
Adapter.queryInsightscontract and BFFprocedure: "query-insights"snapshot bridge.#view=queries.README.md,FEATURES.md, andArchitecture/query-insights.md, including the lowest-fidelity provider Studio supports, counter semantics, traffic exclusion, sanitization, sidecar topology, and sqlcommenter metadata mapping.pnpm demo:ppgthat records successful demo BFF query executions and excludes Studio metadata/lint/introspection traffic.Query Insights UI And Data Model
Queriesview with a live activity chart, table filter/sort controls, query list, and detail sheet.1m,5m,15m, or1h.ReadsUI toRows Returnedwhile retaining reads as an internal/advisory signal.Query Insights AI Analysis
llm({ task: "query-insights", prompt })hook instead of adding a Query-specific AI transport.Analysiscolumn with queued/running state, manualAnalyze, and completedGood,Info, orWarnbadges.SQL AI Generation
sqlLintcapability before inserting it into the editor.SQL Result Visualization
bar,horizontal-bar,line,pie,doughnut, and stackedbar/horizontal-barcharts.Demo And Dependencies
@prisma/devdependency available for this branch.impeccableskill into.agents/skills/impeccableand updates repo agent guidance for future UI work.ui/components/charts.Validation
pnpm typecheckpnpm test ui/hooks/use-introspection.test.tsx ui/studio/tanstack-db-performance-architecture.test.ts ui/studio/CommandPalette.test.tsx ui/studio/Navigation.test.tsx ui/studio/Studio.test.tsx ui/studio/views/queries/QueriesView.test.tsx ui/studio/views/queries/query-insights-ai.test.ts ui/studio/views/sql/SqlView.test.tsx ui/studio/views/sql/sql-ai-generation.test.ts ui/studio/views/sql/sql-result-visualization.test.tsx data/bff/bff-client.test.ts demo/ppg-dev/query-insights.test.ts demo/ppg-dev/config.test.ts ui/components/ui/select.test.tsx -- --runpnpm buildCOREPACK_ENABLE_STRICT=0 pnpm check:exportspnpm exec eslint ui/hooks/use-introspection.test.tsx ui/studio/CommandPalette.test.tsx ui/studio/tanstack-db-performance-architecture.test.ts ui/studio/views/queries/QueriesView.tsx ui/studio/views/queries/query-insights-ai.ts ui/studio/views/sql/SqlView.tsx ui/studio/views/sql/SqlResultVisualization.tsx ui/studio/views/sql/sql-ai-generation.ts ui/studio/views/sql/sql-result-visualization.ts data/bff/bff-client.ts demo/ppg-dev/query-insights.ts demo/ppg-dev/server.ts ui/studio/Navigation.tsx ui/studio/Studio.tsx ui/components/ui/select.tsxhttp://localhost:4310/#view=queriesandhttp://localhost:4310/#view=sqlNote: a full
pnpm test -- --runpass printed all test-file success lines after the test-harness fixes, but Vitest retained a worker process and did not return to the shell. The focused regression suite above exits cleanly.