79 lines
3.2 KiB
Markdown
79 lines
3.2 KiB
Markdown
# Tasks: enterprise-streams-chunk-queue
|
||
|
||
- **Change ID**: enterprise-streams-chunk-queue
|
||
- **Package**: `@suaveplan/streams-chunk-queue`
|
||
- **Date**: 2026-05-23
|
||
|
||
## 0. Pre-flight (non-negotiable)
|
||
|
||
- [x] 0.1 `git status` clean in worktree; branch renamed to `feat/streams-chunk-queue`.
|
||
- [x] 0.2 Worktree under `.claude/worktrees/agent-a42db4238ae08d309` accounted for (this change).
|
||
- [x] 0.3 `STATUS.md` lists `@suaveplan/streams-chunk-queue` as `–` (pending) → confirms genesis-side absence.
|
||
- [x] 0.4 Upstream source read end-to-end: `src/core/streaming-chunk-queue.ts`, `src/types/types.ts`, `README.md`.
|
||
- [x] 0.5 Genesis dependency APIs audited: `AbstractStorage`, `TokenBucket.consume()`, `ChunkVerifier.verify()` shapes confirmed before authoring adapters.
|
||
|
||
## 1. Errors
|
||
|
||
- [x] 1.1 `errors/streams-chunk-queue-error.ts` — `STREAMS_CHUNK_QUEUE_CODES` via `defineCodes`, `StreamsChunkQueueError`.
|
||
- [x] 1.2 Tests cover construction, code preservation, cause chaining.
|
||
|
||
## 2. Shared types
|
||
|
||
- [x] 2.1 `types/types.ts` — `ChunkMetadata`, `StoredChunk`, `ChunkRequest`, `StreamEvent`, `StreamingQueueStatus`, `StreamingChunkQueueHooks`. All chunk IDs `bigint`.
|
||
|
||
## 3. Validator subsystem
|
||
|
||
- [x] 3.1 `validator/validator.ts` — `ChunkValidator` strategy + `NoopChunkValidator`.
|
||
- [x] 3.2 `validator/chunk-verifier-validator.ts` — adapter wrapping `@suaveplan/packer` `ChunkVerifier`.
|
||
|
||
## 4. Decryptor subsystem
|
||
|
||
- [x] 4.1 `decryptor/decryptor.ts` — `ChunkDecryptor` strategy + `NoopChunkDecryptor`.
|
||
|
||
## 5. Rate-limiter adapter
|
||
|
||
- [x] 5.1 `rate-limiter/adapter.ts` — `TokenBucketRateLimiterAdapter` adapting genesis `TokenBucket.consume()`.
|
||
|
||
## 6. Storage adapter
|
||
|
||
- [x] 6.1 `storage-adapter/persister.ts` — `StorageChunkPersister` over `AbstractStorage`.
|
||
|
||
## 7. Binary protocol
|
||
|
||
- [x] 7.1 `binary-protocol/encoder.ts` — `encodeChunkRequest` u64+u32+bitmap layout.
|
||
|
||
## 8. Hooks + events
|
||
|
||
- [x] 8.1 `hooks/hooks.ts` — `invokeHook` safe-invocation helper.
|
||
- [x] 8.2 `events/events.ts` — `StreamEventEmitter` with wildcard support.
|
||
|
||
## 9. Telemetry
|
||
|
||
- [x] 9.1 `telemetry/telemetry.ts` — OTel meter with counters and histogram.
|
||
|
||
## 10. Core `StreamingChunkQueue`
|
||
|
||
- [x] 10.1 `queue/streaming-chunk-queue.ts` — composes validator, decryptor, rate limiter, persister, telemetry, hooks, events.
|
||
- [x] 10.2 Tests cover construction validation, out-of-range chunkId, duplicate ignore, out-of-order assembly, autostart, rate-limit retry, validation/decryption failure, persist/load round-trip, timeout, status, wildcard listener, hook invocation, cancel + clear.
|
||
|
||
## 11. Docs
|
||
|
||
- [x] 11.1 Every implementation `.ts` has a sibling `.md` (≥200 words).
|
||
- [x] 11.2 Root `README.md` with Modules section.
|
||
|
||
## 12. Pre-publish gate
|
||
|
||
- [x] 12.1 `bunx turbo lint typecheck test --filter=@suaveplan/streams-chunk-queue` green.
|
||
- [x] 12.2 `bunx turbo test:coverage --filter=@suaveplan/streams-chunk-queue` at 100/100/100/100.
|
||
- [x] 12.3 `docs:check` 100%.
|
||
|
||
## 13. Spec fold + archive
|
||
|
||
- [x] 13.1 Fold spec delta into `openspec/specs/streams-chunk-queue/spec.md`.
|
||
- [x] 13.2 Move folder to `openspec/archive/2026-05-23-enterprise-streams-chunk-queue/`.
|
||
- [x] 13.3 Run `bun scripts/folder-reorg/generate-manifest.ts`.
|
||
|
||
## 14. Commit
|
||
|
||
- [x] 14.1 Commit on `feat/streams-chunk-queue`. No push, no main, no `--no-verify`.
|