# Tasks: error-spec-tightening ## 1. Code fix - [x] 1.1 Replace one-level `redactContext` with recursive `redactValue` in `src/serialize/to-json.ts`. Walks objects + arrays, cycle-safe via `WeakSet`. Public `toJSON` signature unchanged. ## 2. Spec delta - [ ] 2.1 Author `specs/error/spec.md` delta: `## MODIFIED Requirements` (Zero workspace and runtime dependencies, Lossless wire serialization, Cause-chain traversal, Redaction at the serialization boundary) + `## ADDED Requirements` (TruncatedCause sentinel, Wire format version discriminator). - [ ] 2.2 Add `**Verified by:**` line to every requirement in the live spec. ## 3. Conformance test - [ ] 3.1 Add `packages/core/error/src/conformance.spec-conformance.test.ts` pinning: - Recursive redaction: `Sensitive` inside nested objects + arrays becomes `"[REDACTED]"`. - TruncatedCause sentinel emitted when `maxDepth` is exceeded. - TruncatedCause sentinel emitted when a cycle is detected during `toJSON`. - `__suaveplanError: 1` discriminator preserved through `toJSON` → `fromJSON`. - Cycle-safety: redaction does not loop on circular context. ## 4. Gate - [ ] 4.1 `bunx turbo lint typecheck test --filter=@suaveplan/error` green. - [ ] 4.2 `bunx turbo test:coverage --filter=@suaveplan/error` 100/100/100/100. - [ ] 4.3 `bun scripts/openspec-conformance.ts @suaveplan/error` exits 0. ## 5. Fold + archive - [ ] 5.1 Fold delta into `openspec/specs/error/spec.md`. - [ ] 5.2 Move `openspec/changes/error-spec-tightening/` to `openspec/archive/2026-04-27-error-spec-tightening/`. - [ ] 5.3 Re-run gates after fold.