docs: complete review-worker-adapter checkpoint
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
id: review-worker-adapter
|
id: review-worker-adapter
|
||||||
name: Review Worker adapter implementation
|
name: Review Worker adapter implementation
|
||||||
status: pending
|
status: completed
|
||||||
depends_on: [worker-adapter-tests]
|
depends_on: [worker-adapter-tests]
|
||||||
scope: narrow
|
scope: narrow
|
||||||
risk: low
|
risk: low
|
||||||
@@ -31,8 +31,27 @@ Review checkpoint after Worker adapter implementation. Verify:
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
> To be filled by implementation agent
|
### Review Report
|
||||||
|
|
||||||
|
**Build / Lint / Tests**: All pass. 242 tests across 8 files. Build produces correct d.ts for all 5 entry points (index, redis, ws-client, ws-server, worker).
|
||||||
|
|
||||||
|
**Worker Adapter API**: Matches architecture spec.
|
||||||
|
- `createWorkerHostEventTarget(worker: Worker)` — host side, uses `worker.postMessage`/`worker.onmessage`
|
||||||
|
- `createWorkerThreadEventTarget()` — thread side, uses `globalThis.postMessage`/`globalThis.onmessage`
|
||||||
|
- Both follow the same `Map<string, Set<EventListener>>` pattern as other adapters
|
||||||
|
- `__`-prefixed event types are silently ignored (consistent with WS adapters)
|
||||||
|
|
||||||
|
**Exports**: Correct.
|
||||||
|
- `tsup.config.ts` has `event-target-worker.ts` entry
|
||||||
|
- `package.json` has `./event-target-worker` sub-path export
|
||||||
|
- `src/index.ts` re-exports both factory functions
|
||||||
|
|
||||||
|
**Test Strategy**: Mock-based (not actual Worker threads). Uses mock `Worker` and `globalThis` objects. 42 tests covering host send/receive, thread send/receive, topic scoping, envelope round-trip, bidirectional communication, error handling.
|
||||||
|
|
||||||
|
**Observation**: The thread side sets `globalThis.onmessage` directly, which overwrites any existing handler. This is noted in the architecture doc and acceptable — the adapter takes ownership of the message channel.
|
||||||
|
|
||||||
|
**Verdict**: PASS
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
> To be filled on completion
|
Worker adapter review passed. 242 tests, build, lint all clean. API matches architecture spec. Web Worker only per R&D decision. Mock-based test strategy is sound (42 tests).
|
||||||
Reference in New Issue
Block a user