fix(session-erasure): map the pipeline's unsupported_storage refusal to a static 503
Summary
The history pipeline now answers an erase it cannot perform with its current storage or ingest state with an authenticated 503 {"error":"unsupported_storage","feature":"session_erase"}. Repeating that request cannot succeed, so Control must not describe it as retryable.
- On an upstream 503 only, Control now reads the error body (bounded to 4096 bytes, reader cancelled on every path) and, when both fields match exactly, returns a static
503 session_erasure_unsupported_storagewith the fixed messageThis session cannot be erased with the current storage or ingest configuration.and no retry hint. Both the erase request and the verification read share this mapping. - Everything else keeps the existing static
503 session_erasure_unavailable: other codes, wrong or missingfeature, malformed, empty, non-object or oversized bodies, read failures, other 5xx and network errors.501staysnot_implemented. - No upstream text or identifiers are echoed and the upstream
Retry-Afteris not forwarded. The two-field error shape is unchanged. docs/session-erasure.mdand both503descriptions inopenapi.yamllist the new code.
Source only. The feature stays default-off; no deployment, flag or permission change is implied.
Tests
New test in test/session-erasure.test.ts covering the DELETE and the verification GET, the exact recognised refusal with an upstream Retry-After header, provider text alongside the exact shape, wrong feature / missing feature / wrong case / other codes / array / string / non-JSON / empty / oversized bodies, 501 with the same body, and 500 with the same body. The existing table test (too_many_owners and {} still session_erasure_unavailable) is unchanged.
Local checks on the PR head (layered-heavy, one worker): npm run typecheck exit 0; test/session-erasure.test.ts 13 tests, 13 pass, 0 fail, 0 cancelled.
š¤ Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith Ā· Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Maps the history pipeline's unsupported_storage refusal to a static, non-retryable 503 so Control stops describing an unretryable erase as retryable.
- On an upstream 503 only, Control reads the body (bounded to 4096 bytes, reader cancelled on every path) and, when both
errorandfeaturefields match exactly, returns503 session_erasure_unsupported_storagewith a fixed message, no retry hint, and no forwardedRetry-Afterā on both the erase request and the verification read. - Everything else (other codes, wrong or missing feature, malformed or oversized bodies, read failures, other 5xx) stays
session_erasure_unavailable;501staysnot_implemented. - No upstream text or identifiers are echoed, and the two-field error shape is unchanged.
docs/session-erasure.mdand both503descriptions inopenapi.yamllist the new code.