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:
@@ -765,16 +765,16 @@ EOF
|
||||
|
||||
---
|
||||
|
||||
## Task 4: Scope `profile.go` to `user_id`
|
||||
## Task 4: Scope `profiles.go` to `user_id`
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/internal/store/profile.go`
|
||||
- Modify: `backend/internal/store/profile_test.go`
|
||||
- Modify: `../../../backend/internal/store/profiles.go`
|
||||
- Modify: `../../../backend/internal/store/profiles_test.go`
|
||||
|
||||
**Interfaces:**
|
||||
- Produces: `func (db *DB) GetProfile(ctx context.Context, userID int64) (Profile, error)`; `func (db *DB) UpdateProfile(ctx context.Context, userID int64, p Profile) error`. Every other task/caller of these two methods must pass `userID` as the second positional argument from here on.
|
||||
|
||||
- [ ] **Step 1: Update `GetProfile`/`UpdateProfile` in `backend/internal/store/profile.go`**
|
||||
- [ ] **Step 1: Update `GetProfile`/`UpdateProfile` in `../../../backend/internal/store/profiles.go`**
|
||||
|
||||
Replace the two function bodies (the `Profile` struct and `profileColumns` constant are unchanged):
|
||||
|
||||
@@ -832,7 +832,7 @@ func (db *DB) UpdateProfile(ctx context.Context, userID int64, p Profile) error
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Fix `backend/internal/store/profile_test.go`'s call sites**
|
||||
- [ ] **Step 2: Fix `../../../backend/internal/store/profiles_test.go`'s call sites**
|
||||
|
||||
The existing `TestProfile_DefaultsThenUpdate` calls `db.GetProfile(ctx)` and `db.UpdateProfile(ctx, p)` directly against a fresh DB with no provisioned user — since Task 1 made `profile` rows always belong to a user, this test must provision one first. Replace the test's opening two lines:
|
||||
|
||||
@@ -866,7 +866,7 @@ Run: `cd backend && gofmt -l internal/store/`
|
||||
Expected: no output.
|
||||
|
||||
```bash
|
||||
git add backend/internal/store/profile.go backend/internal/store/profile_test.go
|
||||
git add backend/internal/store/profiles.go backend/internal/store/profiles_test.go
|
||||
git commit -m "$(cat <<'EOF'
|
||||
store: scope GetProfile/UpdateProfile to a user_id
|
||||
|
||||
@@ -3302,7 +3302,7 @@ func TestSetup_RejectsEmptyDisplayName(t *testing.T) {
|
||||
- [ ] **Step 4: Build everything and fix remaining call sites**
|
||||
|
||||
Run: `cd backend && go build ./... 2>&1 | head -50`
|
||||
Expected: remaining errors are all inside `internal/api/*.go` handler files (`profile.go`, `activities.go`, `sync.go`, `kinds.go`, `review.go`, `reclassify.go`, `progression.go`, `garmin.go`) and `cmd/seedsample/main.go` — referencing `s.Garmin`/`s.Sync` (now removed) or store methods missing `userID`. These are fixed in Tasks 14/15/17; confirm no errors remain in `server.go`, `main.go`, or `api_test.go` itself.
|
||||
Expected: remaining errors are all inside `internal/api/*.go` handler files (`profiles.go`, `activities.go`, `sync.go`, `kinds.go`, `review.go`, `reclassify.go`, `progression.go`, `garmin.go`) and `cmd/seedsample/main.go` — referencing `s.Garmin`/`s.Sync` (now removed) or store methods missing `userID`. These are fixed in Tasks 14/15/17; confirm no errors remain in `server.go`, `main.go`, or `api_test.go` itself.
|
||||
|
||||
- [ ] **Step 5: `gofmt` and commit**
|
||||
|
||||
@@ -3325,7 +3325,7 @@ EOF
|
||||
|
||||
---
|
||||
|
||||
## Task 14: Thread `userID` into `profile.go`, `kinds.go`, `garmin.go`, `progression.go`
|
||||
## Task 14: Thread `userID` into `profiles.go`, `kinds.go`, `garmin.go`, `progression.go`
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/internal/api/profile.go`
|
||||
@@ -3636,7 +3636,7 @@ Run: `cd backend && gofmt -l internal/api/`
|
||||
Expected: no output.
|
||||
|
||||
```bash
|
||||
git add backend/internal/api/profile.go backend/internal/api/kinds.go backend/internal/api/garmin.go backend/internal/api/progression.go
|
||||
git add backend/internal/api/profiles.go backend/internal/api/kinds.go backend/internal/api/garmin.go backend/internal/api/progression.go
|
||||
git commit -m "$(cat <<'EOF'
|
||||
api: scope profile, workout-kind, Garmin auth, and progression handlers to userID
|
||||
|
||||
|
||||
Reference in New Issue
Block a user