5.2 KiB
5.2 KiB
Tasks — add-drive-uri-writes
1. Registry
- 1.1 Add
TEMPLATE_READ_ONLYtoDRIVE_URI_CODESinsrc/error-codes/error-codes.ts(8 codes total). - 1.2 Update
src/error-codes/error-codes.md— describeTEMPLATE_READ_ONLYand the narrowed role ofWRITE_UNSUPPORTED. - 1.3 Extend
src/error-codes/error-codes.test.tsto cover the new code and assertWRITE_UNSUPPORTEDis still present.
2. Adapter — DriveStorageLikeAdapter
- 2.1 Widen
set(key, value, signal?)anddelete(key, signal?)to accept and forwardAbortSignaltoDrive.write({ signal })/Drive.delete(path, signal). - 2.2 Update
src/adapter/drive-storage-like.mdfor the new signature and note theTEMPLATE_READ_ONLYrejection happens in the instrumented override, not here. - 2.3 Extend
src/adapter/drive-storage-like.test.ts—setpropagatessignal,deletepropagatessignal, pre-aborted signal short-circuits.
3. Instrumented adapter — InstrumentedDriveAdapter
- 3.1 Replace the unconditional
setrejection with per-scheme dispatch:drive/drive+mesh→ delegate tosuper.set(key, value, signal);drive+template→ throwDRIVE_URI.TEMPLATE_READ_ONLY. - 3.2 Override
deletesymmetrically:drive/drive+mesh→ delegate;drive+template→ throwTEMPLATE_READ_ONLY. - 3.3 On every successful
drive+mesh://write, emit span eventdrive_uri.mesh_write_local_onlywith{ scheme, path }. - 3.4 Pre-aborted
signalonset/delete→ throwDRIVE_URI.ABORTEDbefore any work. - 3.5 OTel counters: increment
drive_uri.writes_total{scheme, outcome}anddrive_uri.deletes_total{scheme, outcome}for every success and every rejection. - 3.6 Update
src/plugins/drive/drive.streams.mdandsrc/plugins/drive-template/drive-template.md.
4. Test suite
- 4.1
src/plugins/drive/drive.test.ts— replace"rejects writes with DRIVE_URI.WRITE_UNSUPPORTED"with"writes succeed and round-trip via Drive.write"and"writes propagate AbortSignal to Drive.write". - 4.2
src/plugins/drive/drive.test.ts— add"removes delegate to Drive.delete and return its boolean"and"removes propagate AbortSignal". - 4.3
src/plugins/drive-mesh/drive-mesh.test.ts— add"writes succeed without triggering mesh.advertise"and"writes emit drive_uri.mesh_write_local_only span event". - 4.4
src/plugins/drive-template/drive-template.test.ts— add"writes reject with DRIVE_URI.TEMPLATE_READ_ONLY"and"removes reject with DRIVE_URI.TEMPLATE_READ_ONLY". - 4.5
src/otel/otel.test.ts—"increments writes_total{outcome:success} on successful drive:// writes","increments writes_total{outcome:error,code:TEMPLATE_READ_ONLY} on template writes","increments deletes_total per scheme outcome". - 4.6
src/conformance/conformance.test.ts— re-runrunUriPluginConformancewrites suite against all three plugins. Expected:drive/drive+meshpass;drive+templatecontinues to fail writes with the new code. - 4.7
tests/integration/drive-roundtrip-write.test.ts— real local-storage Drive,resolver.writethenresolver.read, assert equality. - 4.8
tests/integration/drive-mesh-roundtrip-write.test.ts— mesh-configured Drive with a spy transport; assert no implicitadvertisecall; explicitmesh.advertise(...)after the write produces a verifiable outbound advertisement. - 4.9
tests/integration/template-write-rejection.test.ts— wired template-backed Drive,resolver.write("drive+template://...")andresolver.remove(...)both reject withTEMPLATE_READ_ONLY.
5. Migration audit
- 5.1
grep -rln "DRIVE_URI.WRITE_UNSUPPORTED" packages/ | grep -v "/dist/\|/coverage/\|/drive-uri/"— every hit is reviewed; non-matching consumers re-routed ontoTEMPLATE_READ_ONLYwhere appropriate. - 5.2 Update
README.mdFeatures section to reflect writes/removes viadrive://anddrive+mesh://.
6. Pre-publish gate (§13)
- 6.1 Spec reconciliation — walk every
### Requirementand#### Scenarioinspecs/drive-uri/spec.md; confirm the named test exists verbatim. - 6.2
bunx turbo lint typecheck test --filter=@suaveplan/drive-uri— green. - 6.3
bunx turbo test:coverage --filter=@suaveplan/drive-uri— 100/100/100/100, including theTEMPLATE_READ_ONLYrejection branches. - 6.4
bunx turbo build --filter=@suaveplan/drive-uri— green. - 6.5 Banned-pattern, barrel, test-runner-import, missing-
.md, bare-version, and secrets scans — all clean. - 6.6 Dependent sweep —
bunx turbo test --filter=...@suaveplan/drive-urigreen.
7. Root-doc refresh (§13b)
- 7.1
bun scripts/folder-reorg/generate-manifest.ts— refreshMANIFEST.md. - 7.2
bun scripts/generate-missing.ts— refreshMISSING.yml. - 7.3 Update
STATUS.mdandSUMMARY.mdparagraphs fordrive-urito reflect writes-supported on the two mutable schemes. - 7.4
bunx markdownlint-cli2 --fixover the touched docs.
8. Archive
- 8.1 Fold
specs/drive-uri/spec.md(deltas) intoopenspec/specs/drive-uri/spec.md. - 8.2 Move
openspec/changes/add-drive-uri-writes/→openspec/archive/<yyyy-mm-dd>-add-drive-uri-writes/.