Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

refactor!: make idempotency_token private #306

Merged
quettabit merged 1 commit intomainfrom
qb/priv-idem-token
Feb 14, 2026
Merged

refactor!: make idempotency_token private #306
quettabit merged 1 commit intomainfrom
qb/priv-idem-token

Conversation

@quettabit
Copy link
Member

No description provided.

@quettabit quettabit requested a review from a team as a code owner February 14, 2026 05:56
@quettabit quettabit changed the title feat!: make idempotency_token in CreateBasinInput and CreateStreamInput private feat!: make idempotency_token private Feb 14, 2026
@greptile-apps
Copy link

greptile-apps bot commented Feb 14, 2026

Greptile Overview

Greptile Summary

This breaking change makes the idempotency_token field private in both CreateBasinInput and CreateStreamInput, and removes the with_idempotency_token() builder methods. The token is now always auto-generated as a random UUID v4 inside the new() constructor, preventing users from setting or overriding it.

  • The idempotency_token field visibility changes from pub to private in both CreateBasinInput and CreateStreamInput
  • The with_idempotency_token() builder methods are removed from both structs
  • Two integration tests that exercised idempotency with user-supplied tokens are removed (create_stream_idempotent_same_token and create_stream_idempotent_different_token_errors)
  • The structs already have #[non_exhaustive] and Clone derives, so users must use new() (which auto-generates the token) and can clone() to reuse the same token for retries
  • All remaining imports in tests/basin_ops.rs (including uuid and assert_matches) are still used by other tests

Confidence Score: 5/5

  • This PR is safe to merge — it's a clean API surface reduction with no behavioral bugs.
  • The change is straightforward: it hides a field and removes a builder method, enforcing that idempotency tokens are always auto-generated. The #[non_exhaustive] attribute already prevents direct struct construction, so users were already going through new(). The Clone derive ensures tokens can be reused for retries. No remaining references to the removed methods exist, and all test imports remain valid.
  • No files require special attention.

Important Files Changed

Filename Overview
src/types.rs Makes idempotency_token field private in CreateBasinInput and CreateStreamInput, removes with_idempotency_token() builder methods; tokens are now always auto-generated via UUID in the new() constructors.
tests/basin_ops.rs Removes two idempotency-related integration tests (create_stream_idempotent_same_token and create_stream_idempotent_different_token_errors) that relied on the now-removed with_idempotency_token method. All remaining imports are still used.

Flowchart

flowchart TD
    A["User calls CreateBasinInput::new() / CreateStreamInput::new()"] --> B["idempotency_token auto-generated via UUID v4"]
    B --> C["User chains .with_config() / .with_scope()"]
    C --> D["Input passed to S2::create_basin() / S2Basin::create_stream()"]
    D --> E["From impl extracts (Request, idempotency_token)"]
    E --> F["Token sent as S2_REQUEST_TOKEN header"]
    
    style B fill:#90EE90,stroke:#333
    
    G["Previously: User could call .with_idempotency_token()"] -.-> |"Removed"| B
    style G fill:#FFB6C1,stroke:#333
Loading

Last reviewed commit: fcb13e7

@quettabit quettabit changed the title feat!: make idempotency_token private refactor!: make idempotency_token private Feb 14, 2026
@quettabit quettabit merged commit 76cc045 into main Feb 14, 2026
6 checks passed
@quettabit quettabit deleted the qb/priv-idem-token branch February 14, 2026 06:02
@github-actions github-actions bot mentioned this pull request Feb 14, 2026
shikhar pushed a commit that referenced this pull request Feb 15, 2026
## 🤖 New release

* `s2-sdk`: 0.23.8 -> 0.24.0 (⚠ API breaking changes)

### ⚠ `s2-sdk` breaking changes

```text
--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/inherent_method_missing.ron

Failed in:
  CreateBasinInput::with_idempotency_token, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:913
  CreateStreamInput::with_idempotency_token, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:2583

--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---

Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/struct_pub_field_missing.ron

Failed in:
  field idempotency_token of struct CreateBasinInput, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:882
  field idempotency_token of struct CreateStreamInput, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:2561

--- failure struct_pub_field_now_doc_hidden: pub struct field is now #[doc(hidden)] ---

Description:
A pub field of a pub struct is now marked #[doc(hidden)] and is no longer part of the public API.
        ref: https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#hidden
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/struct_pub_field_now_doc_hidden.ron

Failed in:
  field CreateBasinInput.idempotency_token in file /tmp/.tmp5yfqnq/s2-sdk-rust/src/types.rs:868
  field CreateStreamInput.idempotency_token in file /tmp/.tmp5yfqnq/s2-sdk-rust/src/types.rs:2539
```

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.24.0] - 2026-02-15

### Features

- Add accessors for `AppendRecord`
([#305](#305))
- [**breaking**] Add lower bounds for `max_batch_bytes` and
`max_batch_records`
([#309](#309))
- [**breaking**] Reduce default `max_unacked_bytes` to `5MiB`
([#311](#311))

### Refactor

- Replace `reqwest` with `hyper-util` and add client pooling
([#298](#298))
- [**breaking**] Make `idempotency_token` private
([#306](#306))
- [**breaking**] Remove unnecessary `Result` from
`with_max_unacked_batches`
([#307](#307))
- Remove unnecessary compression for GET and DELETE requests
([#308](#308))
- Rename fields, methods, and vars related to `RetryBackoff`
([#310](#310))
- [**breaking**] Make `S2DateTime` conversion from
`time::OffsetDateTime` fallible
([#312](#312))

### Testing

- Metrics
([#297](#297))
- Basin & stream api
([#300](#300))

### Miscellaneous Tasks

- Bump dependencies
([#296](#296))
- Dep updates
([#314](#314))

<!-- generated by git-cliff -->
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant