Commit Graph

322 Commits

Author SHA1 Message Date
33e3c093ad chore(work): finish 04-core-consent-implementation 2026-05-19 15:27:07 +02:00
e53f35a0c5 feat(core-consent): add handlers and consentRouter tRPC router
Protocol-agnostic handlers (grant, withdraw, isGranted, getCategories)
in core-consent/handlers/ call IConsent methods and return typed results.

consentRouter uses a consent-specific tRPC context (userId + consentFactory)
so each procedure can resolve the per-user IConsent instance at call time.
Auth middleware guards all four procedures and maps UnauthenticatedError →
UNAUTHORIZED via defineErrorMiddleware from core-shared (no local duplicate).

76 tests passing; new handler and router code at 100% branch coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 13:22:33 +00:00
ae4e0f2680 chore(work): tick task in 04-core-consent-implementation 2026-05-19 15:01:40 +02:00
c346f85bc8 chore(work): tick task in 04-core-consent-implementation 2026-05-19 14:53:51 +02:00
5792b7412a chore(work): finish 03-core-consent-foundation 2026-05-19 13:54:40 +02:00
1cab88916a feat(core-eslint): add no-undeclared-consent-check rule (conformance gate 12)
Extends the conformance ESLint layer with the consent-check rule:

- `no-undeclared-consent-check` (warn): `consent.isGranted("X")` in a
  use-case file must match a category declared in `manifest.requiresConsent`;
  also warns when requiresConsent is declared but no isGranted call is found.
- `_manifest-ast.js`: adds `parseManifestFully` which extracts top-level
  `name`, `requiredCores`, `requiresConsent`, and per-use-case maps from the
  manifest AST; `requiresConsent` extraction tested in `_manifest-ast.test.js`.
- `_rule-context.js` / `_rule-schema.js`: shared helpers extracted from the
  existing per-rule files so the new rule can resolve use-case name + feature
  root without duplication.
- Existing rules (`no-undeclared-audit`, `no-undeclared-event-publish`,
  `no-undeclared-analytics-event`) updated to use the shared helpers.
- `plugin.js` + `base.js` register the rule at warn severity.
- CLAUDE.md + conformance-quickref.md: rule count advanced from 11 → 12.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 11:51:30 +00:00
ef9cfd243e docs: seed PRD for security headers + rate-limit + SBOM (ADR-025 Epic C)
Implementation seed for ADR-025 Epic C: six security headers middleware
with nonce-based CSP in core-shared/security (Next + TanStack adapters),
fourth conformance channel for rate-limit in core-shared/rate-limit
(IRateLimit + RateLimited brand + multi-budget manifest field +
no-undeclared-rate-limit ESLint rule), CycloneDX SBOM step in
release-please.yml. auth.signIn backfilled as canonical rate-limit
reference. ADR-023 amendment for SBOM captured. Status: approved —
ready for pnpm work decompose.
2026-05-19 13:09:20 +02:00
9956d73b10 chore(work): tick task in 03-core-consent-foundation 2026-05-19 13:06:52 +02:00
f5d08dc84a chore(work): finish 02-audit-enum-amendment 2026-05-19 12:29:20 +02:00
dd339b11b1 feat(core-shared): extend audit action enum with consent and restriction types
Adds CONSENT_GRANT, CONSENT_WITHDRAW, RESTRICT, UNRESTRICT to the
AuditAction closed enum per GDPR Art. 7 and Art. 18 requirements.

