Architecture · PR #412 · Cache generated reports in Redis
What the change did to the layers
Delivery sits above orchestration and adapters. The existing trigger_review call goes from api-main to review-pipeline. A new upward import from review-pipeline to api-main closes an import cycle. New calls from api-main and review-worker reach report-cache, which introduces a Redis boundary outside the process. Redis is not provisioned in either deployable.
routes.py
main_v2.py
review_worker.py
report_cache.py
trigger_reviewexisting
store_report_in_mongocloses an import cycle
ReportCache.get
ReportCache.put
- Added call
- Violation
- New boundary
- Existing call completing a cycle
Findings
-
High
0.74 · inferred
Orchestration → delivery:
main_v2.pyimportsroutes.pyforstore_report_in_mongoEvery other orchestration module sits below the routes. The call goes up a rank.
-
High
1.00 · proof
Import cycle:
routes.py↔main_v2.pyroutes.pyalready callstrigger_review; this change closes the loop. -
Medium
Measured
New boundary:
report_cache.pyis the first module in the repository to call RedisNo layer touched a cache before. Existing adapters carry
http · db · vector · queue · llm. -
Medium
Measured
REDIS_URLis read but set in no deployable's environmentNeither
code-review-apinorcode-review-burst-workernames it indeployment.yaml. -
Low
Confirmed
report_cache.pylogs vialogging.getLogger139 of 141 modules use
create_logger. Confirmed as a deviation, not a deliberate exception.
Worth a senior look
- Failure modeBoundary on a request path
-
GET .../reportnow calls Redis before Mongo. No timeout is set on the client, and an unreachable Redis raises rather than falling through to Mongo. The route returns a 500 instead of getting slower. - OperationalNew dependency, new environment
-
Redis is now a dependency of two deployables and
provisioned in neither. The burst worker also needs
REDIS_URL; today it has only the queue and Mongo. - ConsistencyWrite and read in different units
-
handle_feedback.pyupdatesgenerated_reportsdirectly and nothing invalidates the cached copy. A corrected report is served stale until TTL.