Skip to content

Commit 15e6e11

Browse files
authored
Add Studio Query Insights
Add the Studio Queries view, query-insights BFF bridge support, AI analysis, and Bklit SQL result visualizations.
1 parent 6d8c31b commit 15e6e11

109 files changed

Lines changed: 14993 additions & 443 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@prisma/studio-core": minor
3+
---
4+
5+
Add an optional Studio Queries view backed by query-insights snapshots from the Studio BFF bridge.
6+
Render SQL result visualizations with Studio-owned Bklit chart configs instead of Chart.js configs.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ dist
1010
!.agents/skills/shadcn/
1111
.agents/skills/shadcn/*
1212
!.agents/skills/shadcn/SKILL.md
13+
!.agents/skills/impeccable/
14+
!.agents/skills/impeccable/**
1315
.playwright-cli/
1416
.env
1517
.env.local

Architecture/compute-preview-deploy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ publishes it into the dedicated Compute project named `studio-preview`.
4545
- If the service already exists, the helper MUST deploy a new version to that
4646
same service.
4747
- Deployments MUST use the published CLI entrypoint:
48-
`bunx @prisma/compute-cli@latest deploy --skip-build --path deploy --entrypoint bundle/server.bundle.js --http-port 8080 --env STUDIO_DEMO_PORT=8080`.
48+
- `bunx @prisma/compute-cli@latest deploy --skip-build --path deploy --entrypoint bundle/compute-entrypoint.js --http-port 8080`.
49+
- The Compute artifact MUST include `bundle/compute-entrypoint.js`, which defaults `STUDIO_DEMO_PORT` to `8080` before importing `bundle/server.bundle.js`. Preview deploys MUST NOT pass runtime environment variables through the Compute CLI while its deploy API rejects the CLI's `envVars` request key.
4950

5051
## PR Feedback
5152

Architecture/navigation-url-state.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Navigation state MUST be URL-driven and managed through `useNavigation` + Nuqs.
88

99
This architecture governs:
1010

11-
- active Studio view (`table`, `schema`, `console`, `sql`, `stream`)
11+
- active Studio view (`table`, `schema`, `console`, `sql`, `stream`, `queries`)
1212
- active schema/table/stream
1313
- active stream follow mode
1414
- active stream aggregation-panel visibility
@@ -78,6 +78,7 @@ Adding a new URL key requires updating `StateKey` in `nuqs.ts` first.
7878
- `search`: `""`
7979
- `searchScope`: `"table"` (legacy default)
8080
- `view`: `"table"`
81+
- `queries`: no standalone default; only meaningful when the current adapter provides query insights
8182
- `stream`: no default; only meaningful when `view=stream`
8283
- `streamFollow`: no global default in `useNavigation`; the active stream view MUST resolve an absent value to `tail` and materialize that into the hash
8384
- `aggregations`: no global default in `useNavigation`; the active stream view MUST treat an absent flag as closed and MUST NOT materialize that closed state into the hash
@@ -86,9 +87,10 @@ Adding a new URL key requires updating `StateKey` in `nuqs.ts` first.
8687
When Studio is running without a database connection but with Streams enabled:
8788

8889
- the resolved default `view` MUST become `"stream"` instead of `"table"`
89-
- stale database-oriented views such as `table`, `schema`, `console`, and `sql` MUST resolve back to the stream view instead of trying to render database-only UI against a disabled database session
90+
- stale database-oriented views such as `table`, `schema`, `console`, `sql`, and `queries` MUST resolve back to the stream view instead of trying to render database-only UI against a disabled database session
9091

9192
When URL params are stale from a previous DB, invalid `schema`/`table` values MUST be resolved to valid current defaults.
93+
When URL params contain `view=queries` but the current adapter does not provide query insights, `useNavigation` MUST resolve back to the default view and the sidebar MUST hide the Queries link.
9294
Shared table page size and infinite-scroll mode are not derived from URL defaults; they are restored through Studio UI state and then mirrored into query behavior by `usePagination`.
9395

9496
## Hash Adapter Contract

Architecture/non-standard-ui.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,24 @@ It deliberately excludes:
145145
- The storage breakdowns also need collapsible ledger-style accounting boxes whose headers surface the section totals when folded shut, plus faint shared-cap annotations that sit beside right-aligned byte values and one shared cap marker spanning both Routing and Exact cache rows, which is not a stock ShadCN pattern.
146146
- No stock ShadCN pattern covers that descriptor-driven observability layout, especially when the UI must distinguish logical bytes from physical storage signals, separate search coverage from historical run indexes, hide unconfigured routing rows, and keep the remaining cost caveats explicit instead of inventing unavailable totals.
147147

148+
### Queries Live Table And Detail Sheet
149+
150+
- Canonical component:
151+
- [`ui/studio/views/queries/QueriesView.tsx`](ui/studio/views/queries/QueriesView.tsx)
152+
- Closest standard ShadCN alternatives:
153+
- `Table`
154+
- `Card`
155+
- `Sheet`
156+
- `Select`
157+
- `ToggleGroup`
158+
- `Badge`
159+
- `Skeleton`
160+
- Why it stays non-standard:
161+
- Query insights need a live operational table with provider-driven polling, a live activity chart, table filtering, sort controls, row selection, and previous/next navigation inside a detail sheet.
162+
- The activity chart is a Studio-specific SVG timeline that derives throughput and latency from snapshot deltas, supports a bounded time-window switcher, and exposes point-level hover readings. No standard ShadCN chart primitive covers that observability display.
163+
- The same surface conditionally embeds AI recommendations when Studio's shared `llm` hook is available, while disappearing entirely when the embedder does not provide query-insights data.
164+
- No stock ShadCN component models that combined observability workflow, so Studio keeps a custom composite built from standard ShadCN primitives.
165+
148166
## Standardization Candidates
149167

150168
These are the current high-signal places where Studio is bypassing a plausible standard ShadCN component or composition pattern.
@@ -250,11 +268,12 @@ These are the current high-signal places where Studio is bypassing a plausible s
250268
- Files:
251269
- [`ui/studio/views/sql/SqlResultVisualization.tsx`](ui/studio/views/sql/SqlResultVisualization.tsx)
252270
- [`ui/studio/views/sql/SqlView.tsx`](ui/studio/views/sql/SqlView.tsx)
271+
- [`ui/components/charts`](ui/components/charts)
253272
- Current UI:
254-
- Borderless Chart.js canvas injected into a `DataGrid` header row, wrapped in a custom sticky white band with centered/clamped sizing, plus a custom text-and-icon visualization trigger placed on the SQL result summary line.
273+
- Bklit ShadCN chart primitives injected into a `DataGrid` header row, wrapped in a custom sticky background band with centered/clamped sizing, plus a custom text-and-icon visualization trigger placed on the SQL result summary line.
255274
- Plausible standard ShadCN alternative:
256275
- `Card`
257276
- `Button`
258-
- No standard ShadCN chart primitive exists; the chart body must remain custom.
277+
- The Bklit registry components provide the chart primitives, but the SQL result surface still needs a custom `DataGrid.getBeforeHeaderRows(...)` composition so the chart scrolls with the result grid.
259278
- Confidence:
260279
- High

0 commit comments

Comments
 (0)