This document is normative for operation event emission, storage, and display.
Database and introspection operations MUST emit standardized Studio events and MUST flow through the central onEvent pipeline. Do not add ad-hoc logging paths for operation visibility.
This architecture governs:
- operation success/error event shapes
- event enrichment and fan-out
- toast behavior for failures
- in-memory operation event retention
- Console view rendering contract
ui/studio/Studio.tsxui/studio/context.tsxui/studio/views/console/ConsoleView.tsxui/studio/views/console/OperationEventEntry.tsx- data hooks that emit events (
use-introspection, rows collection query/update/delete, insert)
Event types are defined in Studio.tsx and MUST remain the shared contract:
studio_launchedstudio_operation_successstudio_operation_error
Operation payloads MUST include:
operationname- associated query when available
- error for failure events
Failure payloads SHOULD include payload.error.adapterSource when the adapter can identify its SQL dialect/source.
Enriched events MUST include:
eventIdtimestamp
All adapter-backed operations MUST emit through onEvent:
- introspection
- table query
- raw SQL query
- update
- delete
- insert
Success path MUST emit studio_operation_success.
Failure path MUST emit studio_operation_error and propagate error behavior to caller.
StudioContextProvider.onEvent is the only allowed enrichment pipeline.
It MUST:
- suppress toasts for
AbortError - show toast for operation errors with Console navigation action
- append success/error operation events to
operationEventsCollection - cap operation history at 100 events (evict oldest first)
- forward enriched events to external
emitEventcallback
Telemetry/checkpoint side effects for studio_launched are also owned by this pipeline.
Those telemetry side effects MUST honor Prisma's documented CHECKPOINT_DISABLE=1 opt-out and skip the checkpoint request entirely when that environment variable is set.
Do not bypass this pipeline in feature code.
Operation event history is stored in:
operationEventsCollection(localOnlyCollectionOptions)
Views MUST read operation events from Studio context, not from local ad-hoc stores.
ConsoleView MUST:
- render events from
useStudio().operationEvents - auto-scroll to latest event when list changes
- show empty-state message when no events exist
OperationEventEntry MUST:
- render success/error status and timestamp
- render SQL query preview/expanded mode
- render query parameters
- render error details for failures
- render adapter source for failures when available
- support query-copy action
Per-entry transient UI toggles (e.g. query expanded state) should use scoped UI state keys with cleanup.
Displayed operation events MUST be sorted by timestamp ascending before rendering, so Console naturally appends newest operations at bottom.
- Emitting operation events directly to Console components.
- Storing operation logs in component-local arrays.
- Bypassing
onEventfor adapter mutations/queries. - Returning silent failures without
studio_operation_error.
Changes to this subsystem MUST include tests for:
- event emission on success and failure paths
- event enrichment (
eventId,timestamp) - event cap/eviction behavior
- toast suppression for
AbortError - telemetry opt-out when
CHECKPOINT_DISABLE=1 - console rendering behavior for new event payload fields