fix: improve POST retry tests and document idempotency assumption#159
Merged
Conversation
- Add comment explaining duplicate-query risk when retrying POST on connection-level errors (Faraday::TimeoutError, ConnectionFailed) - Fix test name: Timeout::Error -> Faraday::TimeoutError - Parameterize retryable status test to cover 502, 503, and 504 - Add test for retry_timeout exhaustion raising TrinoHttpError(408)
6c239e8 to
f61ed83
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Follow-up to the earlier POST retry work, this PR clarifies the non-idempotency risk of retrying POST /v1/statement and strengthens the spec coverage around POST retry behaviors and retry-timeout exhaustion.
Changes:
- Document the non-idempotent/duplicate-submission risk when retrying connection-level errors on
POST /v1/statement. - Expand POST retry specs to cover all retryable HTTP statuses (502/503/504).
- Add a spec for
retry_timeoutexhaustion on POST (expects a timeout-styleTrinoHttpError).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/trino/client/statement_client.rb | Adds an inline comment documenting the idempotency/duplicate-query assumption when retrying POST transport errors. |
| spec/statement_client_spec.rb | Improves POST retry specs by parameterizing retryable statuses and adding a retry-timeout exhaustion expectation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ryukobayashi
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #157 ("Add retry to POST /v1/statement") addressing review findings discovered after merge.
post_query_request!documenting that retryingFaraday::TimeoutError/ConnectionFailedon POST can submit duplicate queries, and explaining the load-balancer assumption that makes it intentionalFaraday::TimeoutError, notTimeout::Errordirectly)RETRYABLE_STATUSES: 502, 503, and 504 (only 503 was tested)retry_timeoutexhaustion on POST — verifiesTrinoHttpError(408)is raised when retries run outTest plan
bundle exec rspec spec/statement_client_spec.rb— all 47 examples passbundle exec standardrb lib/trino/client/statement_client.rb spec/statement_client_spec.rb— no offenses🤖 Generated with Claude Code