Commit Graph

165 Commits

Author SHA1 Message Date
e6d9600fbe docs(work): scaffold conformance-hardening-v1 epic + stories 2026-05-13 07:33:00 +02:00
87da671432 docs(work): close story 01 + agent-workflow-docs-v1 epic 2026-05-13 07:29:06 +02:00
4966191c8b docs(guides): conformance-quickref single-page agent reference 2026-05-13 07:28:46 +02:00
798281dd14 docs(guides): tdd-workflow links conformance gates 2026-05-13 07:28:16 +02:00
efcb65e726 docs(guides): scaffolding-a-feature notes conformance-ready output 2026-05-13 07:28:02 +02:00
cc6f87e6e2 docs(guides): adding-a-feature reflects manifest-first ordering 2026-05-13 07:27:52 +02:00
5cc59e79db docs(work): scaffold agent-workflow-docs-v1 epic + story 01 2026-05-13 07:27:04 +02:00
9177d1f1db docs(work): close story 06 + conformance-system-v1 epic 2026-05-13 00:11:32 +02:00
81a075a9b9 docs(work): story 06 — feature migrations 2026-05-13 00:08:37 +02:00
7d38ff3bb9 plan(conformance): milestone vi — feature migrations 2026-05-13 00:06:48 +02:00
5bf9a140ed docs(work): close story 05 — generator updates 2026-05-13 00:04:56 +02:00
8da21c0405 docs(work): story 05 — generator updates 2026-05-13 00:02:05 +02:00
19611fb92c plan(conformance): milestone v — generator updates 2026-05-13 00:00:32 +02:00
f374d8b874 docs(work): close story 04 — CI drift gate 2026-05-12 23:58:51 +02:00
a0b2ecee2b docs(work): story 04 — CI drift gate 2026-05-12 23:56:34 +02:00
b5771fc4ba plan(conformance): milestone iv — CI drift gate 2026-05-12 23:55:14 +02:00
a07e62befd docs(work): close story 03.b — AST-aware ESLint rules
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 23:53:13 +02:00
bfb2324dd9 docs(work): story 03.b — AST-aware ESLint rules 2026-05-12 23:48:35 +02:00
fb23980d85 plan(conformance): milestone iii.b — AST-aware ESLint rules 2026-05-12 23:47:18 +02:00
654f2b2a02 docs(work): close story 03.a — structural ESLint rules 2026-05-12 23:25:30 +02:00
ff83769b30 docs(work): story 03.a — structural ESLint rules 2026-05-12 23:16:52 +02:00
f22f747aa9 plan(conformance): milestone iii.a — structural ESLint rules
10-task plan for standing up the conformance ESLint plugin in
@repo/core-eslint and shipping three structural rules:

- feature-must-have-manifest (warn): use-case files require a manifest
- usecase-must-have-test-file (error): TDD sibling test enforcement
- required-cores-installed (error): manifest cores ↔ workspace.yaml

Scope deliberately excludes manifest-AST analysis (no-undeclared-event-
publish, no-undeclared-audit) — those require parsing the manifest's TS
source as JS and walking the use-case AST, deferred to plan iii.b.

Uses regex-based manifest source extraction to avoid pulling in the
TypeScript compiler API at lint time. Manifest shape is constrained by
the literal `as const` form that defineFeature enforces, so the regex
path is sufficient.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 23:15:35 +02:00
046bd0829e docs(work): close story 02 — assertFeatureConformance + boot wiring 2026-05-12 22:54:45 +02:00
198765ff06 docs(work): story 02 — assertFeatureConformance + boot wiring 2026-05-12 22:36:18 +02:00
31d5123737 plan(conformance): milestone ii — assertFeatureConformance + boot wiring
12-task implementation plan for the runtime boot-time check of the
conformance system. Reifies the phantom-type brands from milestone i as
non-enumerable runtime markers via Object.defineProperty, and ships
assertFeatureConformance(container, manifest, symbols, ctx) which walks
the manifest, resolves each use case from the feature's container, and
throws ConformanceError synchronously when a binding is missing a
required brand.

