Consent-ledger echo + re-consent click-through (tos-v1 phase 2)#2455
Closed
jjramirezn wants to merge 3 commits into
Closed
Consent-ledger echo + re-consent click-through (tos-v1 phase 2)#2455jjramirezn wants to merge 3 commits into
jjramirezn wants to merge 3 commits into
Conversation
Hotfix port to main of peanut-ui#2438 (branch was dev-based; every touched file is byte-identical between dev and main, so this is the same reviewed content squashed onto main). Pairs with peanut-api-ts hotfix/rain-poa-selfheal — deploy the API first. When the rain rail carries the sumsub:proof_of_address next-action, the card status screens (requires-info / rejected) render a primary "Upload proof of address" CTA driving a dedicated lightweight flow: resubmit action -> second SumsubKycWrapper -> inline initiation errors -> optimistic "we received your document" banner (auto-reset when the backend state takes over). Double-click guard; analytics tagged source: poa-self-heal. Full review trail on #2438.
feat(card): proof-of-address upload on stuck Rain applications
The backend's new consent_records ledger stores what the user was actually shown, so every acceptance surface now echoes the displayed document versions instead of letting the server assume: signup sends terms+privacy via the x-accepted-legal header (the ZeroDev SDK owns the register/verify body), card apply sends the exact regional doc set from CardTermsScreen, and versions+hashes are generated from the src/content legal frontmatter at build time — no hardcoded versions anywhere. Adds the ToS §17 re-consent flow: a blocking click-through modal when a published document version moves past the user's last provably-accepted one. Fails open — a dead consent endpoint never locks the app.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📝 WalkthroughWalkthroughThis change generates legal document metadata, adds consent APIs and document payload helpers, propagates consent records through signup and card applications, and mounts a re-consent modal for authenticated users. ChangesLegal consent tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AuthenticatedUser
participant ReConsentModal
participant consentApi
participant PostHog
AuthenticatedUser->>ReConsentModal: open mobile layout
ReConsentModal->>consentApi: getStatus
consentApi-->>ReConsentModal: documents needing acceptance
ReConsentModal->>PostHog: modal shown
AuthenticatedUser->>ReConsentModal: check and accept
ReConsentModal->>consentApi: accept documents
ReConsentModal->>PostHog: modal dismissed
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
Code-analysis diffPainscore total: 6224 → 6241.01 (+17.01) 🆕 New findings (46)
…and 26 more. ✅ Resolved (42)
…and 22 more. 📈 Painscore deltas (top movers)
|
Contributor
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
Contributor
Author
|
Superseded by the dev-based branch feat/tos-v1-consent-client. |
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.
Consent-ledger client: version echo + re-consent click-through (tos-v1 phase 2)
Summary
Frontend half of the consent ledger (peanut-api
consent_records). The app nowtells the backend exactly which legal-document revisions it displayed at every
acceptance surface, and gains the ToS §17 re-consent click-through.
scripts/generate-legal-versions.mjs(predev +prebuild, output committed) derives
slug → { version, hash }from thesrc/contentlegal frontmatter (last_updated) + sha256 of eachen.md.No more hardcoded versions anywhere; bumping the content submodule refreshes
the constants on the next build.
/passkeys/register/verifybody,so
useZeroDev.handleRegistersends the displayed terms+privacy versions viathe
x-accepted-legalheader (passkeyServerHeaders).rainApi.applyForCardacceptsacceptedDocuments;the card page sends the exact set CardTermsScreen showed for the user's
region (US: card-terms-us + card-esign + card-privacy; international:
card-terms-international + card-esign).
ReConsentModal(mounted in the mobile-ui layout) callsGET /users/consent/statusonce per session for authenticated users; when apublished version moved past the user's last provably-accepted one, it shows
a blocking
ActionModal(preventClose, checkbox gate) listing the updateddocs and records acceptance via
POST /users/consent/accept.src/services/consent.ts(no server actions).Backend coupling
Requires peanut-api PRs "consent ledger" + "re-consent endpoints". Safe to ship
in either order: the apply/signup echoes are optional fields/headers the old
backend ignores, and the consent-status fetch failing (404) just logs and never
blocks the app.
Risks
backend's status endpoint ships — by design (nobody has provable consent
yet); acceptance backfills the ledger for the whole user base. If product
wants a quieter rollout, gate the modal mount before merging.
a consent-status fetch failure keeps the app usable (fail-open).
handleApplygainedpendingTermsin its deps — callback identity nowchanges when the terms screen opens; downstream
useCallbacks alreadydepend on
handleApplyso behavior is unchanged.QA
pnpm dev→ predev regeneratessrc/constants/legal-versions.generated.ts(7 docs).
consent_recordsgetsterms+privacyrows withversion
2026-07-15and the sha256 hashes from the generated file.surface='card-apply'.shows the re-consent modal; links open the docs (web: new tab, native:
in-app browser); accept →
surface='re-consent'rows; modal neverreappears.
🤖 Generated with Claude Code
Summary by CodeRabbit