Skip to content

feat(invites): shared state-machine module (closes #2255) - #2325

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2255-invites
Nov 24, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
IVANLI2412:fix/issue-2255-invites

Conversation

@IVANLI2412

Copy link
Copy Markdown
Contributor

Closes #2255

Summary

Collapses every household-invite flow into one shared, typed state-machine module so the mobile app and backend can no longer drift.

  • backend/src/services/invites.ts (new, zero-dep, pure): single source of truth for states (draft | pending | accepted | declined | expired | revoked), events (send | accept | decline | expire | revoke), the frozen transition table, guards, and typed errors. Includes InviteError/InviteErrorCode, InviteConfig + frozen defaults, injectable clock (nowMs) for expiry, InviteMetrics/InviteLogger with no-op defaults, transition, canTransition, normalizeInvite, isInviteExpired, and createInviteMachine.
  • mobile/src/features/invites/index.ts (new): device-facing adapter that re-exports the backend machine verbatim (relative .ts import) and adds inviteStatusLabel, isTerminal, and buildInviteDeepLink.
  • Jest tests: backend/src/services/__tests__/invites.test.ts (38 tests) and mobile/src/features/invites/__tests__/index.test.ts (5 tests).

Only new files were added; no existing behavior was changed.

Verification

  • Node 26 type-stripping harness against the real .ts sources: RESULT: 41 passed, 0 failed
  • Jest suites (shim runner): backend 38 passed, 0 failed; mobile 5 passed, 0 failed (43 total)
  • Secrets scan (tools/check_secrets.py): [OK] — SECRETS_EXIT=0
  • Push verified: new branch fix/issue-2255-invites on IVANLI2412/SubTrackr.

Payouts

Base: 0xC5dD2Ea54FF138bb3f71D3466092eA31eF115868
Solana: DN3pfYEvdkoTBP4oaEVvemsr98fZPhDSAbfVfmewRGQ5
PayPal: ivanzenteno3@gmail.com

@github-actions
github-actions Bot merged commit 24483d2 into Smartdevs17:main Nov 24, 2026
7 of 27 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.

Collapse household invite flows into a shared state-machine module

1 participant