Skip to content

Commit 5fd9e6d

Browse files
hotlongCopilot
andcommitted
fix(runtime): provision sys_metadata table in per-project kernels
The artifact-kernel-factory was passing 'registerSystemObjects: false' to MetadataPlugin, claiming the control plane owned metadata storage. But ADR-0005's overlay flow (saveMetaItem in objectql/protocol.ts) writes customization overlay rows to sys_metadata on the same engine the protocol is attached to — for per-project kernels that's the project DB. Result: any PUT /api/v1/meta/{view,dashboard}/... against a cloud project deployment errored with 'no such table: sys_metadata', e.g. when a user clicked 'Create View' in Studio: { "error": "Failed to persist customization overlay to sys_metadata: SQLITE_UNKNOWN: SQLite error: no such table: sys_metadata. In-memory registry was updated but will be lost on restart.", "code": "overlay_persistence_failed" } Flip to true so ObjectQLPlugin.syncRegisteredSchemas provisions the sys_metadata + sys_metadata_history tables on first cold-start. Both are project-scoped (project_id column is set on every write), so multi-project DBs and shared DBs remain correctly isolated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent eba5af4 commit 5fd9e6d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

packages/runtime/src/cloud/artifact-kernel-factory.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
* as the `'cloud'` datasource so AuthPlugin's
1818
* identity manifest resolves locally.
1919
* • ObjectQLPlugin
20-
* • MetadataPlugin (no system-object registration)
20+
* • MetadataPlugin (registers `sys_metadata` + `sys_metadata_history` on
21+
* the project DB — required by ADR-0005: customization
22+
* overlays such as user-created views/dashboards are
23+
* persisted by ObjectStackProtocolImplementation on the
24+
* per-project engine, so the table must exist there).
2125
* • AuthPlugin — per-project, derives an HKDF secret from
2226
* `OS_AUTH_SECRET` + projectId. Each project owns its
2327
* own `sys_user/sys_session/...` tables in its own
@@ -128,7 +132,15 @@ export class ArtifactKernelFactory implements ProjectKernelFactory {
128132
watch: false,
129133
projectId: projectId,
130134
organizationId: project.organization_id,
131-
registerSystemObjects: false,
135+
// ADR-0005: customization overlays (user-created views, dashboards,
136+
// edited objects, ...) are persisted by
137+
// ObjectStackProtocolImplementation.saveMetaItem on whichever
138+
// engine the protocol is attached to. For per-project kernels that
139+
// means the project's own DB, so the sys_metadata + history tables
140+
// MUST be provisioned here. The previous `false` setting caused
141+
// "no such table: sys_metadata" errors on any PUT /api/v1/meta/*
142+
// call (e.g. Studio "Create View") against a project deployment.
143+
registerSystemObjects: true,
132144
}));
133145

134146
// Per-project AuthPlugin — only when an OS_AUTH_SECRET base is

0 commit comments

Comments
 (0)