Phase 2c: Sender registry + self-service Gmail re-auth #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
plan-pal-e-mail→ Phase 2cRepo
forgejo_admin/pal-e-mailUser Story
As a platform admin (Lucas)
I want to see which email senders are healthy vs expired and re-authorize them from a browser
So that I don't need SSH + kubectl to manage Gmail OAuth tokens
Context
Gmail OAuth tokens expire (Google Cloud project in testing mode = 7-day refresh token expiry). Currently re-auth requires manual browser flow + kubectl cp to seed token files on the PVC. Phase 2c moves tokens to Postgres (backed up via CNPG), adds a sender management API, and provides a browser-based re-auth flow. When a send fails with 401, the sender status flips to expired. Lucas hits the re-auth endpoint, opens the Google consent URL, authorizes, callback saves new token to DB. Self-service, no CLI required.
File Targets
Files to create:
src/pal_e_mail/models.py— add Sender model (alias, gmail_account, credentials_json, token_json, status, last_refreshed_at, project)src/pal_e_mail/routes/senders.py— GET /senders, GET /senders/{alias}, POST /senders/{alias}/auth, GET /senders/callback, DELETE /senders/{alias}src/pal_e_mail/services/token_store.py— Postgres-backed token load/save adapter for gmail-sdkalembic/versions/003_senders.py— migration for senders tableFiles to modify:
src/pal_e_mail/services/sender.py— use Postgres token store instead of filesystem, update sender status on failuresrc/pal_e_mail/main.py— include senders routersrc/pal_e_mail/config.py— add google_client_id, google_client_secret settingsAcceptance Criteria
Test Expectations
cd ~/pal-e-mail && .venv/bin/pytest tests/ -vConstraints
Checklist
Related
project-pal-e-mail— parent projectplan-pal-e-mail— parent plan Phase 2cforgejo_admin/pal-e-mail#3— Phase 2 (predecessor)reference_gmail_oauth— memory note on current re-auth procedure