Per-feature self-assertion: each bindProductionX(ctx) calls
assertFeatureConformance at its tail, so the boot check runs once per
feature and is forward-compatible with future apps wiring those binders.

Also bundles the two forward-looking items the milestone-i reviewer
flagged (re-export authManifest from auth root barrel; TODO breadcrumb
in withAudit for future automation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 22:33:20 +02:00
0aa5f0633d docs(work): close story 01 — defineFeature + brands + auth.signIn proof 2026-05-12 21:53:17 +02:00
4976352354 docs(work): story 01 — defineFeature helper + brands 2026-05-12 21:25:28 +02:00
b2dfd91367 docs(work): scaffold docs/work and conformance-system-v1 epic 2026-05-12 21:24:03 +02:00
31906b9e3e plan(conformance): milestone i — defineFeature + brands + auth.signIn proof
13-task implementation plan for the type-level seam of the conformance system.
Ships brand types (Instrumented/Captured/Audited), defineFeature helper,
ProductionUseCase branded slot, withAudit wrapper, authManifest, and rebinds
auth.signIn through the branded slot — with a negative type test asserting
unwrapped factories are rejected at the slot.

Each task is a single red→green TDD cycle with one commit. Companion
docs/work/conformance-system-v1/ epic + story records are created early in
the plan so subsequent agents have full context when picking up later
stories.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 21:18:23 +02:00
9576987637 docs(architecture): agent-first workflow design + work-shape guides
Captures the design from the brainstorm session on agent-first development
in this template. Architecture doc covers the four interlocking pillars:

- Conformance engine (manifest + brands + ESLint + boot + CI gate)
- Agent workflow (PRD -> Epic -> Story -> Task; manifest-first ordering;
  TDD per slice; in/out scope at every level)
- Local task system at docs/work/ (filesystem markdown, derived committed
  _state.json, single-writer orchestrator rule)
- Sandcastle orchestrator (implementer + reviewer loop, DAG-respecting,
  configurable retry cap)

Work-shape guides extend the architecture doc with operational detail for
frontend work (atomic design, Storybook-as-spec, component + Playwright
screenshot test gates, Storybook MCP reviewer integration) and
infrastructure work (ADR-first flow, dedicated ADR elicitation skill,
optional core packages vs. new infrastructure layers).

Phasing is conformance-first: build the enforcement system manually, then
build the dispatch substrate, then migrate remaining features through it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 21:08:44 +02:00
63d54dcddc docs(architecture): feature-conformance interactive explainer + extensions
Adds the interactive HTML explainer for the feature-conformance enforcement
design, covering the four layers (TS brands, ESLint, boot assertion, CI gate),
manifest playground, mistake catalog, layer composition, build-order milestones,
anchor points in the repo, and an "extensions" section on sharper AST checks
and code-conventions enforcement.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 21:08:34 +02:00
c5c1b1b845 docs(architecture): fix ADR slug refs in audit explainer footer
The agent that produced the explainer guessed three ADR filenames
(adr-014-instrumentation-interfaces.md, adr-017-otel-migration.md,
adr-015-events-jobs.md). The actual files use different slugs.
2026-05-11 17:16:24 +02:00
b76483c4f2 docs(architecture): audit-and-compliance HTML explainer + sibling crosslinks 2026-05-11 17:15:12 +02:00
7c915cb447 docs(architecture): surface core-audit + DPA across architecture docs
Touches the deeper architecture surfaces the Phase 6 sweep skipped:

- overview.md: split must-have (core-shared, core-cms, core-api) from
  optional (core-trpc, core-ui, core-realtime, core-events, core-audit);
  add core-audit to the Five tags optional list
- dependency-flow.md: extend the bindAll diagram with resolveAudit;
  add auditLog row to the BindContext table; rename the
  TRACER/LOGGER/METRICS heading to include AUDIT (ADR-018); note the
  R52-style boundary rule for @repo/core-audit (consume via protocol)
- vertical-feature-spec.md: target-state section now states 3 must-have
  + 5 optional cores; tag matrix includes the optional cores; bind-
  production signature destructure includes auditLog
- di-explainer.html: §08 instrumentation gains an IAuditLog block + the
  Wiring path tree shows resolveAudit + auditLog in ctx
- testing-strategy.md: RecordingAuditLog reference + reset() guidance
2026-05-11 17:06:58 +02:00
a1b54ad833 docs: surface core-audit as 5th optional package across discovery points 2026-05-11 16:41:20 +02:00
ecb8dd65f4 docs(guide): audit-and-compliance how-to guide 2026-05-11 16:38:23 +02:00
2b0c54c013 docs(adr): ADR-018 audit logging & DPA compliance 2026-05-11 16:36:34 +02:00
ac8dfcc5d4 docs(plan): audit logging & DPA compliance (6 phases, ~30 commits)
Implementation plan for the spec at docs/superpowers/specs/2026-05-11-
audit-and-compliance-design.md. Six phases:

- Phase 1: AuditLogProtocol + AuditEntry type + truncateIp helper in
  core-shared; BindContext.auditLog? (5th generic).
- Phase 2: @repo/core-audit optional package — NoopAuditLog,
  StdoutJsonAuditLog, append-only audit-logs Payload collection,
  PayloadAuditLog (record), MultiSinkAuditLog fan-out, bindAudit
  binder with prod salt validation, RecordingAuditLog in core-testing.
- Phase 3: GDPR erasure plumbing — pseudonymize helper (sha256 +
  AUDIT_PSEUDONYM_SALT), PayloadAuditLog.eraseSubject via
  overrideAccess, createAuditErasureHook Payload afterDelete factory,
  admin tRPC procedure (audit.eraseSubject).
- Phase 4: OTel correlation bridge — currentTraceId() in core-shared,
  TraceIdEnrichingAuditLog decorator wraps inner sinks at bindAudit
  time. Explicit caller correlationId wins.
- Phase 5: createAuditAfterReadHook factory for opt-in per-collection
  VIEW capture; fire-and-forget semantics with stderr fallback.
- Phase 6: ADR-018 + audit-and-compliance.md guide + generator template
  at turbo/generators/templates/core-package/audit/ + byte-identical
  snapshot + e2e test + 6 doc surface refreshes (template-tiers,
  scaffolding-doc, CLAUDE.md, AGENTS.md, data-flow-explainer, README).

Total: ~30 commits expected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 16:01:11 +02:00
40b5b1a94f docs(spec): audit logging & DPA compliance design
Six-phase design for @repo/core-audit (5th optional package).

Phase 1: AuditLogProtocol + AuditEntry type + truncateIp helper in
  core-shared; BindContext.auditLog? optional field.
Phase 2: @repo/core-audit package with NoopAuditLog + PayloadAuditLog
  (append-only collection) + StdoutJsonAuditLog (structured JSON) +
  MultiSinkAuditLog fan-out wrapper + RecordingAuditLog in core-testing.
Phase 3: GDPR erasure plumbing — eraseSubject impls, pseudonymize helper
  (sha256-with-salt), admin tRPC procedure, createAuditErasureHook
  Payload afterDelete hook factory.
Phase 4: OTel correlation bridge — currentTraceId() helper,
  TraceIdEnrichingAuditLog decorator wraps inner sinks at bind time so
  AuditEntry.correlationId auto-populates from active OTel span.
Phase 5: createAuditAfterReadHook factory for opt-in per-collection
  automatic VIEW capture; reference wiring documented (printed by
  generator as a diff, NOT auto-installed in auth).
Phase 6: ADR-018, audit-and-compliance.md guide, generator template
  + byte-identical snapshot + e2e test, doc refreshes (CLAUDE.md,
  AGENTS.md, template-tiers, data-flow-explainer, README,
  scaffolding-doc).

Compliance grounded in DPA "Logging & Monitoring" requirements:
closed action enum (VIEW/CREATE/UPDATE/DELETE/EXPORT/PERMISSION_CHANGE),
required tenant field, type-enforced "what NOT to log" (no payload/
body/oldValue/newValue fields), IP /24 v4 + /48 v6 truncation, sha256-
salted pseudonymization, append-only Payload collection with privileged
overrideAccess erasure path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 15:46:33 +02:00
e43e03cdee docs: refresh architecture references for OTel migration 2026-05-11 12:18:44 +02:00
81f2477537 docs(adr): ADR-017 OpenTelemetry migration 2026-05-11 12:15:01 +02:00
76870816d1 docs(plan): OpenTelemetry migration (5 phases, ~30 tasks, ~25 commits)
Implementation plan for the spec at docs/superpowers/specs/2026-05-11-
opentelemetry-migration-design.md. Five phases:

- Phase 1: OTel SDK infrastructure (resource builder + Sentry-as-exporter
  bridge + NodeSDK init helper + ESLint allowlist for OTel SDK packages).
  No behavior swap yet.
- Phase 2 (TDD): OtelTracer impl using @opentelemetry/api; bind-sentry-
  instrumentation renamed to bind-otel-instrumentation with deprecation
  alias; delete SentryTracer.
- Phase 3 (TDD): OtelLogger impl using @opentelemetry/api-logs;
  LogRecordProcessor wired into init helper; delete SentryLogger.
  Breadcrumbs become span events; setUser sets user.id span attribute.
- Phase 4 (TDD): New IMetrics interface + Noop/Otel/Recording impls;
  MetricsProtocol added to bind-protocols; BindContext.metrics? optional
  field. Sentry metrics exporter deferred (experimental).
- Phase 5 (TDD): HTTP/undici/pg auto-instrumentations; PII scrub
  processors (PiiScrubSpanProcessor + PiiScrubLogRecordProcessor) run
  FIRST in OTel pipeline; delete sentry/scrub.ts + orphaned init files;
  core-testing/setup/no-sentry.ts → no-instrumentation.ts (mocks both
  Sentry and OTel SDK); ADR-017 + ADR-014 status header; doc refreshes.

Total: ~30 tasks across 6 phases (including Phase 0 read-first), ~25
expected commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 11:15:33 +02:00
cb0e33b0e8 docs(spec): OpenTelemetry migration design
Five-phase migration of server-side instrumentation from Sentry-direct
SDK calls to OpenTelemetry SDK with @sentry/opentelemetry as the (initial)
exporter. Vendor neutrality: swap vendors = swap exporters, never rewrite
tracer/logger/metrics impls.

Phase 1: OTel SDK infrastructure (no behavior swap).
Phase 2: OtelTracer replaces SentryTracer (uses @opentelemetry/api).
Phase 3: OtelLogger replaces SentryLogger (pure OTel Logs API via
  @opentelemetry/api-logs; breadcrumbs become span events; user.id as
  span attribute).
Phase 4: New IMetrics interface + Noop/Otel/Recording impls; added to
  BindContext as metrics? with corresponding MetricsProtocol in
  core-shared/di/bind-protocols.ts.
Phase 5: HTTP/undici/pg auto-instrumentations; PII scrubbing migrates
  from Sentry beforeSend hooks to OTel SpanProcessor/LogRecordProcessor;
  delete remaining Sentry-direct files; ADR-017 supersedes ADR-014's
  impl section while keeping R31-R51 interface decisions authoritative.

Server-only scope. Browser keeps Sentry SDK directly (replay + native
error UX); future spec extends to browser when OTel-Browser matures.

Companion ADR will be assigned at implementation time (expected ADR-017).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 11:04:37 +02:00
5f9a43441f docs(scaffolding): core-ui component generator reference 2026-05-11 09:21:52 +02:00
09ac0bba6c docs(plan): core-ui component generator (5 phases, ~7 commits)
Implementation plan for the spec at docs/superpowers/specs/2026-05-11-core-
ui-component-generator-design.md. Five phases:

- Phase 1: add splice anchors to core-ui tier barrel templates +
  regenerate the byte-identical ui snapshot
- Phase 2: create the 4 Handlebars template files
  (component.tsx + stories + test + index)
- Phase 3 (TDD): register the setGenerator block, implement
  coreUiComponentActions + printCoreUiComponentNextSteps, add unit
  tests for registration shape, action sequence, and PascalCase
  validation
- Phase 4: scaffolding reference doc + CLAUDE.md Quick Start +
  AGENTS.md Key Commands
- Phase 5: manual smoke test (scaffold one component per tier, verify
  file layout + spliced barrels + core-ui gates) + final repo gates

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 08:51:53 +02:00
5878b8f493 docs(spec): core-ui component generator design
2-phase design for `pnpm turbo gen core-ui-component`. Prompts for tier
(atom/molecule/organism) + name (PascalCase) and emits the established
4-file component pattern (component.tsx, component.stories.tsx,
component.test.tsx, index.ts) into the matching `packages/core-ui/src/<tier>s/`
folder. Splices the new export into the tier barrel via `// <gen:<tier>s>`
anchors.

Phase A adds the anchors to the core-ui template's three tier barrels and
regenerates the byte-identical reconstruction snapshot. Phase B ships the
generator, templates, tests, and docs. Refuses to run if core-ui isn't
scaffolded; doesn't touch Storybook config (existing stories glob covers
new component stories).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 08:47:27 +02:00
ee069574ba fix: address final-review polish (docs + comments + test coverage)
- AGENTS.md bind-production code block: shows the slim default state
  (no @repo/core-events / @repo/core-realtime imports, BindProductionContext
  with no generic args) with a comment pointing to the scaffold workflow.
  The previous block showed a fully-wired post-scaffold state without
  signaling that none of those packages exist in main.
