docs(memory-bank): record relay hardening policy baseline and operating knobs

This commit is contained in:
2026-03-24 11:55:24 +00:00
parent 4e390491c0
commit f12a719a1e
3 changed files with 75 additions and 0 deletions
+35
View File
@@ -45,3 +45,38 @@ Related:
- `context/project-overview.md`
- `memory-bank/README.md`
---
### D-002: Relay forwarding hardening policy baseline (P2-S3)
date: 2026-03-24
author: Cline
scope: `pages/api/middleware/relayForwarding.js`, relay-backed endpoint handlers
type: decision
rationale: Consolidate relay reliability behavior into one shared policy so retries, timeouts, and logging are predictable and safe across all migrated GET flows.
impact: Improves resilience and observability while reducing risk of accidental overload, noisy duplicate logs, and inconsistent retry behavior per endpoint.
status: accepted
Decision:
- Shared relay defaults and bounds are centrally enforced in middleware:
- timeout default `8000ms`, clamped to `100..30000ms`
- retries default `2`, clamped to `0..4`
- retry delays clamped to `0..5000ms`
- Retry classification is explicit:
- retryable: `408`, `429`, `5xx`, selected network/transient transport error codes
- non-retryable: deterministic client/auth statuses (`400`, `401`, `403`, `404`, `422`) and other explicit non-retryable HTTP statuses
- Structured relay logs are redacted and emitted once per failure path:
- relay layer emits retry/failure structured events
- endpoint catch logging avoids duplicate emission when relay layer already logged terminal failure
Consequences:
- Endpoint contracts remain unchanged while reliability behavior is normalized.
- Future relay policy changes should be made in one location and validated via phase21 hardening tests.
Related:
- `memory-bank/change-log.md` (CL-030, CL-031)
- `tests/phase21/relay-forwarding-hardening.test.cjs`