Public Access
docs: embed AM-1..AM-6 task list in HANDOFF.md for fresh-agent pickup
Breaks the auto-mint spec into 6 ordered, sized tasks with an explicit halt-for-approval boundary at AM-2 (live scrape verification before removing the env var). Restates the verified prerequisites (config.json publicly readable; Firebase signUp returns valid JWT with proper headers; Swiftly accepts the minted token) so a fresh agent doesn't have to re-discover them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+21
-4
@@ -147,9 +147,25 @@ docker compose --env-file .env.test exec backend \
|
|||||||
|
|
||||||
## Suggested next move
|
## Suggested next move
|
||||||
|
|
||||||
**Swiftly token auto-mint first.** Phases 4 (thin slice) and 9 are both shipped — the project's reason to exist is real. The remaining operator toil is the hourly bearer-token refresh. The fix is fully designed in `docs/specs/2026-05-06-swiftly-token-auto-mint.md`: ~2-3 hours, no new deps, replaces `SWIFTLY_BEARER_TOKEN` env var with a process-local cache that mints fresh JWTs from Firebase via REST. Eliminates manual capture entirely. Do this before extending to Phase 5 (orchestration) so the weekly cycle can run unattended.
|
**Swiftly token auto-mint first.** Phases 4 (thin slice) and 9 are both shipped — the project's reason to exist is real. The remaining operator toil is the hourly bearer-token refresh. Fully designed in `docs/specs/2026-05-06-swiftly-token-auto-mint.md`: ~2-3 hours, no new deps, replaces `SWIFTLY_BEARER_TOKEN` env var with a process-local cache that mints fresh JWTs from Firebase via REST. Eliminates manual capture entirely.
|
||||||
|
|
||||||
After that, in priority order:
|
### Pre-broken-down task list (start here)
|
||||||
|
|
||||||
|
A fresh agent should pick these up in order. Halt at the AM-2 boundary to verify a real-world live scrape before stripping the env var.
|
||||||
|
|
||||||
|
- [ ] **AM-1: `swiftly_auth.py` + unit tests.** New module `backend/app/services/swiftly_auth.py` with `get_token()`, `mint_anonymous_token()`, process-local cache `(token, exp)`, new `SwiftlyAuthMintError`. Tests at `backend/tests/test_swiftly_auth.py`: 4 unit tests covering mint, cache hit, near-expiry re-mint, non-200 → error. ~80 lines, ~1 hr.
|
||||||
|
- [ ] **AM-2: Wire into `lucky_ca_scraper.py`.** Replace `settings.SWIFTLY_BEARER_TOKEN` lookup with `get_token()`. Live-verify via `scripts/spike_swiftly_ingest.py --confirm-live`. **Halt here** for user confirmation before AM-3. ~30 min.
|
||||||
|
- [ ] **AM-3: Remove `SWIFTLY_BEARER_TOKEN` env var.** Drop from `.env.example`, `.env.test`, `docker-compose.yml`, `app/config.py` Settings, `.github/workflows/ci.yml`. Optional: add `SWIFTLY_FIREBASE_CONFIG_URL` (default `https://luckysupermarkets.com/config.json`). ~15 min.
|
||||||
|
- [ ] **AM-4: Delete superseded seleniumbase script.** `rm scripts/refresh_swiftly_token.py`; commit `ccfb38a` stays in history for context. ~5 min.
|
||||||
|
- [ ] **AM-5: Refresh docs.** `docs/HANDOFF.md` (remove caveats #2/#3, mark spec implemented), `docs/ORIENTATION.md` env-var section + footer, `docs/specs/2026-05-06-swiftly-token-auto-mint.md` status header → "Implemented". ~15 min.
|
||||||
|
- [ ] **AM-6: Verification gate.** Full `pytest -q tests/` (expect 92+ green: 88 prior + 4 new); live scrape end-to-end via `POST /api/admin/scrape` returning success with item count > 0; matcher confirms `ingredient_grocery_match` rows populated. ~20 min.
|
||||||
|
|
||||||
|
**Verified prerequisites** (already validated 2026-05-06):
|
||||||
|
- `https://luckysupermarkets.com/config.json` is publicly readable; `firebaseApiKey = AIzaSyCnG97lkCEUvVTcRdSEJ6looOPQgX0WE2U`
|
||||||
|
- `POST identitytoolkit.googleapis.com/v1/accounts:signUp?key=<API_KEY>` with `Origin: https://luckysupermarkets.com` + `Referer: https://luckysupermarkets.com/` returns a valid JWT (`iss=https://securetoken.google.com/swiftly-lu-prod`, `aud=swiftly-lu-prod`, `provider=anonymous`, 3600s TTL)
|
||||||
|
- Swiftly API accepts the minted JWT (verified: 400 "Category is required" on a malformed test, NOT 401)
|
||||||
|
|
||||||
|
### After AM-6, in priority order
|
||||||
|
|
||||||
1. **Phase 5 — meal-planner orchestration.** Chain scrape → generate → email → vote → finalize on a weekly cadence. APScheduler container with `--workers 1` was the original plan. All the parts exist (scrape, generate, email-stub, approval round-trip); nothing chains them.
|
1. **Phase 5 — meal-planner orchestration.** Chain scrape → generate → email → vote → finalize on a weekly cadence. APScheduler container with `--workers 1` was the original plan. All the parts exist (scrape, generate, email-stub, approval round-trip); nothing chains them.
|
||||||
2. **Phase 6 — SendGrid.** Replace the `ConsoleEmailBackend` JSONL stub with real SendGrid. Templates: meal proposal, T-24h reminder, confirmation, denial. `from_email`/`reply_to` config still needs adding to Settings.
|
2. **Phase 6 — SendGrid.** Replace the `ConsoleEmailBackend` JSONL stub with real SendGrid. Templates: meal proposal, T-24h reminder, confirmation, denial. `from_email`/`reply_to` config still needs adding to Settings.
|
||||||
@@ -162,10 +178,11 @@ Brainstorm with the user before committing to non-trivial scope. Use the `superp
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Open tasks (carried over from recovery)
|
## Open tasks
|
||||||
|
|
||||||
| ID | Subject | Priority |
|
| ID | Subject | Priority |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|
| AM-1..AM-6 | Swiftly token auto-mint (see Suggested next move above) | **Top — start here** |
|
||||||
| #8 | `ScrapeStatus` enum could use a distinct `QUEUED` value | Cosmetic |
|
| #8 | `ScrapeStatus` enum could use a distinct `QUEUED` value | Cosmetic |
|
||||||
|
|
||||||
Other tasks in the recovery session were closed. See `.agent/phase-summaries/` for the detailed write-ups of each phase (R1A test harness, R1B+D auth+paths, R1C async scrape, R2A live scrape, R2B email approval, R3-0 Swiftly ingestion).
|
Other tasks in the recovery session were closed. See `.agent/phase-summaries/` for the detailed write-ups of each phase (R1A test harness, R1B+D auth+paths, R1C async scrape, R2A live scrape, R2B email approval, R3-0 Swiftly ingestion).
|
||||||
@@ -234,4 +251,4 @@ docs/specs/
|
|||||||
|
|
||||||
Trust the tests. Trust the live runs. Don't trust prose claims that something is "complete" without running the verification gate yourself. The recovery happened because the prior agent did the latter without the former.
|
Trust the tests. Trust the live runs. Don't trust prose claims that something is "complete" without running the verification gate yourself. The recovery happened because the prior agent did the latter without the former.
|
||||||
|
|
||||||
Last updated: 2026-05-06.
|
Last updated: 2026-05-06 — Phase 9 shipped; auto-mint design + AM-1..AM-6 task list embedded for fresh agent handoff.
|
||||||
|
|||||||
+1
-1
@@ -154,4 +154,4 @@ A `.env.test` template lives in the repo root (gitignored) for local stack runs.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Last updated: 2026-05-06 — Phase 9 shipped (88/88 pytest green); Swiftly token auto-mint designed (`docs/specs/2026-05-06-swiftly-token-auto-mint.md`) and queued as the next implementation pass.
|
Last updated: 2026-05-06 — Phase 9 shipped (88/88 pytest green); Swiftly token auto-mint designed (`docs/specs/2026-05-06-swiftly-token-auto-mint.md`) and broken into AM-1..AM-6 in `docs/HANDOFF.md` for fresh-agent handoff.
|
||||||
|
|||||||
Reference in New Issue
Block a user