chore(service-config): extract factory defaults to code constants #935

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

As an operator, I want the factory service_config values to live in TypeScript constants, so that the runtime no longer depends on a scope='builtin' row in the database.

Today the service_config builtin row carries factory watchdogs_json, penpot_json, speech_json, container_image, and container_image_default. The dashboard "reset to builtin" UX reads them, and a stale builtin row would silently change service behaviour on a fresh boot. Pulling those defaults into code makes them reviewable, version-controlled, and removes the last reason the runtime needs the 'builtin' scope.

Tracker: #934.

Acceptance criteria

Constants

  • New module apps/server/src/setup/service-config-defaults.ts exports SERVICE_CONFIG_DEFAULTS, a frozen object covering: container_image, container_image_default, watchdogs_json, penpot_json, speech_json, webhook_secret_ref (latter as null — required key, not a value).
  • Each field gets a one-line comment naming the dashboard surface that reads it.
  • Existing in-memory consumers (apps/server/src/infrastructure/database/service-config-store.ts, apps/server/src/http/handlers/speech.ts, watchdog reader) read from SERVICE_CONFIG_DEFAULTS for the missing-row fallback instead of querying scope='builtin'.

Tests

  • Unit test: SERVICE_CONFIG_DEFAULTS has the same shape as a service_config row (every column with a default in the schema is represented).
  • Existing service-config tests still pass after switching the fallback path.

Out of scope

  • Wiring the constants into the setup wizard — that's #story_4 (wizard seeds label_catalog + service_config).
  • Reset-to-factory endpoint — that's #story_3.
  • Dropping the builtin row / CHECK constraint — that's #story_5.

References

  • Meta tracker: #934
  • Current builtin readers: apps/server/src/infrastructure/database/service-config-store.ts, apps/server/src/http/handlers/speech.ts, apps/web/src/routes/$locale/settings.service.tsx
As an operator, I want the factory `service_config` values to live in TypeScript constants, so that the runtime no longer depends on a `scope='builtin'` row in the database. Today the `service_config` builtin row carries factory `watchdogs_json`, `penpot_json`, `speech_json`, `container_image`, and `container_image_default`. The dashboard "reset to builtin" UX reads them, and a stale builtin row would silently change service behaviour on a fresh boot. Pulling those defaults into code makes them reviewable, version-controlled, and removes the last reason the runtime needs the `'builtin'` scope. Tracker: #934. ## Acceptance criteria ### Constants - [ ] New module `apps/server/src/setup/service-config-defaults.ts` exports `SERVICE_CONFIG_DEFAULTS`, a frozen object covering: `container_image`, `container_image_default`, `watchdogs_json`, `penpot_json`, `speech_json`, `webhook_secret_ref` (latter as `null` — required key, not a value). - [ ] Each field gets a one-line comment naming the dashboard surface that reads it. - [ ] Existing in-memory consumers (`apps/server/src/infrastructure/database/service-config-store.ts`, `apps/server/src/http/handlers/speech.ts`, watchdog reader) read from `SERVICE_CONFIG_DEFAULTS` for the missing-row fallback instead of querying `scope='builtin'`. ### Tests - [ ] Unit test: `SERVICE_CONFIG_DEFAULTS` has the same shape as a `service_config` row (every column with a default in the schema is represented). - [ ] Existing service-config tests still pass after switching the fallback path. ## Out of scope - Wiring the constants into the setup wizard — that's #__story_4__ (wizard seeds label_catalog + service_config). - Reset-to-factory endpoint — that's #__story_3__. - Dropping the builtin row / CHECK constraint — that's #__story_5__. ## References - Meta tracker: #934 - Current builtin readers: `apps/server/src/infrastructure/database/service-config-store.ts`, `apps/server/src/http/handlers/speech.ts`, `apps/web/src/routes/$locale/settings.service.tsx`
dev closed this issue 2026-05-08 09:08:50 +00:00
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#935
No description provided.