fix(metadata): provision sys_metadata_commit for env kernels (ADR-0067)#2331
Merged
Conversation
Per-project (cloud) env kernels boot MetadataPlugin with
registerSystemObjects:true, registering `queryableMetadataObjects` so
ObjectQL boot-sync provisions their physical tables. The ADR-0067 commit
log `sys_metadata_commit` was missing from that list — it lived only in
ObjectQLPlugin's standalone `environmentId === undefined` path — so env
DBs never got the table. Every AI build/apply calls publishPackageDrafts,
which writes a commit row (op='apply'), hitting a hard
`SqliteError: no such table: sys_metadata_commit` on the first build. The
write is best-effort so the build still landed, but the error spammed
logs and the commit timeline silently recorded nothing.
Add SysMetadataCommitObject next to its sys_metadata_history sibling in
queryableMetadataObjects so env kernels provision it at boot. Same class
as the audit/messaging lazy-table provisioning fix.
Verified before/after on a kernel booted with the env-kernel plugin
triple (DriverPlugin('cloud') + ObjectQLPlugin(skipSchemaSync:false) +
MetadataPlugin(registerSystemObjects:true)) over real SQLite: boot-sync
goes 4 -> 5 objects and the writer's insert succeeds; without the change
the exact reported error reproduces. Unit test in plugin.test.ts fails
without the fix, passes with it.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An AI build into a tenant env logs a hard
SqliteError: no such table: sys_metadata_commit. The build still lands (objects/views/dashboard register), but the ADR-0067 commit-history write fails, so every AI build/edit spams the error and the commit timeline silently records nothing.Root cause
The metadata-storage objects are registered through two parallel paths that must stay in sync:
ObjectQLPluginregisters the full set[sys_metadata, history, commit, audit, view_definition]— but only whenenvironmentId === undefined(platform / standalone kernels).MetadataPlugin.queryableMetadataObjectsis what per-project cloud env kernels actually provision (artifact-kernel-factoryboots it withregisterSystemObjects:true+ ObjectQLskipSchemaSync:false→ boot-sync DDLs every registered object).ADR-0067 added
SysMetadataCommitObjectto list (1) but not (2), so env DBs never got thesys_metadata_committable. Every build'spublishPackageDraftswrites a commit row (op='apply') →no such table. Same class as the already-merged audit/messaging lazy-table provisioning fix.Fix
Add
SysMetadataCommitObjecttoqueryableMetadataObjects, next to itssys_metadata_historysibling (+ import + unit test). One object, +70 lines.Verification
plugin.test.ts): a new test assertsinit()registerssys_metadata_commit— fails without the fix (expected [4 elements] to include 'sys_metadata_commit'), passes with it. Full metadata suite: 254 passed.DriverPlugin('cloud')+ObjectQLPlugin(skipSchemaSync:false)+MetadataPlugin(registerSystemObjects:true)) over real better-sqlite3 — boot-sync goessynced:4 → 5, and the writer'sinsert('sys_metadata_commit', …)reproduces the exact reported error unfixed / succeeds fixed.Deploy
After merge, bump cloud
.framework-shato pull this into staging/prod (same flow as the audit/messaging fix).🤖 Generated with Claude Code