You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add local Streams development support and stream browser improvements (#1478)
* Add local Streams development wiring
* Add stream aggregation rollup panel
* Expand stream diagnostics, search, and demo runtime support
* Stabilize stream polling and search progress
* Add resizable Studio sidebar
* Unify sidebar stream filtering and refresh
* Add routing key browsing to stream view
* fix(table): preserve page index when staging edits
Avoid resetting pagination when row-search apply receives the current term.
Adds regression tests for unchanged and changed row-search applies.
* feat: improve WAL history and stream diagnostics
* chore: update Prisma dev runtime to latest published build
* chore: add release changeset
Expand Prisma Streams support across Studio with a dedicated stream browser, live stream aggregations, stream diagnostics, routing-key browsing, WAL history handoff from tables, and a more flexible demo/runtime setup for local and external Streams servers.
Copy file name to clipboardExpand all lines: Architecture/demo-compute-bundling.md
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,12 @@ The `demo/ppg-dev` server has two runtime modes:
6
6
7
7
- local development mode, where it rebuilds browser assets from source and watches the repo
8
8
- deploy mode, where it serves prebuilt browser assets from a bundled artifact
9
+
- external data-source mode, where the demo keeps serving the Studio shell locally but proxies Streams to a caller-provided upstream server and runs direct TCP queries against a caller-provided PostgreSQL connection string instead of starting local Prisma Dev
9
10
10
11
The deploy path exists because the demo server is not just a Bun server entrypoint. In development it expects the Studio repo checkout so it can rebuild `client.tsx` and `ui/index.css` at runtime.
11
12
13
+
Bundled deploy mode uses the embedded local Prisma Streams runtime exactly as published by `@prisma/streams-local`, so Studio does not carry a second demo-local memory autotune layer on top of Streams' own defaults.
14
+
12
15
## Build Responsibilities
13
16
14
17
`demo/ppg-dev/build-compute.ts` is the production packager for the demo.
@@ -55,3 +58,54 @@ This is an explicit exception to the "no manual runtime asset copying" rule abov
55
58
- If the import fails, the server falls back to local development mode.
56
59
57
60
That keeps one server implementation for both workflows without adding a separate production-only server entrypoint.
61
+
62
+
## Local Development Shutdown
63
+
64
+
In local development mode, `demo/ppg-dev/server.ts` also owns the lifecycle of the Prisma Dev child runtime, including the local Prisma Streams server.
65
+
66
+
- The first shutdown signal MUST start orderly cleanup for the Bun HTTP server, Prisma Dev runtime, Postgres client, and file watchers.
67
+
- If cleanup stalls, a repeated shutdown signal MUST force the demo process to exit instead of being ignored.
68
+
- The demo process SHOULD also force-exit after a short timeout if cleanup never finishes, so orphaned Prisma Dev and Streams listeners do not block the next `pnpm demo:ppg` run.
69
+
70
+
## External Demo Mode
71
+
72
+
The `pnpm demo:ppg` entrypoint MAY also be launched against external data sources:
Copy file name to clipboardExpand all lines: Architecture/navigation-url-state.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,9 @@ This architecture governs:
10
10
11
11
- active Studio view (`table`, `schema`, `console`, `sql`, `stream`)
12
12
- active schema/table/stream
13
+
- active stream follow mode
14
+
- active stream aggregation-panel visibility
15
+
- active stream aggregation range while the aggregation panel is open
13
16
- pagination URL state
14
17
- sorting URL state
15
18
- column pinning URL state
@@ -38,6 +41,9 @@ Only keys declared in [`ui/hooks/nuqs.ts`](../ui/hooks/nuqs.ts) are allowed:
38
41
-`schema`
39
42
-`table`
40
43
-`stream`
44
+
-`streamFollow`
45
+
-`aggregations`
46
+
-`streamAggregationRange`
41
47
-`filter`
42
48
-`sort`
43
49
-`pin`
@@ -48,12 +54,15 @@ Only keys declared in [`ui/hooks/nuqs.ts`](../ui/hooks/nuqs.ts) are allowed:
48
54
49
55
Notes:
50
56
51
-
-`search` is row-search term state for active table view.
57
+
-`search` is shared search term state for the active data view. In table view it drives row search, and in stream view it drives stream-event search when the selected stream advertises search capability.
52
58
-`searchScope` is legacy URL state and is not used for table-name navigation filtering.
53
59
-`pin` stores left-pinned data columns for the grid as a comma-separated list (for example `pin=id,bigint_col`).
54
60
-`pin` order is authoritative and MUST be updated when users drag-reorder pinned columns.
55
61
-`pageIndex` remains URL-backed for table navigation.
56
62
-`pageSize` remains a supported hash key for compatibility, but table rendering now takes its authoritative rows-per-page preference from `studioUiCollection.tablePageSize` in [`Architecture/ui-state.md`](ui-state.md).
63
+
-`streamFollow` stores the active stream follow mode (`paused`, `live`, or `tail`).
64
+
-`aggregations` is an open-only flag for the active stream aggregation strip; when present it MUST be serialized as a bare key with no explicit value.
65
+
-`streamAggregationRange` stores the active stream aggregation range, but MUST only be serialized while `aggregations` is present.
57
66
58
67
Adding a new URL key requires updating `StateKey` in `nuqs.ts` first.
59
68
@@ -70,6 +79,14 @@ Adding a new URL key requires updating `StateKey` in `nuqs.ts` first.
70
79
-`searchScope`: `"table"` (legacy default)
71
80
-`view`: `"table"`
72
81
-`stream`: no default; only meaningful when `view=stream`
82
+
-`streamFollow`: no global default in `useNavigation`; the active stream view MUST resolve an absent value to `tail` and materialize that into the hash
83
+
-`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
84
+
-`streamAggregationRange`: no standalone default; the active stream view MUST clear it whenever `aggregations` is absent, and MUST materialize its default range only after the aggregation panel is opened
85
+
86
+
When Studio is running without a database connection but with Streams enabled:
87
+
88
+
- 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
73
90
74
91
When URL params are stale from a previous DB, invalid `schema`/`table` values MUST be resolved to valid current defaults.
75
92
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`.
Copy file name to clipboardExpand all lines: Architecture/non-standard-ui.md
+67-1Lines changed: 67 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,8 +77,74 @@ It deliberately excludes:
77
77
-`Skeleton`
78
78
- Why it stays non-standard:
79
79
- The stream view needs a dense multi-column summary row with inline expansion, single-open-row behavior, clipped preview text, and infinite-scroll loading inside one scroll container.
80
+
- The same custom row composite also carries the short-lived highlight animation for newly revealed events, which needs to live on the exact row shell that preserves stream-scroll anchoring.
81
+
- The surrounding stream chrome now also mixes a control-only header, a fixed footer summary cluster, follow-mode-specific scroll behavior, and a search-only footer progress fill with a scroll-trigger loading pulse that standard ShadCN layout primitives do not model as one reusable component.
80
82
- No stock ShadCN component provides that event-log interaction model, so Studio keeps a custom composite while still building it from standard ShadCN primitives.
- The stream header search needs syntax feedback and context-aware suggestions that stay visually attached to the expanding inline field without introducing a portal-backed overlay or a full alert block inside the header chrome.
94
+
- Studio therefore keeps a custom anchored assist panel directly under the input, while still building the suggestion list from standard ShadCN `Command` primitives.
95
+
- Keeping the feedback and suggestions inline avoids the layering and focus issues of a separate popover in this compact header layout, and it lets the suggestion list open immediately with starter field suggestions, stay content-sized above the sticky header row, hold partial field prefixes locally, preserve a stable keyboard selection during background refreshes, and still draw value candidates from remembered rows even when the currently visible filtered result set is empty.
- The stream header needs a compact routing-key picker that can sit beside the expanding search field, page through a potentially massive lexicographically sorted keyspace, and still support keyboard-first selection without rendering every key at once.
108
+
- The API only exposes cursor-based routing-key pages, and the selector now also owns a clearable selected-key state that must work even when the stream has no search schema.
109
+
- When a key is selected, the closed trigger also needs to expand into a compact inline pill that keeps the chosen routing key visible without stealing the full search-field slot.
110
+
- Studio therefore keeps a custom popover composite with a prefix input, a virtualized infinite list, and a hover-only clear affordance on the trigger itself instead of trying to force that behavior into a stock `Command` list.
- The stream view needs a compact, single-band aggregation surface that mixes horizontally scrollable metric cards, inline sparkline backgrounds, quick time-range toggles, follow-mode-driven refresh behavior, and a small custom-range popover directly above an independently scrollable event log.
123
+
- No stock ShadCN component covers that event-log-adjacent observability layout, especially once each metric column has to support fixed-width horizontal scrolling, stacked percentile cards with plain-text secondary labels, auto-scaled unit display, TanStack DB-backed per-series preferences that survive range switches and stream navigation, hover-revealed dropdown controls without reflowing the card chrome, and a tighter split date/time absolute-range editor instead of the browser's native `datetime-local` chrome.
- Studio needs a compact, stream-specific diagnostics surface anchored to the footer summary itself, mixing logical payload size, explicit object-storage and local-storage buckets, node-local request accounting, search-family coverage, and state-aware run-accelerator status in one dense popover.
145
+
- 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.
146
+
- 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.
147
+
82
148
## Standardization Candidates
83
149
84
150
These are the current high-signal places where Studio is bypassing a plausible standard ShadCN component or composition pattern.
@@ -122,7 +188,7 @@ These are the current high-signal places where Studio is bypassing a plausible s
- Custom sidebar sections, shared inline search-and-refresh disclosure for both tables and streams, custom sidebar item primitive, and a draggable resize separator on the sidebar edge.
0 commit comments