Map engine Configuration errors to 400 (detect-but-never-redact) - #254
Conversation
Pull elide-runtime, which now rejects a request or policy set that can detect but never redact — the misconfiguration that previously returned a successful, byte-identical "redaction" (the redacted file equalled the input). The engine raises a Configuration error naming the cause. Map EngineErrorKind::Configuration to a 400 in the engine-error conversion, so that rejection (and other caller-supplied incoherence, like a reviewer override naming an off-pipeline policy) surfaces as a client error the user can fix rather than an opaque "Redaction engine failed" 500. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018bKk1YEG4tZ69jzYVQvQL8
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe server now maps ChangesEngine Error Mapping
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change reports caller-correctable pipeline configuration failures as HTTP 400 instead of HTTP 500, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Pulls
elide-runtime(with #421), which now rejects a request or policy set that can detect but never redact — the exact misconfiguration that previously produced a successful but byte-identical "redaction" (the redacted file equalled the input). The engine now raises aConfigurationerror naming the cause instead of silently returning a document that only looks processed.On our side, the engine-error conversion mapped only
MalformedInputto a client error and everything else — includingConfiguration— to a 500. So the new rejection would have surfaced as an opaque "Redaction engine failed" (500). This mapsEngineErrorKind::Configurationto a 400 with a clear message, so that rejection (and other caller-supplied incoherence, e.g. a reviewer override naming an off-pipeline policy) reads as a client error the user can fix.Why this matters
This closes the loop on the "redacted file is identical to the original" bug: the root cause was policies with detection scope but no matching redaction operator (our shipped templates covered only the text modality). It is now caught upstream and reported correctly as a 400 end-to-end, rather than shipping a deceptive clean-looking file.
Verification
Full gate green:
cargo check,clippy -D warnings,fmt --check,doc -D warnings,cargo test --lib. Lockfile bump + a one-branch change inengine_error.rs; no other source changes were required.🤖 Generated with Claude Code
Summary by CodeRabbit