refactor: merge internal/sync into internal/garmin, regroup api files and routes
Garmin auth/sync routes move under /api/garmin/*; sync.Service becomes garmin.Sync with garmin.SyncConfig/ClientConfig; applog becomes internal/log; the test mock moves into the garmin package as MockClient (breaking the test-only import cycle the merge created); stale test URLs and type names updated to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1256,8 +1256,8 @@ git commit -m "feat: fix workout taxonomy to 7 types, add pace/HR-zone fields to
|
||||
### Task 7: Classification reads max HR from the profile, not static config
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/internal/sync/service.go` (`Config` struct lines 21-40, `ClassifyActivity` lines 279-310)
|
||||
- Modify: `backend/internal/sync/service_test.go` (`TestFillPendingDetailsAndClassify_EndToEnd`)
|
||||
- Modify: `../../../backend/internal/garmin/sync.go` (`Config` struct lines 21-40, `ClassifyActivity` lines 279-310)
|
||||
- Modify: `../../../backend/internal/garmin/sync_test.go` (`TestFillPendingDetailsAndClassify_EndToEnd`)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `store.Profile.MaxHeartRate` (Task 1), `db.GetProfile` (Task 1).
|
||||
@@ -1265,7 +1265,7 @@ git commit -m "feat: fix workout taxonomy to 7 types, add pace/HR-zone fields to
|
||||
|
||||
- [ ] **Step 1: Update the test first**
|
||||
|
||||
In `backend/internal/sync/service_test.go`, find this line inside `TestFillPendingDetailsAndClassify_EndToEnd` (currently constructs the service with `MaxHR: 190`):
|
||||
In `../../../backend/internal/garmin/sync_test.go`, find this line inside `TestFillPendingDetailsAndClassify_EndToEnd` (currently constructs the service with `MaxHR: 190`):
|
||||
|
||||
```go
|
||||
svc := NewService(m, db, Config{MinConfidence: 0.5, MaxHR: 190}, fixedNow(time.Date(2026, 7, 11, 0, 0, 0, 0, time.UTC)))
|
||||
@@ -1284,7 +1284,7 @@ Expected: passes as-is right now (we haven't removed the field yet) — this ste
|
||||
|
||||
- [ ] **Step 3: Remove `MaxHR` from `Config` and source it from the profile in `ClassifyActivity`**
|
||||
|
||||
In `backend/internal/sync/service.go`, the `Config` struct currently ends with (lines 35-39):
|
||||
In `../../../backend/internal/garmin/sync.go`, the `Config` struct currently ends with (lines 35-39):
|
||||
|
||||
```go
|
||||
// MinConfidence is the classify.Classify threshold below which even a
|
||||
@@ -1381,7 +1381,7 @@ Expected: all PASS. If `cmd/geniusrund/main.go` fails to build because it still
|
||||
- [ ] **Step 6: Commit**
|
||||
|
||||
```bash
|
||||
cd backend && git add internal/sync/service.go internal/sync/service_test.go
|
||||
cd backend && git add internal/sync/sync.go internal/sync/sync_test.go
|
||||
git commit -m "feat: classification reads max HR from the profile instead of static config"
|
||||
```
|
||||
|
||||
@@ -1390,7 +1390,7 @@ git commit -m "feat: classification reads max HR from the profile instead of sta
|
||||
### Task 8: `internal/config` and `cmd/geniusrund` — credentials come from the profile
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/internal/config/config.go` (full rewrite — small file, shown complete below)
|
||||
- Modify: `../../../backend/internal/config/envconfig.go` (full rewrite — small file, shown complete below)
|
||||
- Modify: `backend/cmd/geniusrund/main.go` (lines 21-46)
|
||||
|
||||
**Interfaces:**
|
||||
@@ -1399,7 +1399,7 @@ git commit -m "feat: classification reads max HR from the profile instead of sta
|
||||
|
||||
- [ ] **Step 1: Rewrite `internal/config/config.go`**
|
||||
|
||||
Replace the full contents of `backend/internal/config/config.go` with:
|
||||
Replace the full contents of `../../../backend/internal/config/envconfig.go` with:
|
||||
|
||||
```go
|
||||
// Package config loads geniusrund's runtime infrastructure configuration
|
||||
@@ -1590,7 +1590,7 @@ Expected: the server starts (no "GARMIN_EMAIL required" error), `/api/profile` r
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
cd backend && git add internal/config/config.go cmd/geniusrund/main.go
|
||||
cd backend && git add internal/config/envconfig.go cmd/geniusrund/main.go
|
||||
git commit -m "feat: source Garmin credentials from the profile instead of env vars"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user