core-consent and core-dsr optional cores (Epic B Stories 03/06) emit
these action types via core-audit's IAuditLog channel; the values must
exist in core-shared's enum before either optional core can be built.
No change to IAuditLog's interface surface — new values flow through
AuditEntry.action automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:16:30 +00:00
8cf9f4be98 chore(work): finish 01-subject-linkage-types 2026-05-19 12:13:16 +02:00
5abf7fe623 chore(work): decompose dsr-consent-and-cookie-banner epic
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`.
2026-05-19 11:55:05 +02:00
ae886a4499 docs: seed PRD for DSR + consent + cookie banner epic (ADR-025 Epic B)
Implementation seed for ADR-025 Epic B: two new optional cores
(@repo/core-dsr with 4 interfaces, @repo/core-consent with IConsent +
ConsentChecked brand + requiresConsent manifest field), CookieConsentBanner
in core-ui with EU-prominence defaults, subject-linkage types in
core-shared, ADR-018 amendment adding 4 new audit action types
(CONSENT_GRANT/WITHDRAW + RESTRICT/UNRESTRICT). 15 user stories ordered
by the in-epic sequencing hints. Status: approved — ready for
pnpm work decompose.
2026-05-19 11:41:25 +02:00
07caaa1695 chore(work): finish epic compliance-manifests-pii-retention-subprocessors 2026-05-18 22:23:29 +02:00
879b0215c3 docs(compliance): add docs/compliance reference examples and README
Adds docs/compliance/ as the canonical onboarding reference for the
compliance module, covering every field in each generated YAML artifact
with inline annotations and explaining the docs/compliance/ (examples)
vs compliance/ (live artifacts) split.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 20:22:01 +00:00
188625b4a8 chore(work): finish 07-pre-commit-and-ci-integration 2026-05-18 22:16:22 +02:00
add54f14ef chore(work): finish 06-compliance-generator-scripts 2026-05-18 22:12:12 +02:00
3ec30507d3 chore(work): tick task in 06-compliance-generator-scripts 2026-05-18 22:02:54 +02:00
d8dbc99bab chore(work): tick task in 06-compliance-generator-scripts 2026-05-18 21:53:18 +02:00
ab44b2f16d chore(work): tick task in 06-compliance-generator-scripts 2026-05-18 21:47:27 +02:00
3a73634d71 chore(work): finish 05-backfill-template-collections 2026-05-18 21:21:31 +02:00
97bf27b6db chore(work): tick task in 05-backfill-template-collections 2026-05-18 21:18:07 +02:00
68240ad0f3 chore(work): tick task in 05-backfill-template-collections 2026-05-18 21:14:04 +02:00
b5c16a76c1 chore(work): tick task in 05-backfill-template-collections 2026-05-18 21:09:27 +02:00
2f1aa849e7 chore(work): tick task in 05-backfill-template-collections 2026-05-18 21:05:30 +02:00
464df9aa9b chore(work): finish 04-retention-purge-job 2026-05-18 20:58:23 +02:00
d326270e1e chore(work): finish 03-adr-022-amendment-and-evaluate-library-skill 2026-05-18 20:46:04 +02:00
98d96d2e19 docs(tooling): add sub-processor discriminated union to ADR-022 and traces
Amends ADR-022 §9 with the `is-sub-processor` / `processes-pii` discriminated
union spec, including the five conditional fields required when a library is a
true GDPR sub-processor. Updates the evaluate-library skill to prompt for these
fields during every trace authoring pass and adds the updated frontmatter
template. Backfills all nine existing library-decision traces with the new
fields; payload gets `processes-pii: true` (self-hosted CMS that stores user
data); all pure in-process libraries get `false / false`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:44:09 +00:00
8486037f20 chore(work): finish 02-eslint-rule-pii-declaration-complete 2026-05-18 20:35:43 +02:00
1eb32ab23b feat(core-eslint): add pii-declaration-must-be-complete rule
Adds the `conformance/pii-declaration-must-be-complete` ESLint rule at
warn severity. The rule detects `custom: { pii: { ... } }` blocks in
Payload config files and warns when any of the four required sub-fields
(`category`, `purpose`, `exportable`, `restrictable`) is missing.

Incomplete PII declarations can produce incorrect audit reports —
sub-second editor feedback catches the gap before it reaches
compliance/data-map.yml.

- Rule + 7 RuleTester fixtures (complete passes, each missing field
  warns, non-pii custom block is no-op, malformed custom.pii is no-op)
- Registered in plugin.js + base.js at "warn"
- Conformance rule count bumped 7 → 8 in CLAUDE.md +
  conformance-quickref.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 18:33:48 +00:00
fa1a10c88c chore(work): finish 01-pii-retention-type-primitives 2026-05-18 20:29:17 +02:00
c298f396b1 chore(work): decompose compliance-manifests epic
Generated 1 epic + 8 stories under docs/work/epics/ from the approved
PRD docs/work/prds/compliance-manifests-pii-retention-subprocessors.prd.md.
Stories cover type primitives, ESLint rule, ADR-022 amendment, retention
purge job, template backfill, three generator scripts, pre-commit + CI
integration, and docs/compliance/ reference files. Ready for
`pnpm work dispatch --execute` to begin implementation.
2026-05-18 20:06:14 +02:00
d3278c0aa1 docs: seed PRD for compliance manifests epic (ADR-025 Epic A)
Implementation seed for ADR-025 Epic A: declarative PII inventory +
retention + sub-processor manifests with three generators, pre-commit +
CI drift detection, background purge job, and ADR-022 trace
frontmatter extension for sub-processor fields (discriminated union).
Eleven user stories ordered for the decomposer; five open questions
with recommendations. Status: approved — ready for pnpm work decompose.
2026-05-18 19:55:37 +02:00
52a1c5fa3a docs: introduce EU compliance baseline strategy (ADR-025)
ADR-025 plans 4 epics that raise the template's DPA/GDPR coverage from
~50% (ADR-017/018/022/023/024) to ~80%. Adds two optional cores
(core-dsr, core-consent), a fourth conformance channel (rate-limit),
three new manifest fields, three new generators with CI drift gates,
and a docs/compliance/ + compliance/ split for templates vs evidence.

Documents the audit ↔ DSR sibling-not-overlap distinction (audit
records access; DSR acts on the underlying data). Four explicit
deferrals with revisit triggers (RBAC, MFA, breach detection, Art. 22).

Glossary updated with DSR, Consent, Rate-limit, PII inventory, Retention
policy, Sub-processor, docs/compliance/ vs compliance/ entries.
2026-05-18 19:30:53 +02:00
0c6f60fccf chore(work): finish epic product-analytics-channel 2026-05-18 18:05:29 +02:00
efd654e552 docs(core-analytics): update conformance-quickref, CLAUDE.md, template-tiers
Add the seventh ESLint rule (no-undeclared-analytics-event) to the rule
table in conformance-quickref.md and the drift patterns section. Update
the rule count in CLAUDE.md from six to seven. Add core-analytics to the
optional-cores table in template-tiers.md pointing at ADR-024 and the
new analytics guide.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 16:04:19 +00:00
afe32c7d99 chore(work): tick task in 09-documentation 2026-05-18 18:03:08 +02:00
47600bad59 docs(core-analytics): add analytics.md guide
Covers server-side wiring (BindContext.analytics → withAnalytics brand
wrapping), client-side wiring (AnalyticsProvider + useAnalytics), vendor
evaluation gate (ADR-022 /evaluate-library), and the PII boundary
divergence from ADR-017 observability policy (ADR-024 §PII boundary).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 16:01:26 +00:00
940a804944 chore(work): finish 08-react-provider 2026-05-18 17:56:52 +02:00
065ca1b6aa chore(work): finish 07-eslint-rule-no-undeclared-analytics-event 2026-05-18 17:44:55 +02:00
0f8e3b8caf chore(work): finish 06-analytics-protocol-bind-context 2026-05-18 17:40:19 +02:00
68d3d90d2d chore(work): finish 05-assert-feature-conformance-analyzed 2026-05-18 17:36:51 +02:00
81f75f756e chore(work): finish 04-manifest-schema-and-wire-use-case 2026-05-18 17:15:38 +02:00
ff1e0b052c chore(work): tick task in 04-manifest-schema-and-wire-use-case 2026-05-18 13:59:14 +02:00
edf354318b chore(work): finish 03-analyzed-brand-and-with-analytics-wrapper 2026-05-18 13:55:06 +02:00
a5ab698b41 chore(work): tick task in 03-analyzed-brand-and-with-analytics-wrapper 2026-05-18 13:46:48 +02:00
92294bc7ff chore(work): finish 02-recording-analytics 2026-05-18 13:38:16 +02:00
1434fe9d82 chore(work): finish 01-scaffold-core-analytics-package 2026-05-18 13:33:06 +02:00
80c702eb20 chore(work): tick task in 01-scaffold-core-analytics-package 2026-05-18 13:29:55 +02:00
b8d4cfe907 chore(work): decompose product-analytics-channel epic
Generated 1 epic + 9 stories under docs/work/epics/ from the approved
PRD docs/work/prds/product-analytics-channel.prd.md. Stories follow the
sequencing hints from the PRD (brand+wrapper → manifest+wireUseCase →
assertFeatureConformance → BindContext+ESLint → React provider → docs).
Ready for `pnpm work dispatch --execute` to begin implementation.
2026-05-18 12:46:25 +02:00