Skip to content

Fix join-code redemption without collection-group dependency#19

Merged
nwang783 merged 1 commit into
mainfrom
codex/fix-team-join-lookup
Apr 12, 2026
Merged

Fix join-code redemption without collection-group dependency#19
nwang783 merged 1 commit into
mainfrom
codex/fix-team-join-lookup

Conversation

@nwang783
Copy link
Copy Markdown
Owner

Summary

  • add a top-level joinCodeLookups/{codeHash} document when issuing join codes so redemption no longer depends on a Firestore collection-group query
  • keep a legacy fallback for older join-code docs and backfill the lookup document on successful redemption
  • declare the missing Firestore collection-group index for joinCodes.codeHash so existing production join codes continue to work after deploy

Verification

  • node --test test/join-flow-api.test.cjs
  • npm test
  • npm run test:dashboard
  • npm run build:dashboard
  • npm run dev:up
  • npm run dev:seed
  • curl -s -X POST http://127.0.0.1:5001/nomergeconflicts/us-central1/api/teams/join -H 'content-type: application/json' --data '{"joinCode":"DLAP-YVYH-CGH9","seatName":"teammate-local-check"}'
  • verified in Firestore emulator that joinCodeLookups/<sha256(joinCode)> exists and teams/<teamId>/memberships contains teammate-local-check

Adversarial Review

  • checked backward compatibility for legacy join codes: old docs still redeem through the fallback path and now self-heal by writing the lookup doc
  • checked the primary risk path for production: existing join codes still need the new Firestore index deployed, which is included in this diff
  • checked failure behavior for stale lookup docs: the transaction now rejects missing join-code docs as invalid instead of creating a seat from partial state

@nwang783 nwang783 marked this pull request as ready for review April 12, 2026 01:13
@nwang783 nwang783 merged commit fdab010 into main Apr 12, 2026
3 checks passed
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