Skip to content

Fix invite link creation bugs#35

Merged
neyec merged 1 commit into
mainfrom
fix/invite-link-creation-fails
May 27, 2026
Merged

Fix invite link creation bugs#35
neyec merged 1 commit into
mainfrom
fix/invite-link-creation-fails

Conversation

@neyec

@neyec neyec commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix naive vs aware datetime comparison: invite.expires_at (naive from DB) was compared with datetime.now(UTC) (timezone-aware), causing a TypeError on the validate endpoint — making invite links unusable for registration.
  • Fix local time vs UTC: auth.py used datetime.now() (local time) instead of UTC for the expiration check, producing incorrect results on non-UTC servers.
  • Fix invite never marked as used: invite.used_by = user.id was set before db.flush(), so user.id was still None — invites were never consumed and could be reused indefinitely. Added db.flush() before the assignment.
  • Add invite test suite: 8 tests covering creation, validation, listing, deletion, and full registration-with-invite flow.

Test plan

  • All 28 backend tests pass (uv run pytest tests/ -v)
  • Ruff lint and format checks pass
  • Pre-commit hooks (gitleaks, ruff) pass
  • Full Docker Compose stack starts and invite flow verified in browser

🤖 Generated with Claude Code

- Fix TypeError from comparing naive (DB) and aware (UTC) datetimes by
  using consistent naive-UTC datetimes throughout
- Fix auth.py using local time instead of UTC for expiration checks
- Add db.flush() before setting invite.used_by so user.id is populated
- Add test suite for invite CRUD, validation, and registration flow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@neyec neyec merged commit dfef0dd into main May 27, 2026
6 checks passed
@neyec neyec deleted the fix/invite-link-creation-fails branch May 27, 2026 19:29
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