- bind-protocols.test.ts: top-of-file comment clarifies what these tests
  actually verify (protocol shapes have required methods) vs what the
  spec text might suggest (full assignability of optional packages'
  interfaces — that's verified by the e2e reconstruction tests, not here).
- core-package-generator.md: drops two stale "Until Phases 3-6 land"
  parentheticals — the phases shipped.
- config.test.ts: extends the choices assertion to cover all 4 names
  (realtime, events, trpc, ui).
- marketing-pages bind-* comments: reverse the inverted optional/required
  language. queue (IJobQueue) is from core-shared and always present;
  bus is the optional one (from @repo/core-events when scaffolded).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 15:01:40 +02:00
ce550f60e0 docs: refresh package list + Read first refs after optional-package extraction
- CLAUDE.md project-overview lists must-have core packages (shared/cms/api)
  separately from the four optionals (realtime/events/trpc/ui) with their
  scaffold command. Read first list adds template-tiers.md and notes that
  the events + realtime guides require their package to be scaffolded first.
- overview.md "Five tags" updated: core-composition is 2 must-have plus
  trpc (optional); core is 1 must-have plus ui/realtime/events (optional).
- dependency-flow.md fix: replaces the stale `// in packages/core-trpc`
  example with `// in packages/core-shared` (core-trpc is now optional and
  may not exist in a slim template).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 14:45:43 +02:00
eee87d4ec8 docs: template-tiers reference (must-have + optional + generator commands) 2026-05-09 14:27:57 +02:00
ae456a5436 docs: ui now optional — prerequisite notes + conditional HTML
- AGENTS.md (root): marks core-ui as optional in the package table and
  boundary rules; points per-package docs to the .hbs template
- apps/storybook/AGENTS.md: rewrites around no-core-ui-by-default;
  stories glob and globals.css import described as post-scaffold steps
- apps/web-next/AGENTS.md: cross-reference updated to template file
- apps/web-tanstack/AGENTS.md: cross-reference updated to template file
- docs/architecture/data-flow-explainer.html: core-ui bullet notes
  optional status + generator command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 14:23:24 +02:00