Initial Commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Tasks — Add @suaveplan/api-plugin-event-bus
|
||||
|
||||
> Every checkbox MUST reflect work actually done in this change.
|
||||
|
||||
## 1. Spec authoring
|
||||
|
||||
- [x] 1.1 Confirm package is genesis-native (no upstream `enterprise/api-plugin-event-bus.md`); `enterprise/api-plugin-events.md` is a DIFFERENT package deferred to a later wave
|
||||
- [x] 1.2 Read `openspec/AGENTS.md` §§13, 14, 14a
|
||||
- [x] 1.3 Read `@suaveplan/events` source (`bus`, `queue`, `idempotent`, `interceptor`)
|
||||
- [x] 1.4 Read `@suaveplan/api-plugin-auth` reference implementation
|
||||
- [x] 1.5 Draft `proposal.md` from `openspec/templates/proposal.md`
|
||||
- [x] 1.6 Fill `## Source mapping` — every requirement listed in the "no source line" justification table with the canonical genesis-native reason
|
||||
- [x] 1.7 Draft `specs/api-plugin-event-bus/spec.md` with `## ADDED Requirements` only; every requirement carries `**Verified by:**`
|
||||
|
||||
## 2. Package scaffolding
|
||||
|
||||
- [x] 2.1 Create `packages/api/api-plugin-event-bus/` with `package.json`, `vite.config.ts`, `vitest.config.ts`, `tsconfig.json`, `tsconfig.lib.json`, `README.md`
|
||||
- [x] 2.2 Per-feature `src/<feature>/{<feature>.ts, <feature>.md, <feature>.test.ts, index.ts}` layout
|
||||
- [x] 2.3 `tests/setup/polyfills.ts` installs in-memory `MeterProvider`
|
||||
- [x] 2.4 Subpath exports map matches the proposal verbatim
|
||||
|
||||
## 3. Implementation
|
||||
|
||||
- [x] 3.1 `error-codes/error-codes.ts` — 8 `EVENT_BUS_*` codes + `EventBusError`
|
||||
- [x] 3.2 `topic/topic.ts` — `EVENT_TOPIC_PATTERN`, `scopeTopic`, `unscopeTopic`, `assertValidTopic`
|
||||
- [x] 3.3 `schemas/options.ts` — `EventBusPluginOptionsSchema` (Zod strict)
|
||||
- [x] 3.4 `schemas/routes.ts` — `PublishBodySchema`, `PublishResultSchema`, `SubscriptionRecordSchema`, `SubscriptionListSchema`, `UnsubscribeParamsSchema`, `UnsubscribeResultSchema`
|
||||
- [x] 3.5 `services/event-bus-service.ts` — `EventBusService`, backpressure wiring, idempotency wiring, tenant scoping
|
||||
- [x] 3.6 `services/registry-augmentation.ts` — declare `eventBusService` slot
|
||||
- [x] 3.7 `middleware/request-bus.ts` — installs `c.set("eventBus", ...)` per-request handle
|
||||
- [x] 3.8 `middleware/context-augmentation.ts` — Hono `ContextVariableMap.eventBus`
|
||||
- [x] 3.9 `routes/build-routes.ts` — 3 OpenAPI routes with `requireAuth` gate
|
||||
- [x] 3.10 `otel/instruments.ts` — 5 instruments + singleton + reset helper
|
||||
- [x] 3.11 `plugin/plugin.ts` — `createEventBusPlugin` 6-step `onInit`
|
||||
- [x] 3.12 `types/types.ts` — public option / config / handle interfaces
|
||||
- [x] 3.13 `index.ts` — explicit named re-exports
|
||||
|
||||
## 4. Tests
|
||||
|
||||
- [x] 4.1 Unit tests per feature module (real `@suaveplan/events`, no `vi.mock`)
|
||||
- [x] 4.2 `src/api-plugin-event-bus.spec-conformance.test.ts` — every error code reachable; subpath exports match
|
||||
- [x] 4.3 Integration: `tests/integration/tenant-isolation.test.ts` — A publish does not reach B subscriber; ownership enforced
|
||||
- [x] 4.4 Integration: `tests/integration/http-routes.test.ts` — publish / list / delete end-to-end with auth + tenant middleware
|
||||
- [x] 4.5 Every `it()` carries `{ timeout: 5000 }` (30000 for genuinely async)
|
||||
|
||||
## 5. Documentation
|
||||
|
||||
- [x] 5.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic + advanced examples, full API reference)
|
||||
- [x] 5.2 README links every co-located `.md` under `## Modules`
|
||||
|
||||
## 6. Pre-archive gates
|
||||
|
||||
- [x] 6.1 `cd packages/api/api-plugin-event-bus && bun run check` — Biome clean
|
||||
- [x] 6.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-event-bus --force` — green
|
||||
- [x] 6.3 `bunx turbo test:coverage --filter=@suaveplan/api-plugin-event-bus` — 100/100/100/100
|
||||
- [x] 6.4 `bun scripts/openspec-conformance.ts @suaveplan/api-plugin-event-bus` — exit 0
|
||||
- [x] 6.5 `bunx turbo build --filter=@suaveplan/api-plugin-event-bus --force` — green
|
||||
- [x] 6.6 `bun scripts/lint/check-test-runner-imports.ts` — zero direct vitest/bun:test imports
|
||||
|
||||
## 7. Pre-archive 9-row checklist
|
||||
|
||||
- [x] 7.1 Generics threaded; `expectTypeOf` assertions on every literal-type claim
|
||||
- [x] 7.2 Zod schemas wired at every declared boundary
|
||||
- [x] 7.3 Every error code in `error-codes.ts` thrown by at least one production path
|
||||
- [x] 7.4 Strict-mode behaviors tested both on and off where applicable
|
||||
- [x] 7.5 OTel instruments emitted from production paths and asserted with a real in-memory `MeterProvider`
|
||||
- [x] 7.6 No `vi.mock` / no `bun:test` direct imports / no `vitest` direct imports
|
||||
- [x] 7.7 No `export *` in feature barrels
|
||||
- [x] 7.8 No `biome-ignore` in `src/`
|
||||
- [x] 7.9 No retroactive tick — every box reflects work done in this change
|
||||
|
||||
## 8. Archive
|
||||
|
||||
- [x] 8.1 Fold `specs/api-plugin-event-bus/spec.md` into `openspec/specs/api-plugin-event-bus/spec.md`
|
||||
- [x] 8.2 Move `openspec/changes/add-api-plugin-event-bus/` → `openspec/archive/2026-05-19-add-api-plugin-event-bus/`
|
||||
Reference in New Issue
Block a user