Conversation
When a document's primary key contained URL-reserved characters (e.g. `&`, `#`, `=`), the `id` in the pull URL was parsed incorrectly by the server: the checkpoint got truncated at the first reserved char. With batchSize 1 this caused the pull loop to never advance past such a document, since the server kept returning the same doc. The client now passes `id` through `encodeURIComponent`. https://claude.ai/code/session_01KrbsDQ3tY2qPsJaaoGbWVa
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.
This PR contains:
Describe the problem you have without this PR
When replicating documents whose primary key contains URL-reserved characters (such as
&,#,=), the replication pull request URL was not properly encoding the checkpointidparameter. This caused the server to parse the URL incorrectly, truncating the checkpoint ID at the first special character. WithbatchSize: 1, this prevented the pull loop from advancing past documents with such primary keys, causing replication to hang.Changes
Source Code
encodeURIComponent()call when constructing the pull request URL to properly encode the checkpointidparameter that may contain URL-reserved characters.Tests
should replicate documents whose primary key contains url-unsafe charactersthat verifies replication works correctly with primary keys containing special characters like&. The test usesbatchSize: 1to ensure the encoded checkpoint ID is actually sent back to the server on subsequent pulls.Documentation
Test Plan
The new test case
should replicate documents whose primary key contains url-unsafe characterscovers this fix by:&)batchSize: 1to force the checkpoint ID to be sent back to the serverExisting tests continue to pass, confirming no regression in normal replication scenarios.
https://claude.ai/code/session_01KrbsDQ3tY2qPsJaaoGbWVa