feat: AM-3..AM-6 strip SWIFTLY_BEARER_TOKEN env var, delete superseded script, refresh docs

AM-3: SWIFTLY_BEARER_TOKEN removed from .env.example, .env.test (local),
docker-compose.yml service env, and Settings (backend/app/config.py).
The scraper docstring is updated to reflect the auto-mint path.

AM-4: scripts/refresh_swiftly_token.py (commit ccfb38a, seleniumbase
click-through capture) deleted; superseded by swiftly_auth.py.

AM-5: docs refreshed.
- spec status header → "Implemented 2026-05-06" with live-verification
  evidence
- HANDOFF.md TL;DR + caveats #2/#3 collapsed; replaced with the
  auto-mint failure-modes caveat; "Suggested next move" rewritten
  pointing to Phase 5 orchestration; file-map and last-updated touched
- ORIENTATION.md env-var section updated (no bearer var) + footer

AM-6 verification gate (run 2026-05-06):
- pytest -q tests/ → 92/92 green (88 prior + 4 new swiftly_auth)
- POST /api/admin/scrape → status=success, items_scraped=10928 in 44s
- grocery_item rows: 9980 (after dedup-by external_id)
- ingredient_grocery_match rows: 29779 (matcher post-hook populated)
- Container env confirmed clean of SWIFTLY_BEARER_TOKEN

The system now scrapes, matches, and generates plans without any
operator-managed credential. Live JWT lifecycle: Firebase REST anon
signUp → cache for ~55min → re-mint as needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 15:47:15 -07:00
co-authored by Claude Opus 4.7
parent dfd79a9d08
commit 95b8e0c1b5
8 changed files with 38 additions and 347 deletions
+4 -5
View File
@@ -13,14 +13,13 @@ RECIPES_EMAIL=you@example.com
# Lucky California
LUCKY_CA_URL=https://luckysupermarkets.com
# Swiftly product API (Lucky CA backend). Token expires hourly; capture a
# fresh one from the luckysupermarkets.com network panel on any
# /search/api/v1 request and paste it here. The scraper aborts with a
# FAILED ScrapeLog row whose error_message asks for a refresh on 401.
# Swiftly product API (Lucky CA backend). The bearer JWT is auto-minted
# on demand via Firebase REST anon-signUp — see
# backend/app/services/swiftly_auth.py and
# docs/specs/2026-05-06-swiftly-token-auto-mint.md. No env var needed.
LUCKY_STORE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