[meta] Kill scope='builtin' at runtime — defaults live in code, not DB #934

Open
opened 2026-05-08 08:54:58 +00:00 by claude-desktop · 0 comments
Collaborator

Tracker

The DB still carries scope='builtin' rows on service_config, label_catalog, and (legacy) agent_type* / mcp_server / plugin_* / skill / system_prompt. DOB-1/DOB-2 (#793/#794) collapsed builtin out of the agent-type read path but never finished the job: schemas, frontends, handlers, and migration runners still treat builtin as a live layer for label/service tables, and the four agent-types-settings PUT handlers regressed onto WHERE scope='builtin' for existence checks (most recently #931 — fixed in the follow-up to this tracker).

Goal

After this work:

  • No table accepts scope='builtin' (CHECK constraints narrowed to live scopes).
  • No read path filters on scope != 'builtin' (constants + every Drizzle ne(*.scope, "builtin") predicate gone).
  • Factory defaults live as TypeScript constants. The setup wizard seeds them into scope='global' rows on first install.
  • "Reset to factory" UX re-applies the code constants — there is no "builtin" layer to fall back to.

Stories

Tracking the seven stories below. Order:

  1. chore: extract service_config defaults to code constants
  2. chore: extract label_catalog factory presets to code constants
  3. feat(api): POST /service-config/reset-defaults — replaces "reset to builtin"
  4. feat(setup): wizard seeds label_catalog + service_config at scope='global'
  5. feat(db): migration 0010 — collapse 'builtin' from runtime tables
  6. chore: drop NON_BUILTIN_SCOPE_FILTER + every ne(scope,'builtin') filter
  7. chore(web): narrow SCOPE_ORDER to 3 layers, drop builtin UI affordances

Out of scope

  • MCP mcp-builtin-defs.json / MCP_SERVER_DEFAULTS — already in code, only the filename mentions "builtin". Optional rename is its own chore.
  • agent_type* builtin rows — DOB-4 already collapsed seeding; the migration in story 5 just drops any survivors + tightens CHECK.

References

  • DOB-1 / #793 — excluded 'builtin' rows from the agent-type read path
  • DOB-2 / #794 — narrowed ConfigScope type to drop 'builtin'
  • DOB-4 / #796 — deleted the boot-time JSON loader that wrote builtin rows
  • #931 — most recent PUT handler that regressed onto scope='builtin'
  • Operator complaint 2026-05-08: "wow we still have builtin shit in the app"
## Tracker The DB still carries `scope='builtin'` rows on `service_config`, `label_catalog`, and (legacy) `agent_type*` / `mcp_server` / `plugin_*` / `skill` / `system_prompt`. DOB-1/DOB-2 (#793/#794) collapsed builtin out of the agent-type read path but never finished the job: schemas, frontends, handlers, and migration runners still treat builtin as a live layer for label/service tables, and the four `agent-types-settings` PUT handlers regressed onto `WHERE scope='builtin'` for existence checks (most recently #931 — fixed in the follow-up to this tracker). ## Goal After this work: - No table accepts `scope='builtin'` (CHECK constraints narrowed to live scopes). - No read path filters on `scope != 'builtin'` (constants + every Drizzle `ne(*.scope, "builtin")` predicate gone). - Factory defaults live as TypeScript constants. The setup wizard seeds them into `scope='global'` rows on first install. - "Reset to factory" UX re-applies the code constants — there is no "builtin" layer to fall back to. ## Stories Tracking the seven stories below. Order: 1. `chore: extract service_config defaults to code constants` 2. `chore: extract label_catalog factory presets to code constants` 3. `feat(api): POST /service-config/reset-defaults — replaces "reset to builtin"` 4. `feat(setup): wizard seeds label_catalog + service_config at scope='global'` 5. `feat(db): migration 0010 — collapse 'builtin' from runtime tables` 6. `chore: drop NON_BUILTIN_SCOPE_FILTER + every ne(scope,'builtin') filter` 7. `chore(web): narrow SCOPE_ORDER to 3 layers, drop builtin UI affordances` ## Out of scope - MCP `mcp-builtin-defs.json` / `MCP_SERVER_DEFAULTS` — already in code, only the filename mentions "builtin". Optional rename is its own chore. - `agent_type*` builtin rows — DOB-4 already collapsed seeding; the migration in story 5 just drops any survivors + tightens CHECK. ## References - DOB-1 / #793 — excluded `'builtin'` rows from the agent-type read path - DOB-2 / #794 — narrowed `ConfigScope` type to drop `'builtin'` - DOB-4 / #796 — deleted the boot-time JSON loader that wrote builtin rows - #931 — most recent PUT handler that regressed onto `scope='builtin'` - Operator complaint 2026-05-08: "wow we still have builtin shit in the app"
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#934
No description provided.