This document is normative for Studio introspection fetching, fallback behavior, and startup failure handling.
Studio MUST treat introspection as resilient metadata loading. A failed refresh must not silently degrade into an empty-database state, and a partial metadata success must remain usable whenever table metadata is available.
This architecture governs:
- adapter introspection result/error behavior
- React Query fetch policy for introspection
- startup failure and stale-data fallback UI
- operation-event emission for introspection
ui/hooks/use-introspection.tsui/hooks/use-navigation.tsxui/studio/Navigation.tsxui/studio/Studio.tsxdata/postgres-core/adapter.tsdata/mysql-core/adapter.ts
Introspection MUST be fetched through use-introspection.ts with a stable React Query entry.
The query MUST use:
retry: falseretryOnMount: falserefetchOnReconnect: falserefetchOnWindowFocus: falsestaleTime: Infinity
Automatic retry loops are forbidden for introspection because they can spam operation events, repeat expensive metadata work, and hide the real startup failure state from the user.
useIntrospection MUST always return a shape-compatible data object so navigation defaults can still be computed safely.
That fallback data is placeholder metadata only. Callers MUST use hasResolvedIntrospection to distinguish:
- a real successful introspection result
- placeholder fallback data returned after a failed initial load
When a refetch fails after a previous success, Studio MUST keep the last successful introspection snapshot available and surface the error separately via errorState.
If introspection has not resolved successfully and the active table cannot be resolved, Studio MUST render actionable recovery UI instead of an empty-state table view.
Required behavior:
ui/studio/Navigation.tsxMUST show an introspection failure notice with retry action.ui/studio/Studio.tsxMUST replace the table view with a recovery panel whenview=tablecannot resolve an active table because startup introspection failed.- The sidebar MUST NOT show
No tables foundfor an unresolved startup introspection failure.
When stale introspection data exists, Studio MAY continue rendering tables, but it MUST show a warning notice that the visible schema snapshot is stale and offer retry.
For PostgreSQL and MySQL introspection, table metadata is authoritative for initial usability.
If the tables query succeeds but timezone lookup fails or returns no value:
- introspection MUST still succeed
- timezone MUST fall back to
UTC - Studio MUST continue rendering available schemas and tables
If the tables query itself fails, introspection MUST fail.
Introspection success and failure MUST emit standardized operation events through the central onEvent pipeline.
Failure diagnostics MUST include:
- operation name (
introspect) - associated SQL query when available
- adapter source on
payload.error.adapterSourcewhen known
studio_launched MUST only be emitted once per adapter lifecycle, even if introspection is manually refetched successfully multiple times.
Changes to this subsystem MUST include tests for:
- failed initial introspection without automatic retry
- stale-data preservation after a failed refetch
- startup recovery UI rendering
- adapter partial-success fallback when timezone lookup fails
- single-emission behavior for
studio_launched