1.6 KiB
1.6 KiB
name, description, type
| name | description | type |
|---|---|---|
| Processor Service | processor service scaffold, conventions, and known test patterns learned during Phase 1 tasks 1.1–1.4 | project |
Phase 1 tasks 1.1–1.4 landed. Key facts for tasks 1.5–1.11:
Architecture divergence from tcp-ingestion:
- ESLint
import/no-restricted-pathszone:src/core/cannot importsrc/domain/(notsrc/adapters/like tcp-ingestion).src/domain/is preemptive for Phase 2. INSTANCE_IDdefaults to'processor-1'(fixed string), not a random UUID prefix. Rationale: deterministic names are better for container environments.REDIS_CONSUMER_NAMEdefaults toINSTANCE_IDat runtime (after schema parse), not as a zod schema default — because it depends onINSTANCE_IDvalue.
Test patterns:
connectWithRetrytests: usemaxAttempts=1for the "calls process.exit(1)" case to avoid fake-timer unhandled rejection noise. The noise occurs when a backoffsetTimeoutresolves after the outer promise has already thrown via process.exit mock.- Migration runner tests:
isMigrationAppliedcallspool.query(pool-level, not through client). Handlers on client mock do NOT affect EXISTS checks. vi.mock('node:fs/promises')pattern used in migrate.test.ts to isolate filesystem reads.
Why: Phase 1 throughput pipeline. Tasks 1.5–1.8 add consumer/writer/state on top of this foundation.
How to apply:
When implementing 1.5 (Redis consumer), 1.6 (device state), 1.7 (position writer), 1.8 (main wiring) — all imports must use .js extension, no path aliases, strict ESM. The connectWithRetry pattern from pool.ts should be mirrored for ioredis in consumer.ts.