Skip to content

fix: fall back when payload compression fails#187

Open
marandaneto wants to merge 3 commits into
mainfrom
fix/compression-failure-fallback
Open

fix: fall back when payload compression fails#187
marandaneto wants to merge 3 commits into
mainfrom
fix/compression-failure-fallback

Conversation

@marandaneto

Copy link
Copy Markdown
Member

💡 Motivation and Context

When compress_request is enabled, local gzip failures should not cause the batch to fail or be dropped before the request is sent. The SDK should send the original payload uncompressed instead.

This updates the curl, socket, and forked curl consumers to fall back to the original payload when compression fails, and lets the shared HTTP client omit Content-Encoding: gzip for that fallback request.

💚 How did you test it?

  • composer install --no-interaction --no-progress
  • ./vendor/bin/phpunit --no-coverage test/QueueConsumerTest.php test/ConsumerLibCurlTest.php test/ConsumerSocketTest.php test/ConsumerForkCurlTest.php

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented as part of a cross-SDK consistency pass for client-side compression failure fallback. Kept the change limited to existing compression-enabled batch upload paths.

@marandaneto marandaneto self-assigned this Jun 27, 2026
@greptile-apps

greptile-apps Bot commented Jun 27, 2026

Copy link
Copy Markdown

Comments Outside Diff (1)

  1. lib/HttpClient.php, line 83-88 (link)

    P2 The $requestOptions docblock is missing the newly supported compressRequest key. Static-analysis tools and IDEs will not recognise it as a valid option, and future callers won't discover it from the type annotation.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Reviews (1): Last reviewed commit: "fix: fall back when payload compression ..." | Re-trigger Greptile

Comment thread lib/Consumer/LibCurl.php
@marandaneto

Copy link
Copy Markdown
Member Author

Addressed the Greptile outside-diff note in c39b0c0 — documented the compressRequest request option in the HttpClient docblock.

@marandaneto marandaneto marked this pull request as ready for review June 29, 2026 06:30
@marandaneto marandaneto requested a review from a team as a code owner June 29, 2026 06:30
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Reviews (2): Last reviewed commit: "Fix compression fallback request options" | Re-trigger Greptile

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