feat(api): make Redis a required cache dependency

Redis becomes mandatory infrastructure (PostgreSQL-parity): the
REDIS_ENABLED flag, NullCache backend, and every conditional caching
code path are removed. /health/ready reports not_ready (503) when
Redis is unreachable and cached endpoints return 503 instead of
silently degrading; invalidation helpers never raise after a
committed write.

The bundled redis container joins the core profile only via
docker-compose.dev.yml (production points REDIS_* at an external
instance, same no-shadowing pattern as postgres), the backend suite
runs against real Redis (test-redis on 127.0.0.1:55433, CI redis:8
service container, per-xdist-worker key prefixes), and operator docs
describe the required-dependency setup (upgrading.md gains the
v0.20.0 section).
This commit is contained in:
Louis King committed 2026-08-30 21:51:51 +01:00
1 parent e1f421f7bd
commit 3593d14878
26 files changed
+957 -449

No files matched your search

+16 -2
View File
@@ -1,5 +1,5 @@
# ==========================================================================
# Throwaway PostgreSQL instance for the backend test suite (pytest).
# Throwaway PostgreSQL + Redis instances for the backend test suite (pytest).
#
# NOT part of the application stack. Start/stop with:
# make test-db-up
@@ -11,7 +11,8 @@
# The meshcorehub role owns the meshcorehub_test database (image entrypoint),
# which is exactly the privilege the per-xdist-worker test schemas need
# (CREATE SCHEMA) — no superuser and no CREATEDB required. The data directory
# is a tmpfs mount, so nothing survives `down`.
# is a tmpfs mount, so nothing survives `down`. Redis (required cache
# infrastructure) is published on 55433 with the same tmpfs treatment.
# ==========================================================================
name: meshcore-hub-test-db
@@ -36,3 +37,16 @@ services:
interval: 5s
timeout: 5s
retries: 10
test-redis:
image: redis:8-alpine
container_name: meshcore-hub-test-redis
ports:
- "127.0.0.1:55433:6379"
tmpfs:
- /data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10