# Saved queries and dashboards Observatory persists query definitions before building the web interface on top of them. A saved query contains bounded human metadata, one organization, an optional project/environment/service scope, the reviewed query text, and the exact versioned typed AST produced from that text. Reads reparse the text, hydrate its duration fields, validate the stored AST, and require the two representations to match. Dashboards are versioned ordered collections of at most 16 panels. Each panel selects one saved query and one deliberately small visualization contract: `table`, `stat`, or `timeseries`. Composite foreign keys prevent a panel from referencing another organization's query. Updates to saved queries and dashboards require their current revision so concurrent edits fail instead of silently overwriting one another. Identifiers are generated from cryptographic randomness; randomness failure fails the write and never falls back to time or a predictable counter. ## Source-control export `ExportDashboard` produces strict version-1 JSON containing the dashboard definition and each referenced query once. It keeps the stable definition IDs needed by panels, but omits organization IDs, operator user IDs, timestamps, internal revisions, and redundant stored AST bytes. `observatory export` performs the same organization-authorized read from the local server data directory. `observatory import` accepts exactly one strict, bounded JSON bundle on standard input and requires the destination organization twice: once as `--organization-id` and again as the exact `--approve-organization` value. Import reparses every query, validates each resource scope against the destination organization, replaces all portable identifiers with cryptographically generated local identities, and commits the queries, dashboard, and panels in one SQLite transaction. A bundle cannot select its tenant or actor. Example: ```sh observatory export --organization-id organization-id \ --actor-user-id user-id --dashboard operations >operations.json observatory import --organization-id organization-id \ --approve-organization organization-id --actor-user-id user-id \