Skip to content

A/tl 09 consent enrollment - #32

Merged
gholapksh merged 2 commits into
mainfrom
a/tl-09-consent-enrollment
Nov 8, 2026
Merged

gholapksh merged 2 commits into
mainfrom
a/tl-09-consent-enrollment

Conversation

@gholapksh

Copy link
Copy Markdown
Collaborator

Part of #9 (A side; D's screens merged in #24).

Adds private profile, agent_contact and agent_decline tables.

  • enrollPreparedness(enrollmentId, medicalNeed, backupDevice, address, preferredContact): resident session only; a retry is a no-op; a second profile is a conflict.
  • requestAgentContact(consentId): only after delivery; a retry is a no-op; a second request is a conflict; after a skip it returns "conflict: the resident skipped. Nothing was saved."
  • skipAgentContact(): records the decline, creates no lead; a retry is a no-op; a conflict after opting in.
  • Views: my_profile, my_agent_request, my_agent_decline, coordinator_profiles, and coordinator_registry_stats (registrations and opt-ins counted separately; skips don't change opt-ins). Coordinators never see leads, and dispatch never reads consent.

Proof: npm ci && npm --prefix spacetimedb ci && spacetime start, then npm run stdb:reset:local && npm run check:tl09; expect PASS: TL-09 enrollment and agent contact. TL-01, TL-05 and TL-06 still pass, including on a trial merge with main 54a29f0.

Status: live locally; Maincloud needs a republish (new tables). Enrollment requires the household's resident invite (no public signup).

Next: D swaps the fixture's requestAgentContact, Skip and registration calls for these reducers and views. D's form also collects name, age and phone, which the server doesn't store.

🤖 Generated with Claude Code

CYB101IRA and others added 2 commits November 7, 2026 22:03
Part of #9 (A side; D's screens are PR #24). Adds two private tables:
`profile` (one free preparedness profile per household: medical need,
backup device, address, preferred contact) and `agent_contact` (at most
one consented lead per household).

- `enrollPreparedness(enrollmentId, medicalNeed, backupDevice, address,
  preferredContact)`: resident session only; a retry is a no-op; a second
  profile for the household is a conflict.
- `requestAgentContact(consentId)`: resident session only; offered only
  after that household has a delivered job; a retried consentId is a no-op;
  a second consentId is a conflict. Skip is client-side and creates nothing.
- Views: `my_profile`, `my_agent_request` (resident receipt),
  `coordinator_profiles`, and `coordinator_registry_stats` with
  registrations and agent opt-ins counted separately. Coordinators never
  see the leads. Dispatch never reads profiles or leads.

Proof: `npm ci && npm --prefix spacetimedb ci && spacetime start`, then
`npm run stdb:reset:local && npm run check:tl09`; expect
`PASS: TL-09 enrollment and agent contact`. TL-01, TL-05 and TL-06 still
pass.

Status: live locally; Maincloud needs a republish (new tables). Enrollment
requires the household's resident invite; no public signup.

Next: D replaces the fixture `requestAgentContact` and registration in
PR #24 with these reducers and views.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds `skipAgentContact()` (resident session only) and a private
`agent_decline` table. A skip records the decline and creates no lead; a
retry is a no-op; skipping after opting in is a conflict. After a skip,
`requestAgentContact` returns
"conflict: the resident skipped. Nothing was saved." so a late or stray
request can never become a lead. Skips never change `agentOptIns`. New
resident view `my_agent_decline` lets the screen show "Skipped" after a
reload. This matches D's fixture rule in b09e11a.

check:tl09 now covers: skip creates no lead (and a retry adds nothing),
request after skip is that conflict with the opt-in count unchanged, skip
after opt-in is a conflict, and a session without a role cannot skip.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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