refactor(config): mandatory app-config rows seeded in DB; rename to session.setup_timeout

All registry keys must exist as rows in the config table: main seeds
missing keys with their defaults at startup, LoadApp fails fast on a
missing key, and the code-side fallback const/helper for the onboarding
setup timeout is gone -- the value rides in SessionConfig.SetupTimeout.
The key is renamed session.idle_timeout -> session.setup_timeout, and
the /config page's 'overridden' now means 'differs from the default'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 18:17:24 +02:00
parent 8c9285f33c
commit 0e6cf00dba
16 changed files with 127 additions and 120 deletions

View File

@@ -24,8 +24,8 @@
**Files:**
- Modify: `backend/internal/store/schema.sql` (add column to the `profile` table)
- Modify: `backend/internal/store/profile.go` (`Profile` struct, `profileColumns`, `GetProfile`, new `MarkGarminConnected`)
- Modify: `backend/internal/store/profile_test.go` (new tests)
- Modify: `../../../backend/internal/store/profiles.go` (`Profile` struct, `profileColumns`, `GetProfile`, new `MarkGarminConnected`)
- Modify: `../../../backend/internal/store/profiles_test.go` (new tests)
- Modify: `backend/internal/store/isolation_test.go` (new adversarial test)
- Modify: `docs/DATABASE.md` (regenerated)
- Modify (real DB, not version-controlled): `backend/geniusrun.db` — additive `ALTER TABLE`
@@ -35,7 +35,7 @@
- [ ] **Step 1: Write the failing tests**
Add to `backend/internal/store/profile_test.go`:
Add to `../../../backend/internal/store/profiles_test.go`:
```go
func TestMarkGarminConnected_SetsTimestampOnceOnFirstCall(t *testing.T) {
@@ -139,7 +139,7 @@ to:
rolling_window_days INTEGER NOT NULL DEFAULT 90,
```
- [ ] **Step 4: Update `Profile`, `profileColumns`, and `GetProfile` in `profile.go`**
- [ ] **Step 4: Update `Profile`, `profileColumns`, and `GetProfile` in `profiles.go`**
Change the struct (add the field right after `GarminPassword`):
@@ -192,7 +192,7 @@ Do **not** touch `UpdateProfile` — `garmin_connected_at` must stay out of its
- [ ] **Step 5: Add `MarkGarminConnected`**
Append to `backend/internal/store/profile.go`:
Append to `../../../backend/internal/store/profiles.go`:
```go
@@ -237,7 +237,7 @@ Confirm the backend isn't running before touching the file (`ps aux | grep geniu
- [ ] **Step 10: Commit**
```bash
git add backend/internal/store/schema.sql backend/internal/store/profile.go backend/internal/store/profile_test.go backend/internal/store/isolation_test.go docs/DATABASE.md
git add backend/internal/store/schema.sql backend/internal/store/profiles.go backend/internal/store/profiles_test.go backend/internal/store/isolation_test.go docs/DATABASE.md
git commit -m "feat(store): persist garmin_connected_at, set once on first successful auth"
```