feat(setup): wizard seeds label_catalog + service_config at scope='global' #938

Closed
opened 2026-05-08 08:56:06 +00:00 by claude-desktop · 0 comments
Collaborator

As an operator running the setup wizard on a fresh install, I want the wizard to seed label_catalog and service_config rows at scope='global' from the code constants, so that the runtime never needs to read 'builtin' rows.

The apps/server/src/setup/presets.ts wizard already seeds agent_type rows at scope='global'. After the constants stories land (SERVICE_CONFIG_DEFAULTS, LABEL_PRESETS), the wizard becomes the only place that materialises the factory layer in the DB. This is the bridge from "builtin rows seeded at install time" to "code constants seeded once into the global layer".

Acceptance criteria

Wizard

  • apps/server/src/setup/presets.ts (or a sibling module) seeds one service_config row at scope='global' from SERVICE_CONFIG_DEFAULTS if no scope='global' row exists yet. Idempotent (INSERT … ON CONFLICT DO NOTHING).
  • Same module seeds one label_catalog row per entry in LABEL_PRESETS at scope='global' if absent. Idempotent on (scope, repo, name).
  • Each insert writes a config_revision row with comment='seeded by setup wizard', mirroring the existing agent_type seeder pattern.

Migration coordination

  • The wizard runs before the runtime's first request, so the global rows exist by the time the resolver / handlers read them. Confirm by adding a smoke test that a fresh DB → wizard → service-config GET returns the factory values.

Tests

  • Wizard test: fresh DB → wizard → exactly one scope='global' service_config row with SERVICE_CONFIG_DEFAULTS values.
  • Wizard test: fresh DB → wizard → one scope='global' label_catalog row per LABEL_PRESETS entry.
  • Wizard test: re-running the wizard against a populated DB does not duplicate rows or shadow operator overrides.

Out of scope

  • Dropping the builtin rows that pre-existed in older installs — that's the migration story.
  • Reset-to-factory UX wiring — that's the API story.

References

  • Meta tracker: #934
  • Existing wizard pattern: apps/server/src/setup/presets.ts:300-355 (agent_type seeding)
As an operator running the setup wizard on a fresh install, I want the wizard to seed `label_catalog` and `service_config` rows at `scope='global'` from the code constants, so that the runtime never needs to read `'builtin'` rows. The `apps/server/src/setup/presets.ts` wizard already seeds `agent_type` rows at `scope='global'`. After the constants stories land (`SERVICE_CONFIG_DEFAULTS`, `LABEL_PRESETS`), the wizard becomes the only place that materialises the factory layer in the DB. This is the bridge from "builtin rows seeded at install time" to "code constants seeded once into the global layer". ## Acceptance criteria ### Wizard - [ ] `apps/server/src/setup/presets.ts` (or a sibling module) seeds one `service_config` row at `scope='global'` from `SERVICE_CONFIG_DEFAULTS` if no `scope='global'` row exists yet. Idempotent (`INSERT … ON CONFLICT DO NOTHING`). - [ ] Same module seeds one `label_catalog` row per entry in `LABEL_PRESETS` at `scope='global'` if absent. Idempotent on `(scope, repo, name)`. - [ ] Each insert writes a `config_revision` row with `comment='seeded by setup wizard'`, mirroring the existing `agent_type` seeder pattern. ### Migration coordination - [ ] The wizard runs *before* the runtime's first request, so the global rows exist by the time the resolver / handlers read them. Confirm by adding a smoke test that a fresh DB → wizard → service-config GET returns the factory values. ### Tests - [ ] Wizard test: fresh DB → wizard → exactly one `scope='global'` `service_config` row with `SERVICE_CONFIG_DEFAULTS` values. - [ ] Wizard test: fresh DB → wizard → one `scope='global'` `label_catalog` row per `LABEL_PRESETS` entry. - [ ] Wizard test: re-running the wizard against a populated DB does not duplicate rows or shadow operator overrides. ## Out of scope - Dropping the builtin rows that pre-existed in older installs — that's the migration story. - Reset-to-factory UX wiring — that's the API story. ## References - Meta tracker: #934 - Existing wizard pattern: `apps/server/src/setup/presets.ts:300-355` (agent_type seeding)
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#938
No description provided.