diff --git a/.claude/agent-memory/ts-node-backend-engineer/MEMORY.md b/.claude/agent-memory/ts-node-backend-engineer/MEMORY.md index d7165b4..b5da32e 100644 --- a/.claude/agent-memory/ts-node-backend-engineer/MEMORY.md +++ b/.claude/agent-memory/ts-node-backend-engineer/MEMORY.md @@ -1,4 +1,5 @@ # Agent Memory Index - [TCP Ingestion Project](project_tcp_ingestion.md) — tcp-ingestion service: tech stack, conventions, ESLint quirks, CRC details +- [Processor Service](project_processor.md) — processor service: Phase 1 scaffold done, key divergences from tcp-ingestion, test patterns for pool/migrate - [User Profile](user_profile.md) — User role and working style diff --git a/.claude/agent-memory/ts-node-backend-engineer/project_processor.md b/.claude/agent-memory/ts-node-backend-engineer/project_processor.md new file mode 100644 index 0000000..45ee4d8 --- /dev/null +++ b/.claude/agent-memory/ts-node-backend-engineer/project_processor.md @@ -0,0 +1,23 @@ +--- +name: Processor Service +description: processor service scaffold, conventions, and known test patterns learned during Phase 1 tasks 1.1–1.4 +type: 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-paths` zone: `src/core/` cannot import `src/domain/` (not `src/adapters/` like tcp-ingestion). `src/domain/` is preemptive for Phase 2. +- `INSTANCE_ID` defaults to `'processor-1'` (fixed string), not a random UUID prefix. Rationale: deterministic names are better for container environments. +- `REDIS_CONSUMER_NAME` defaults to `INSTANCE_ID` at runtime (after schema parse), not as a zod schema default — because it depends on `INSTANCE_ID` value. + +**Test patterns:** +- `connectWithRetry` tests: use `maxAttempts=1` for the "calls process.exit(1)" case to avoid fake-timer unhandled rejection noise. The noise occurs when a backoff `setTimeout` resolves after the outer promise has already thrown via process.exit mock. +- Migration runner tests: `isMigrationApplied` calls `pool.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.