feat(gateway): tier-detector with fail-fast PG/Valkey/pgvector probes (FED-M1-04)

Implements `apps/gateway/src/bootstrap/tier-detector.ts` invoked from
`main.ts` before NestJS bootstraps. For each tier:

- `local`: no-op (PGlite is in-process)
- `standalone`: probe Postgres + Valkey
- `federated`: probe Postgres + Valkey + pgvector extension; reject
  config upfront if `queue.type !== 'bullmq'`

Each probe has a 5-second hard cap and emits a structured
`TierDetectionError` with service / host / port / remediation. The
remediation field discriminates pgvector failure modes ("library not
available" vs "permission denied") so operators get actionable hints
without leaking credentials.

Adds `postgres` and `ioredis` as direct gateway deps; previously only
transitive. 12 unit tests cover happy paths and each fail-fast branch.

Refs #460
This commit is contained in:
Jarvis
2026-04-19 19:02:12 -05:00
parent 58169f9979
commit 7383380f64
7 changed files with 626 additions and 2 deletions

6
pnpm-lock.yaml generated
View File

@@ -152,12 +152,18 @@ importers:
fastify:
specifier: ^5.0.0
version: 5.8.2
ioredis:
specifier: ^5.10.0
version: 5.10.0
node-cron:
specifier: ^4.2.1
version: 4.2.1
openai:
specifier: ^6.32.0
version: 6.32.0(ws@8.20.0)(zod@4.3.6)
postgres:
specifier: ^3.4.8
version: 3.4.8
reflect-metadata:
specifier: ^0.2.0
version: 0.2.2