Skip to content

ref(service): Simplify semantic service errors - #606

Open
jan-auer wants to merge 3 commits into
mainfrom
ref/semantic-service-errors
Open

ref(service): Simplify semantic service errors#606
jan-auer wants to merge 3 commits into
mainfrom
ref/semantic-service-errors

Conversation

@jan-auer

@jan-auer jan-auer commented Aug 31, 2026

Copy link
Copy Markdown
Member

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

@jan-auer
jan-auer requested a review from a team as a code owner August 31, 2026 13:46
@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

FS-358

FS-446

Comment thread objectstore-service/src/service.rs Outdated
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.36842% with 124 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.96%. Comparing base (cd1aca6) to head (81741fb).

Files with missing lines Patch % Lines
objectstore-service/src/backend/gcs.rs 42.42% 38 Missing ⚠️
objectstore-service/src/error.rs 68.14% 36 Missing ⚠️
objectstore-service/src/backend/s3_compatible.rs 5.55% 17 Missing ⚠️
objectstore-service/src/backend/local_fs.rs 11.11% 8 Missing ⚠️
objectstore-service/src/backend/extensions.rs 88.13% 7 Missing ⚠️
objectstore-service/src/backend/bigtable.rs 78.57% 6 Missing ⚠️
objectstore-server/src/endpoints/common.rs 28.57% 5 Missing ⚠️
objectstore-service/src/concurrency.rs 88.00% 3 Missing ⚠️
objectstore-service/src/backend/in_memory.rs 60.00% 2 Missing ⚠️
objectstore-server/src/endpoints/objects.rs 94.73% 1 Missing ⚠️
... and 1 more
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     
Components Coverage Δ
Rust Backend 93.06% <67.36%> (+0.53%) ⬆️
Rust Client 81.97% <ø> (ø)
Python Client 93.56% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread objectstore-service/src/backend/tiered.rs Outdated
Comment thread objectstore-service/src/service.rs
Comment thread objectstore-service/src/backend/extensions.rs Outdated
Comment on lines +79 to +92
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()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_get calls service.get_object(id, byte_range).await and returns non-range ApiError::Service failures unchanged, while the request path supplies the object identifier used by the backend operation.
  • ApiError::IntoResponse and batch create_error_part call ApiErrorResponse::from_error, which walks error.source() and serializes every cause string into the public causes field.
  • ServiceError preserves its source chain; BackendResponseError formats the fixed backend operation context, HTTP status, and parsed backend code/message, while transport errors retain reqwest diagnostics.
  • ApiError::capture() only controls logging and does not remove or redact the source chain before serialization.

Identified by Warden · security-review · 6HA-968

@jan-auer

jan-auer commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant