fix(http): F-Q-008 add HttpError::InvalidArgs for user-input validation failures
http_service::run mapped `Method::from_bytes` failure on a user-supplied
HTTP method to HttpError::Backend with format!("invalid method: {}", …).
Same for HeaderName/HeaderValue validation in build_headers. But that's
user input, not a backend problem — misclassifying as Backend corrupts
retry policies (operators may retry "backend" but not "invalid input").
Add a new HttpError::InvalidArgs(String) variant. Reroute the three
validation paths in http_service (method, header name, header value) to
emit InvalidArgs instead of Backend.
The executor-side `map_http_err` uses Display, so the new variant
surfaces to scripts as "http: invalid method: …" — same format, more
structured behind it.
AUDIT.md anchor: F-Q-008.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,6 +109,13 @@ pub enum HttpError {
|
||||
#[error("{0}")]
|
||||
Network(String),
|
||||
|
||||
/// F-Q-008: user-supplied input failed validation (bad HTTP method
|
||||
/// name, malformed header name/value). Distinct from `Backend`
|
||||
/// because operators may safely retry a `Backend` error but should
|
||||
/// never retry an `InvalidArgs` failure — the input itself is wrong.
|
||||
#[error("{0}")]
|
||||
InvalidArgs(String),
|
||||
|
||||
/// Anything else the impl wants to surface (still safe to show a
|
||||
/// script).
|
||||
#[error("{0}")]
|
||||
|
||||
Reference in New Issue
Block a user