2.1 KiB
2.1 KiB
Tasks — service-discovery
Phase 1: Scaffold
- 1.1 Create
packages/network/service-discovery/with standard package layout. - 1.2
package.jsonat0.1.0,"sideEffects": false, subpath exports. - 1.3 Test config via
createTestConfig(). - 1.4
tests/dep-graph.test.ts.
Phase 2: Types + errors
- 2.1 Port
types.ts→src/types/types.ts+ sibling.md. - 2.2
defineCodes("SVC_DISC", [...]):DUPLICATE_REGISTRATION,QUERY_INVALID,REGISTRY_FULL,INVALID_OPTIONS. - 2.3 Zod schemas for
ServiceDescriptor,ServiceQuery, options.
Phase 3: Core registry
- 3.1 Port
ServiceRegistryregister/deregister/query. - 3.2
watch(query)AsyncIterable with AbortSignal-aware termination. - 3.3 TTL + stale-entry expiry over injectable
Clock.
Phase 4: Adapters
- 4.1 Optional persistent backing via
@suaveplan/storageAbstractStorage. - 4.2 Optional
NetworkBusintegration emittingservice:registered/:deregistered/:expired.
Phase 5: Observability
- 5.1 Counters (
svc_disc.registrations_total{outcome},svc_disc.queries_total). - 5.2 Histogram (
svc_disc.query_duration_ms). - 5.3 Gauge (
svc_disc.active_services).
Phase 6: Tests + docs
- 6.1 Unit tests per feature module via
@suaveplan/testing/runner. - 6.2 fast-check property tests: TTL monotonicity, query determinism.
- 6.3 100/100/100/100 coverage gate.
- 6.4 Sibling
.mddoc per.tsimpl file. - 6.5 Root
README.mdwith basic + advanced examples.
Phase 7: Verification
- 7.1
bunx turbo lint typecheck test --filter=@suaveplan/service-discoverygreen. - 7.2
bunx turbo test:coverage --filter=@suaveplan/service-discovery100/100/100/100. - 7.3
bun run docs:check --filter=@suaveplan/service-discoverygreen. - 7.4
MANIFEST.mdregen. - 7.5
STATUS.mdrow flipped.
Pre-archive checklist
- Row 1 — Phase 7 green.
- Row 2 — Parity 🚫 list empty (or each row justified per AGENTS.md §0a).
- Row 3 —
openspec/specs/service-discovery/spec.mdwritten. - Row 4 — Folder archived.