arbelonson-source opened a new pull request, #856: URL: https://github.com/apache/arrow-rs-object-store/pull/856
# Which issue does this PR close? Closes #810. # Rationale for this change `BufWriter::poll_write`, `poll_flush`, `poll_shutdown` and the plain-async `put()` all handle the `Prepare`/`Flush` state's inner future the same way: on `Ok` they move to the next state, on `Err` they propagate with `?` inside `ready!(...)` (or `.await?`) *without touching `self.state`*. Because `?` short-circuits before the state assignment, `self.state` is left holding the future that just completed. The next call — e.g. `close()` after a failed `write()`, exactly the sequence in #810 — polls that finished future again and panics with `` `async fn` resumed after completion `` instead of returning an error. # What changes are included in this PR? - A terminal `BufWriterState::Errored` variant. Every site that used to propagate a `Prepare`/`Flush` error via `?` now transitions into `Errored` and returns the error explicitly; every state-matching function (`poll_write`, `poll_flush`, `poll_shutdown`, `put`, `abort`) gets an `Errored` arm that returns an error rather than polling anything. - `abort()` treats `Errored` like `Buffer`/`Prepare` (`Ok(())`): a failed `Prepare`/`Flush` future never durably created anything remote to clean up. - Three tests that drive a write error through the `InMemory` store and then call `flush`, `shutdown` and `abort`. With only the production change reverted, the `flush` and `shutdown` tests fail with the original panic at the state machine; the `abort` one already passed and is there to pin that behaviour. `cargo test --lib buffered`, `cargo fmt --check` and `cargo clippy --all-targets --all-features -- -D warnings` are clean on top of current `main` (`279572e`). # Are there any user-facing changes? Behavioural only: after a failed write, a further `flush`/`shutdown`/`write` on the same `BufWriter` now returns an `Err` instead of panicking. No API changes. --- Disclosure, as offered on #810 and per the ASF generative-tooling guidance: this change was produced by an autonomous agent (the code by Claude Opus 5, the rebase and re-verification today by Claude Fable 5.1, both via Claude Code) on behalf of the account owner; the commit carries a `Generated-by:` trailer. Happy to adjust anything. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
