ref(service): Simplify semantic service errors - #606
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #606 +/- ##
==========================================
+ Coverage 88.54% 88.96% +0.42%
==========================================
Files 105 105
Lines 17289 17368 +79
==========================================
+ Hits 15308 15451 +143
+ Misses 1981 1917 -64
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ef9dc89. Configure here.
| Err(ApiError::Service(e)) => match e.kind() { | ||
| ErrorKind::RangeNotSatisfiable { total } => { | ||
| let mut response = ( | ||
| StatusCode::RANGE_NOT_SATISFIABLE, | ||
| [( | ||
| http::header::CONTENT_RANGE, | ||
| ContentRange::unsatisfiable_total_to_header_value(total), | ||
| )], | ||
| ) | ||
| .into_response(); | ||
| insert_accept_ranges(&mut response); | ||
| return Ok(response); | ||
| } | ||
| _ => return Err(e.into()), |
There was a problem hiding this comment.
API error serialization exposes preserved backend diagnostics to callers
Service failures returned by API handlers are serialized with their complete error chain, allowing authenticated callers to receive backend operation context, HTTP status, backend-provided codes/messages, and transport diagnostics such as request URLs. Restrict client responses to stable semantic ErrorKind details and retain preserved sources for logging only.
Evidence
object_getcallsservice.get_object(id, byte_range).awaitand returns non-rangeApiError::Servicefailures unchanged, while the request path supplies the object identifier used by the backend operation.ApiError::IntoResponseand batchcreate_error_partcallApiErrorResponse::from_error, which walkserror.source()and serializes every cause string into the publiccausesfield.ServiceErrorpreserves its source chain;BackendResponseErrorformats the fixed backend operation context, HTTP status, and parsed backend code/message, while transport errors retainreqwestdiagnostics.ApiError::capture()only controls logging and does not remove or redact the source chain before serialization.
Identified by Warden · security-review · 6HA-968
|
After iterating on this a bit more, this approach doesn't work at all. Since backtraces are not stabilized, I'm not able to find a good API that allows us to capture them with the tracing integration. We will instead go back to tracking custom context descriptions for now. |

Replace the service error enum with an opaque error and semantic error kinds.
Preserve backend response details as structured source errors. Classify panics, client stream failures, corrupt data, and capacity failures consistently across service and server code.
Capture origin backtraces unconditionally and simplify error propagation.
Replaces #547
Closes FS-446
Ref FS-358