Skip to content

feat(rust-client): Implement many API using batch endpoint#277

Open
lcian wants to merge 53 commits intomainfrom
lcian/feat/rust-batch-client
Open

feat(rust-client): Implement many API using batch endpoint#277
lcian wants to merge 53 commits intomainfrom
lcian/feat/rust-batch-client

Conversation

@lcian
Copy link
Member

@lcian lcian commented Jan 23, 2026

Adds a many API that submits batch requests to the server.
The API is called many to indicate the fact that this can be interpreted as just a "hint" to use batching, but a many request from the user's pov doesn't necessarily map to a single batch request to the server.

This is a nice API when creating the requests but not so nice when retrieving the results, as the user will need to deal with wrapper types and different error types as well.

It should be kept in mind that most of the usage we expect here is from sentry-cli uploading multiple files. It's therefore quite unlikely that the user wants to inspect the result wrappers or anyways match on the errors, they most likely just care to know if all operations succeeded or not.

Motivated by the above reasons:

  • I introduced a error_for_failures function that's useful if you just want to know if all ops succeeded or not
  • As users are most interested in PUTs when using this API, I haven't thought about streaming the results of GET responses. We're just buffering the whole batch response with this implementation.

Close FS-241

@lcian
Copy link
Member Author

lcian commented Jan 23, 2026

@sentry review

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (rust-client) Implement many API using batch endpoint by lcian in #277
  • (types) Add origin as built-in metadata field by jan-auer in #292

Documentation 📚

  • (clients) Restructure Rust and Python client READMEs by jan-auer in #294

🤖 This preview updates automatically when you update the PR.

@lcian
Copy link
Member Author

lcian commented Jan 23, 2026

@sentry review

@lcian lcian force-pushed the lcian/feat/batch-impl branch from 3f49d54 to d6dbeee Compare January 26, 2026 13:09
@lcian lcian force-pushed the lcian/feat/rust-batch-client branch from 7f060c7 to bf71d9c Compare January 27, 2026 12:37
Base automatically changed from lcian/feat/batch-impl to main February 5, 2026 17:15
@lcian lcian marked this pull request as ready for review February 5, 2026 18:27
@lcian lcian requested a review from a team as a code owner February 5, 2026 18:27
BatchOperation::Get { key, decompress } => Some((key.clone(), *decompress)),
_ => None,
})
.collect();
Copy link

Choose a reason for hiding this comment

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

Duplicate GET operations lose individual decompress settings

Medium Severity

The decompress_map uses a HashMap keyed by ObjectKey, causing multiple GET operations on the same key to share a single decompress setting. When users add multiple GET requests for the same object with different decompress() values, only the last setting is retained. All responses for that key will incorrectly use the same decompression behavior, ignoring individual operation preferences and potentially returning data in the wrong format.

Additional Locations (1)

Fix in Cursor Fix in Web

@linear
Copy link

linear bot commented Feb 5, 2026

* origin/main:
  feat(gcs): Introduce retries (#279)
  build(deps): bump cryptography from 46.0.2 to 46.0.5 (#299)
  ref(service): Add metadata API, fix delete orphans, simplify BigTable backend (#298)
  ref(server): Add MeteredBody extractor and wrap_stream util (#293)
  meta(claude): Add default permissions for claude (#297)
  docs(clients): Restructure Rust and Python client READMEs (#294)
  ci: Add working directory to changelog-preview workflow (#295)
  feat(types): Add origin as built-in metadata field (#292)
  fix(metrics): Exclude health check endpoints from request metrics (#290)
  fix(service): Add backend tags to delete timing metric (#291)
  meta(ai): Add AGENTS file (#288)
  feat(killswitches): Add service filtering with x-downstream-service header (#287)
  build(deps): bump time from 0.3.44 to 0.3.47 (#285)
  meta(git): Ignore claude local settings (#286)

# Conflicts:
#	clients/rust/README.md
Copy link

@cursor cursor bot left a comment

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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

results.push(OperationResult::from_field(field, &decompress_map).await);
}

Ok(results)
Copy link

Choose a reason for hiding this comment

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

Missing batch response cardinality check

Medium Severity

send_batch returns whatever parts were parsed without verifying that the count matches submitted operations. If the server or an intermediary returns a valid multipart response with missing parts, OperationResults becomes incomplete and callers can treat omitted operations as if they never failed.

Fix in Cursor Fix in Web

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.

2 participants