6.0 KiB
6.0 KiB
Tasks — fix-storage-uri-error-passthrough
Every checkbox MUST reflect work actually done in this change.
1. Spec authoring
- 1.1 Read
openspec/changes/add-storage-uri/specs/storage-uri/spec.mdrequirements "Adapter error re-wrapping" and "Streaming writes with buffered fallback" - 1.2 Read
openspec/changes/add-drive-uri/specs/drive-uri/spec.md— confirm the wrap-aware scenarios to tighten - 1.3 Read
openspec/AGENTS.md§0c, §2c, §13, §13a, §14 - 1.4 Read
packages/core/error/src/error.ts(or equivalent) — confirmSuaveplanErroris the rightinstanceoftarget - 1.5 Draft
proposal.md,specs/storage-uri/spec.md(MODIFIED form),specs/drive-uri/spec.md(MODIFIED form),tasks.md - 1.6 Build numbered Requirement/Scenario implementation checklist (§0c step 6) — 2 MODIFIED storage-uri requirements, 3 MODIFIED drive-uri requirements
2. Storage-uri implementation
- 2.1 Locate the resolver's error-handling branch —
packages/storage/storage-uri/src/resolver/resolver.ts(#wrapAdapterErroror equivalent) - 2.2 Change the discriminator from
err instanceof StorageUriErrortoerr instanceof SuaveplanError - 2.3 Same change in the write path —
packages/storage/storage-uri/src/resolver/resolver.writes.ts(WRITE_UNSUPPORTEDwrap branch) - 2.4 Verify the
importis from@suaveplan/error(it already is forStorageUriError's base —SuaveplanErrorships from there) - 2.5 Update sibling
.mddocs —resolver.md,resolver.writes.md— to describe the new pass-through behaviour (§4a doc-drift gate) - 2.6 Update README "Features" section if it claims errors are uniformly wrapped
3. Storage-uri tests
- 3.1
src/resolver/resolver.test.ts— rename existing"wraps adapter errors as ADAPTER_ERROR"to"wraps non-SuaveplanError throwables as ADAPTER_ERROR"; assertion stays (plainErrorthrown →STORAGE_URI.ADAPTER_ERRORwrap) - 3.2
src/resolver/resolver.test.ts— addit("passes through thrown SuaveplanError subclasses unchanged", ...)— instantiate aSuaveplanError("FOO.BAR", ...)directly (no need to importDriveUriError), throw from a fake adapter, assert resolver re-throws same instance witherr.code === "FOO.BAR" - 3.3
src/resolver/resolver.writes.test.ts— rename existing"wraps read-only adapter error as WRITE_UNSUPPORTED"to"wraps non-Suaveplan throw on set as WRITE_UNSUPPORTED"and switch the fixture to throw a plainnew Error(...)(not aStorageHttpError); assertion stays - 3.4
src/resolver/resolver.writes.test.ts— addit("passes through thrown SuaveplanError subclasses on write", ...)— fake adapter throwsnew SuaveplanError("FOO.BAR", ...)fromset, assert resolver re-throws same instance - 3.5 Every
it(...)carries{ timeout: 5000 } - 3.6 No
vi.mock; tests construct real fake adapters per CLAUDE.md rule 2 - 3.7 All test imports remain via
@suaveplan/testing/runner(rule 11)
4. Drive-uri test tightening (no production code change)
- 4.1
packages/drive/drive-uri/src/plugins/drive/drive.test.ts— switch theDRIVE_ID_MISMATCHtest from assertingerr.cause.code === "DRIVE_URI.DRIVE_ID_MISMATCH"to assertingerr.code === "DRIVE_URI.DRIVE_ID_MISMATCH"(anderr instanceof DriveUriError) - 4.2
packages/drive/drive-uri/src/plugins/drive/drive.test.ts— switch theWRITE_UNSUPPORTEDtest to direct-code assertion - 4.3
packages/drive/drive-uri/src/plugins/drive-template/drive-template.test.ts— switchTEMPLATE_NOT_AVAILABLEandTEMPLATE_INVALIDtests to direct-code assertion - 4.4
packages/drive/drive-uri/src/plugins/drive-mesh/drive-mesh.test.ts— same treatment if a.cause-based assertion exists - 4.5 Coverage stays at 100/100/100/100 (no production code changed; some branches in the test helpers may become unreachable — remove unused helpers if so per §7a — write the test against real behaviour, don't preserve dead code)
5. Spec annotation cleanup (drive-uri)
- 5.1 In
openspec/changes/add-drive-uri/specs/drive-uri/spec.md, remove the top-of-file> **Note — error-wrap behaviour is revisited in fix-storage-uri-error-passthrough.**paragraph (the behaviour it described is now retired by this change) - 5.2 Keep the second top-of-file
> **Note — buffered-read signal threading is revisited in add-signal-to-storage-like.**paragraph as-is (separate concern, not retired yet) - 5.3 Confirm no remaining scenarios in
add-drive-uri/specs/drive-uri/spec.mdreferenceSTORAGE_URI.ADAPTER_ERRORor "cause.code" indirection for drive-uri throws — if any remain, tighten them in this delta
6. Gates
- 6.1
bunx turbo lint typecheck test --filter=@suaveplan/storage-uri - 6.2
bunx turbo test:coverage --filter=@suaveplan/storage-uri --force— 100/100/100/100 Istanbul - 6.3
bunx turbo lint typecheck test --filter=@suaveplan/drive-uri - 6.4
bunx turbo test:coverage --filter=@suaveplan/drive-uri --force— 100/100/100/100 Istanbul - 6.5
bunx turbo build --filter=@suaveplan/storage-uri @suaveplan/drive-uri - 6.6 Dependent sweep —
bunx turbo test --filter=...@suaveplan/storage-uri(catches any consumer that asserted onerr.code === "STORAGE_URI.ADAPTER_ERROR"for what is now a passed-throughSuaveplanError) - 6.7
bun scripts/lint/check-test-runner-imports.ts - 6.8 Banned-pattern scan empty for both packages'
src/ - 6.9 Spec-reconciliation gate — every modified scenario's
**Verified by:**test name exists verbatim
7. Manifest & archival (defer)
- 7.1 This change folder remains in
openspec/changes/untiladd-storage-uriandadd-drive-uriare archived together. The fold step for all three changes happens as a single archival wave so the canonicalopenspec/specs/storage-uri/spec.mdandopenspec/specs/drive-uri/spec.mdreflect the final, pass-through behaviour from day one. - 7.2 At archive time, the modified scenarios from this delta supersede the originals in the
add-storage-uri/add-drive-urideltas during the fold.