2.9 KiB
2.9 KiB
id, epic, title, type, status, feature, depends-on, blocks
| id | epic | title | type | status | feature | depends-on | blocks | ||
|---|---|---|---|---|---|---|---|---|---|
| 02-boot-assertions | conformance-system-v1 | assertFeatureConformance + boot wiring | technical-story | done | core-shared |
|
|
Goal
Runtime boot-time verification that every manifest-declared use case is bound
through the brand-attaching wrappers. Each feature's bindProductionX(ctx)
self-asserts at the tail; pnpm dev refuses to boot on drift.
Why
Type casts can mask unwrapped factories; manifest edits can drift from binders without TypeScript noticing. Boot assertions catch what the type system can't see — at zero cost during the inner agent feedback loop, and synchronously at startup so failures fire loudly.
Done when
withSpan,withCapture,withAuditattach non-enumerable runtime markers matching the type-level brand namesassertFeatureConformance(container, manifest, symbols, ctx)resolves each manifest use case and throwsConformanceErroron a missing brandauth.bindProductionAuth(ctx)self-asserts at the tailpnpm devboots cleanly for the existingauthwiring; rebindingsignInwith an unwrapped factory causespnpm devto throw at startup
In scope
- Runtime marker attachment via
Object.defineProperty(fn, "__brand", { … })(non-enumerable, non-writable, non-configurable) isInstrumented/isCaptured/isAuditedpredicatesConformanceErrorclass (extendsError)assertFeatureConformance(container, manifest, symbols, ctx)helper- Wiring into
packages/auth/src/di/bind-production.ts(tail-of-binder self-assertion) withAuditupgraded from passthrough to a thin wrapper that attaches its runtime brand without changing observable behaviour
Out of scope
assertConformanceover a multi-feature container collection at the app'sbindAll()(current per-feature self-assertion is sufficient and forward-compatible)- Wiring boot assertions into
cmsandweb-tanstack— neither has abind-production.tsyet; they'll inherit the check whenever they grow one - Manifests for
blog,media,navigation,marketing-pages(theirbindProductionXstays unchanged in this story) - Automated audit recording driven by manifest
audits[]declarations (deferred to a later story)
Tasks
- Re-export
authManifestfrom auth root barrel - TODO breadcrumb in
withAuditpointing at future automation - Runtime marker helpers (
attachBrand,isInstrumented,isCaptured,isAudited) withSpanattaches runtime__instrumentedmarkerwithCaptureattaches runtime__capturedmarkerwithAuditwraps + attaches runtime__auditedmarkerConformanceErrorclassassertFeatureConformancehelper + tests- Conformance barrel + subpath exports updated
bindProductionAuthself-asserts at the tail- Final verification + story closeout