Repository navigation
fix: cache polling ETags only for accepted payloads - #515
Merged
keelerm84 merged 4 commits intoDec 1, 2026
Merged
Conversation
…ut an ETag An accepted 200 without an ETag header kept the previous ETag. If the server later reverted to that ETag, the SDK got a 304 and kept the newer data. The requesters now replace the ETag on every accepted 200, which matches the legacy Requestor.
This was referenced Dec 1, 2026
keelerm84
approved these changes
Dec 1, 2026
http 5 needs a body or a connection to build a response. JRuby resolves http 5.3.1, so the new ETag specs failed there.
Member
|
Thank you @pcbeingused33! As always, we appreciate the contribution. |
keelerm84
pushed a commit
that referenced
this pull request
Dec 3, 2026
(cherry picked from commit c0d19d3)
keelerm84
pushed a commit
that referenced
this pull request
Dec 3, 2026
(cherry picked from commit c0d19d3)
keelerm84
pushed a commit
that referenced
this pull request
Dec 3, 2026
(cherry picked from commit c0d19d3)
2 of 3 tasks
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.
Requirements
Related issues
Found while reviewing the polling requesters. There is no associated issue.
Describe the solution you've provided
Both polling requesters cached the ETag from an HTTP 200 response before converting its payload into a ChangeSet. If conversion failed, the next request could still send that ETag and receive a 304. The synchronizer then treated the poll as successful and could report the data source as valid without receiving usable flag data.
Cache the response ETag only after successful ChangeSet conversion. The regression test covers both protocols with a simulated server that returns 304 when the request sends the rejected payload's ETag. It checks that both poll attempts report an invalid payload.
On Ruby 4.0.9, the requester, payload parsing, and synchronizer specs ran 51 examples. Both regression cases failed before the fix, and all 51 examples passed afterward. RuboCop reported no offenses in the two changed files.
Additional context
AI assistance was used to prepare the patch and regression tests.
Note
Overview
Fixes incorrect ETag caching in both HTTP polling requesters (
HTTPPollingRequesterandHTTPFDv1PollingRequester). Previously, a 200 response’sETagwas stored as soon as the body was JSON-parsed, even when changeset conversion failed. The next poll could sendIf-None-Matchfor that bad payload, get a 304, and look successful without usable flag data.The change defers
@etag = etaguntilchangeset_result.success?, so only accepted payloads drive revalidation. The prior ETag is retained after a rejected response, and responses with no ETag no longer leave a stale cached value from a failed parse path in the same way.Adds shared RSpec coverage for both requester classes: revalidation with a good ETag, clearing ETag when a later accepted response has none, keeping the last good ETag after an invalid payload, and ensuring a rejected payload’s ETag is not used for
If-None-Match(so a 304 cannot mask repeated invalid responses).Reviewed by Cursor Bugbot for commit da087d6. Bugbot is set up for automated code reviews on this repo. Configure here.