DHMemberPortal: make signup scaffolding writes best-effort (#283 bandaid)#284
Draft
rubin110 wants to merge 1 commit into
Draft
DHMemberPortal: make signup scaffolding writes best-effort (#283 bandaid)#284rubin110 wants to merge 1 commit into
rubin110 wants to merge 1 commit into
Conversation
Issue #283. Once add_member succeeds, the seven secondary JSONB writes (connections/status/forms/notes/access/authorizations/extras) run in a loop with per-step try/except so a transient failure no longer aborts the redirect to /signup/payment. Also bumps the 10s timeout to 20s on the seven secondary helpers in dhservices.py for cheap insurance against slow DHService responses. A failed scaffolding step leaves the corresponding JSONB column null; admin tooling can address that later. The user still reaches Stripe, which is the bandaid's only goal. Co-Authored-By: Claude Opus 4.7 <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.
Summary
Bandaid for #283.
/signup/submitwas non-atomic — 8 sequential HTTP calls inside onetry/except— so any transient failure afteradd_membersucceeded would abort the redirect to/signup/paymentand strand the user with a half-created row.get_access_token,get_member_id,add_member) still bounces the user to/signupon failure.add_memberreturns a member_id, the seven secondary JSONB writes (connections/status/forms/notes/access/authorizations/extras) run in a for-loop with per-steptry/except. Each step logs success at INFO and failure at ERROR; the loop never throws./signup/paymentonce the row exists.dhservices.pyfromtimeout=10→timeout=20as cheap insurance against slow DHService responses.What this PR does not do
/signup/resumeescape hatch for orphan members already in production (issue Signup: members sometimes never reach Stripe — non-atomic /signup/submit + no recovery path #283 option B). Open follow-up.add_update_*to return HTTP 5xx on internal failure (option C). Open follow-up.Known trade-offs
update_member_accessis also used by the dashboard Keys page profile save. The 20s timeout now applies there too. The worst case is a 20s synchronous Flask wait on a real DHService timeout (previously 10s); normal writes are sub-second.Verification
Manual on dev (
https://ps1-member.mime.starset.net) via Chrome devtools:Created new member with ID: N+ 7 ×Signup member N: <label> initialized).raise RuntimeErrormid-loop. User still reached/signup/payment. DB row hasforms=nullandnotes=nullas expected; other 5 columns populated. Logs show 2 ERROR lines + 5 INFO lines. Reverted before commit.Test plan
status->>'stripe_product_id'lands as expected via the ST2DH webhook for a real new signup (the scaffolding loop creates apendingstatus row; ST2DH writesstripe_product_idinto the same JSONB on payment)update_member_accessfrom the dashboard Keys tab still saves within the 20s ceiling🤖 Generated with Claude Code