4.5 KiB
4.5 KiB
Tasks — storage-cdn-bunnycdn
Every checkbox MUST reflect work actually done in this change. Hard dependency:
@suaveplan/storage-cdn(changeadd-storage-cdn) MUST be archived first.
1. Spec authoring
- 1.1 Read
openspec/changes/add-storage-cdn/specs/storage-cdn/spec.mdfor the contract - 1.2 Read
openspec/changes/add-storage-cdn-rackspace/for the sibling provider pattern - 1.3 Read BunnyCDN Storage HTTP API, Pull Zone purge API, and Token Authentication docs
- 1.4 Draft
proposal.md,design.md,specs/storage-cdn-bunnycdn/spec.md,tasks.md - 1.5 Numbered Requirement/Scenario checklist per §0c step 6
2. Scaffolding
- 2.1 Create
packages/storage/storage-cdn-bunnycdn/ - 2.2
package.jsonv0.0.0,"sideEffects": false, subpath exports - 2.3 Deps:
@suaveplan/error,@suaveplan/storage,@suaveplan/storage-cdn,@suaveplan/retry,@suaveplan/types,@opentelemetry/api,zod,tslib - 2.4 DevDeps:
@suaveplan/testing,@vitest/coverage-istanbul,fast-check,mitata,typescript,vite,vite-plugin-dts,vitest - 2.5
tsconfig,vite.config.ts,vitest.config.tsviacreateTestConfig
3. Implementation
- 3.1
src/error-codes.ts—defineCodes("STORAGE_CDN_BUNNYCDN", [...])with 8 codes,StorageCdnBunnycdnError - 3.2
src/types/*.ts+.schemas.ts—BunnyCdnAdapterOptions+ Zod schema (region whitelist) - 3.3
src/storage-client/storage-client.ts— PUT/GET/DELETE/HEAD/LIST against regional Storage Zone withAccessKeyheader - 3.4
src/pull-zone-client/pull-zone-client.ts— single-URL purge + prefix purge viaapi.bunny.net/purge - 3.5
src/token-auth/token-auth.ts— HMAC-SHA256 Token Authentication via WebCrypto, URL-safe base64 - 3.6
src/key-sanitizer/key-sanitizer.ts— strict boundary + per-segment encoder - 3.7
src/retry-helper/retry-helper.ts— transient classifier + Retry-After honour - 3.8
src/otel/otel.ts— meter/tracer withprovider="bunnycdn"+storage_regionattrs - 3.9
src/bunny-cdn-adapter/bunny-cdn-adapter.ts—BunnyCdnAdapter extends CdnAdapter+purgePrefixextra method - 3.10
src/registry/registry.ts—registerBunnyCdnProvider()idempotent - 3.11
src/index.ts— explicit named re-exports
4. Tests
- 4.1
src/storage-client/storage-client.test.ts—deunprefixed host,nyprefixed host, PUT/GET/DELETE/HEAD/LIST round-trips, 401 → STORAGE_AUTH_FAILED, 404 → undefined - 4.2
src/pull-zone-client/pull-zone-client.test.ts— single purge 200, prefix purge wildcard, 401 → PURGE_AUTH_FAILED, missing API key → PURGE_API_KEY_MISSING - 4.3
src/token-auth/token-auth.test.ts— reference-vector byte equality, path-scoped token, missing key error - 4.4
src/key-sanitizer/key-sanitizer.test.ts— traversal, absolute, overlong, per-segment encoding - 4.5
src/retry-helper/retry-helper.test.ts— transient classifier,Retry-Afterhonour, non-retry on 401 - 4.6
src/otel/otel.test.ts— measurement attrs includeproviderandstorage_region - 4.7
src/bunny-cdn-adapter/bunny-cdn-adapter.test.ts— full CRUD, range, edgeUrl, purge, prefix purge, signUrl, AbortSignal, retry, list mapping - 4.8
src/bunny-cdn-adapter/bunny-cdn-adapter.spec-conformance.test.ts— type conformance, capabilities, every code reachable, tier-purity grep - 4.9
src/registry/registry.test.ts— factory dispatch, idempotency - 4.10 Every
it(...)carries{ timeout: 5000 }(or 30000 for genuinely async) - 4.11 All test imports via
@suaveplan/testing/runner(§7)
5. Documentation
- 5.1 Sibling
.mdfor every implementation.ts - 5.2
README.mddocuments region selection (de|ny|la|sg|syd|uk), two-key model (storage vs purge), Token Authentication setup
6. Gates
- 6.1
bun run check - 6.2
bunx turbo lint typecheck test --filter=@suaveplan/storage-cdn-bunnycdn - 6.3
bunx turbo test:coverage --filter=@suaveplan/storage-cdn-bunnycdn(100/100/100/100) - 6.4
bun scripts/lint/check-test-runner-imports.ts - 6.5 Tier-purity grep returns empty
- 6.6
bun scripts/openspec-conformance.ts @suaveplan/storage-cdn-bunnycdn
7. Manifest & archival
- 7.1
bun scripts/folder-reorg/generate-manifest.ts - 7.2 Update
STATUS.md - 7.3 Fold
specs/storage-cdn-bunnycdn/spec.md→openspec/specs/storage-cdn-bunnycdn/spec.md - 7.4 Move change folder →
openspec/archive/<yyyy-mm-dd>-add-storage-cdn-bunnycdn/