Generated 1 epic + 11 stories under docs/work/epics/ from the approved PRD docs/work/prds/dsr-consent-and-cookie-banner.prd.md. Stories cover subject-linkage types, ADR-018 audit enum amendment, core-consent foundation + impl + react, core-dsr (4 interfaces), core-api router composition, core-ui scaffold + CookieConsentBanner, auth signup migration, and documentation. Ready for `pnpm work dispatch --execute`.
2.8 KiB
2.8 KiB
id, epic, title, type, status, feature, depends-on, blocks, created, updated
| id | epic | title | type | status | feature | depends-on | blocks | created | updated | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 10-auth-signup-migration | dsr-consent-and-cookie-banner | auth signUp anonymous consent migration | technical-story | todo | auth |
|
|
2026-05-19T12:00:00Z | 2026-05-19T09:55:07.020Z |
Goal
Extend the template's auth.signUp use case to call extractAnonymousConsent + migrateAnonymousConsent when a __consent_state cookie is present, so a user's pre-signup banner choices persist into their account automatically.
Why
Without this integration, anonymous users who consented via the banner before signing up would lose their consent state at account creation — forcing them to re-consent or leaving analytics gated incorrectly. The migration call is the canonical example for downstream consumers implementing the same pattern in their own signUp use cases.
Done when
auth.signUpuse case callsextractAnonymousConsent(cookieHeader)after user-record creation; if a__consent_statecookie is present, callsmigrateAnonymousConsent({ userId, cookieState, bannerVersion, policyVersion }).- Response includes
Set-Cookie: __consent_state=; Max-Age=0to clear the anonymous cookie after migration. auth.signUp.use-case.test.tscovers: mock cookie header present →migrateAnonymousConsentcalled with correct args → audit entry hasmethod: "signup-migration"→ response cookie cleared; no cookie present →migrateAnonymousConsentnot called.RecordingConsentfromcore-testingis used for assertions (not a raw mock).pnpm typecheck && pnpm lint && pnpm test && pnpm conformance && pnpm fallow:audit && pnpm coverage:diffall pass.
In scope
packages/auth/src/use-cases/sign-up.use-case.ts— addextractAnonymousConsent+migrateAnonymousConsentcalls.packages/auth/src/use-cases/sign-up.use-case.test.ts— extend with migration scenarios.- Auth feature's DI binders — inject
IConsentdependency when present (guard with?.for consumers who haven't installedcore-consent).
Out of scope
- Anonymous consent storage in
users.consentStatedirectly from the banner — anonymous state lives in the cookie until this migration. - Post-migration analytics re-initialization — consumer's responsibility via
onConsentChangecallback.
Tasks
- Extend
auth.signUpuse case to callextractAnonymousConsent(cookieHeader)+migrateAnonymousConsent({ userId, cookieState, bannerVersion, policyVersion })when a__consent_statecookie is present, setSet-Cookie: __consent_state=; Max-Age=0in the response, and injectIConsentinto the use case deps (optional, guarded with?.); extendsign-up.use-case.test.tswithRecordingConsentto assert migration call shape, audit entrymethod: "signup-migration", and cookie-clear; all gates pass.