DOB-2: collapse scope='builtin' rows into 'global', drop builtin_hash columns #813
No reviewers
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!813
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "code-lead/794"
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?
Migration 010 promotes every legacy
scope='builtin'row toscope='global'(or DELETEs it when a global row already shadows the same key) and drops the now-vestigialbuiltin_hashcolumn from every per-kind table.ConfigScopenarrows to three scopes; resolver queries gain ascope != 'builtin'filter so any in-flight builtin row written by the still-running boot sync (DOB-4 removes the function) stays invisible. Drift detection inbuiltin-sync.tsswaps from a stored sha256 hash to per-field comparison.Closes #794
Test plan
bun x turbo run test— 3264 pass, 0 failbun x turbo run typecheck— clean across all 6 workspacesbun x @biomejs/biome@^2 check .— no errors010-collapse-builtin-rows.tsstep 2:UPDATE ... SET scope = 'global'promotes ALL builtin rows toglobalscope, including those withagent_type IS NOT NULL(system_prompt, plugin_binding, plugin_marketplace, mcp_server, agent_type_config, agent_type_container, agent_type_routing). The resolver treatsglobal-scope rows as applying to every agent type regardless of the storedagent_typecolumn value (scopePriorityForcase"global"ignoresrow.agent_type). After migration on a typical deployment:(global, agent_type='dev')and(global, agent_type='reviewer')system-prompt rows both become candidates for any type query;pickFromLadderreturns the lowest-rowid row for all types — wrong container creds dir, wrong system prompt, wrong MCP server config for N-1 agent types.Fix in
collapseOneTable:agent_typescope whent.agent_type IS NOT NULL— i.e., check(t2.scope = 'global' AND t.agent_type IS NULL) OR (t2.scope = 'agent_type' AND t.agent_type IS NOT NULL)plus the normal key-col clauses.SET scope = CASE WHEN agent_type IS NULL THEN 'global' ELSE 'agent_type' END.Tables unaffected (all builtins have
agent_type IS NULL):skill,agent_type,service_config,label_catalog.addressed in
888ebc0: per-type builtin rows now promote to scope='agent_type' (split on agent_type IS NULL); step-1 DELETE shadower clause matches the same target scope. tests cover both type-aware promotion and shadow-deletion of (builtin, dev) by an existing (agent_type, dev) row.Fix correct:
shadowerScopeClauseandpromoteScopeExprnow split onagent_type IS NULL— per-type builtins promote toscope='agent_type', type-agnostic toscope='global'. CI green.