Seed default AI settings and notification preferences at boot
CI / ci (pull_request) Successful in 1m24s
Independent review Codex gpt-6-sol high: APPROVED (0 findings)
CI / ci (push) Successful in 1m26s

On first boot create the ai_settings row (provider anthropic, empty base
URL, model and key, temperature 0.7, system prompt DefaultPersonaPrompt
from CTXD PROMPTS.MD §4) and a notification_prefs row per event (push on
for all five, chat on for plan_ready and list_ready only). Existing rows
are never changed; a missing event row is seeded on its own.

cmd/server seeds household settings, AI settings and notification
preferences through seedDefaults; any failure stops the boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 14:54:58 -04:00
co-authored by Claude Opus 5.5
parent 8be5c56f6f
commit 989d13b69c
4 changed files with 364 additions and 1 deletions
+13 -1
View File
@@ -59,7 +59,7 @@ func run(cfg config.Config, logger *slog.Logger) error {
}
}()
if err := seedSettings(ctx, db, cfg.DefaultTZ); err != nil {
if err := seedDefaults(ctx, db, cfg.DefaultTZ); err != nil {
return err
}
settings := household.NewSettingsService(db)
@@ -153,6 +153,18 @@ func seedSettings(ctx context.Context, db *store.Store, defaultTZ string) error
return err
}
// seedDefaults creates the household settings, AI settings and notification
// preferences that do not exist yet. Existing rows are never changed.
func seedDefaults(ctx context.Context, db *store.Store, defaultTZ string) error {
if err := seedSettings(ctx, db, defaultTZ); err != nil {
return err
}
if err := household.SeedAISettings(ctx, db); err != nil {
return err
}
return household.SeedNotificationPrefs(ctx, db)
}
// logListening logs the startup line. Only the public URL's origin is logged
// so no credential-bearing URL component can reach the log.
func logListening(logger *slog.Logger, cfg config.Config) {