Skip to content

feat: gate mobile endpoints behind face enrollment, fix jsonb round-trip - #78

Merged
wailbentafat merged 1 commit into
developfrom
feat/onboarding-gate-and-audit-fixes
Aug 24, 2026
Merged

feat: gate mobile endpoints behind face enrollment, fix jsonb round-trip#78
wailbentafat merged 1 commit into
developfrom
feat/onboarding-gate-and-audit-fixes

Conversation

@wailbentafat

Copy link
Copy Markdown
Collaborator

Summary

  • Add require_onboarded_mobile_user dependency: every mobile endpoint except /auth/* and /enroll now returns 403 until the user has completed face enrollment (users.face_embedding is set).
  • Add is_onboarded to GET /user/auth/me and the avatar upload response so clients can branch on a single field instead of parsing 403 error strings.
  • Fix asyncpg/SQLAlchemy jsonb handling: register a jsonb type codec on connect so dict params bind correctly and jsonb columns decode back to dict. This was crashing audit_events writes outright, and silently mismatched typing on notifications/staff_notifications reads.
  • Add a dev-env fixed OTP (DEV_OTP_BYPASS_CODE, default 000000) for registration so local/mobile testing doesn't require a real inbox or the NATS email flow.

Test plan

  • Login/register verified end-to-end against local Postgres/Redis/NATS/MinIO stack
  • Confirmed non-onboarded user gets 403 on /photos, /notifications, /event/join, /event/me
  • Confirmed /auth/* and /enroll remain reachable pre-onboarding
  • Confirmed GET /user/auth/me returns is_onboarded: false/true correctly
  • Confirmed audit event writes/reads round-trip metadata as a dict with no DataError

- Add require_onboarded_mobile_user dependency: every mobile endpoint
  except /auth/* and /enroll now returns 403 until the user completes
  face enrollment (users.face_embedding is set).
- Add is_onboarded to GET /user/auth/me and the avatar upload response
  so clients can branch on a single field instead of parsing 403s.
- Fix asyncpg/SQLAlchemy jsonb handling: register a jsonb type codec on
  connect so dict params bind correctly and jsonb columns decode back
  to dict (was crashing audit_events writes, and silently mismatched
  on notifications/staff_notifications reads).
- Add a dev-env fixed OTP (DEV_OTP_BYPASS_CODE) for registration so
  local/mobile testing doesn't require a real inbox or NATS email flow.
@wailbentafat
wailbentafat merged commit 4158cb5 into develop Aug 24, 2026
1 check passed
@wailbentafat
wailbentafat deleted the feat/onboarding-gate-and-audit-fixes branch August 24, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant