DOB-2: Migration — collapse scope='builtin' rows into scope='global', drop builtin_hash columns #794
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Blocks
Depends on
#793 DOB-1: Resolver — drop scope='builtin', fall through to code-side defaults
charles/claude-hooks
Reference
charles/claude-hooks#794
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As a platform engineer, I want a one-shot DB migration that takes every existing
scope='builtin'row in the per-kind tables, promotes it toscope='global'(when noglobalrow already shadows it), drops it otherwise, and removes the now-vestigialbuiltin_hashcolumns — so the DB on an upgraded host carries nobuiltinrows or hash bookkeeping after the next restart.DOB-1 already removes the resolver's read path for
builtin, so these rows are dead data the moment that ships. This story makes the cleanup permanent and storage-clean.Acceptance criteria
Migration
apps/server/src/infrastructure/database/migrations/010-collapse-builtin-rows.tsships:scopecolumn (skill,system_prompt,plugin_binding,plugin_marketplace,mcp_server,agent_type_config,agent_type_container,agent_type_routing,agent_type,service_config,label_catalog):scope='builtin'row, if ascope='global'row with the same logical key (per-kind unique-key fields) already exists → DELETE the builtin row. Else → UPDATE its scope to'global'.builtin_hashcolumn from every table that carries one (agent_type,service_config,label_catalog,skill,system_prompt,plugin_binding,plugin_marketplace,mcp_server).builtinrows, nobuiltin_hashcolumns left).[010] <table>: promoted=N, deleted=M, dropped builtin_hash.Schema fallout
BuiltinHashColumns(or equivalent type) and any TS code reading.builtin_hashis removed in the same PR.ConfigScopeunion narrows to'global' | 'agent_type' | 'instance'.resolver.tsSCOPE_PRIORITYmatches.Tests
builtin_hashcolumns physically gone (PRAGMA table_infodoesn't list them).Out of scope
syncBuiltinsFromRepofunction — DOB-4. It still runs at boot until DOB-4; this migration just handles the rows it's left behind.config/*.jsonfiles — DOB-5.References
apps/server/src/infrastructure/database/migrations/(existing migration patterns 001..009),apps/server/src/domain/agent-config/resolver.ts(SCOPE_PRIORITY).builtinrows before this migration runs, otherwise the brief moment between row delete andglobalpromote would resolve tonull.🤖 Auto-assigned to code-lead (heuristic: area:agents → code-lead (architecture-touching)). Reply
/unassignto reroute.🦵 @charles kicked the queue — re-running address-review on @code-lead.
🦵 @charles kicked the queue — re-running address-review on @code-lead.
scope='builtin'at runtime — defaults live in code, not DB #934'builtin'from runtime tables #939