Make volunteer approval server-authoritative; unify identity resolution - #268
Merged
Conversation
Fixes the bug where an approved mentor/judge/volunteer/sponsor editing
their application was silently reset to isSelected=false (and could lose
check-in / refund state the same way).
- STAFF_OWNED_VOLUNTEER_FIELDS stripped from every self-service
submit/update in create_or_update_volunteer: isSelected, check-in
fields, refund bookkeeping, certificates, sent_emails. Deposit payment
fields (stripe_payment_intent_id, deposit_amount_cents,
deposit_disposition) deliberately excluded — the hacker Stripe return
sets those on /update. Also closes authenticated self-approval on the
create path (payload could override the isSelected=False seed).
- find_volunteer_by_caller_identity(): shared 3-way resolver (propel
UUID -> PropelAuth email -> OAuth user_id) now used by handle_get,
create_or_update_volunteer, and mentors' _find_mentor_volunteer.
Read and write matching the same docs stops edits from falling into
the create branch and spawning duplicate isSelected=False docs.
- All ten /api/{type}/application/<event>/{submit,update} routes are
@auth.require_user (were optional_user); identity comes from the
verified token only — the body user_id fallback is gone.
- _notifications_disabled(): ENVIRONMENT=test suppresses the
Slack/Resend fan-out — unit tests were posting real Slack messages
and attempting real Resend sends.
- Regression tests for all of the above (each verified to fail against
the old code); fixed test_update_volunteer's stale .update() assert
(code calls .set(merge=True)).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An approved mentor / judge / volunteer / sponsor who edited and re-submitted their application was silently un-approved — they vanished from approved lists, lost their check-in QR and mentor-panel access, and dropped out of attendance reporting.
Two causes:
create_or_update_volunteeronly preservedisSelectedwhen the key was absent from the payload, and four of five frontend forms shippedisSelected: falsefrom their initial form state (sponsor hardcoded it). Companion frontend PR removes those.Changes
STAFF_OWNED_VOLUNTEER_FIELDSstripped from every self-service submit/update:isSelected, check-in fields, refund bookkeeping,certificates,sent_emails. Deposit payment fields are deliberately excluded — the hacker Stripe return sets those on/update. Admin flows are unaffected (update_volunteer_selectionandupdate_hackathon_volunteersnever route through this function). Also closes authenticated self-approval on the create path.find_volunteer_by_caller_identity()— shared 3-way resolver now used byhandle_get,create_or_update_volunteer, and mentors'_find_mentor_volunteer(3 copies → 1). Email step uses the verified PropelAuth email only, never the form payload.optional_user→require_user; bodyuser_idfallback removed. The web forms already require login (RequiredAuthProvider), so no user-facing change.ENVIRONMENT=testnow suppresses the Slack/Resend notification fan-out — unit tests were posting real Slack messages and attempting real Resend sends.Testing
api/volunteers/tests/(was 11 passed + 1 pre-existing failure from a stale.update()assert — code calls.set(merge=True)).Deploy notes
isSelected == falsewithcheckInTimeset is an impossible state under normal flow).🤖 Generated with Claude Code