Repository navigation
Refuse a pushed batch whose reusedFromBatch isn't a batch ID - #104
Open
selfie-bot wants to merge 2 commits into
Open
selfie-bot wants to merge 2 commits into
selfie-bot wants to merge 2 commits into
Conversation
The sync route took reusedFromBatch as any text, but since #99 the store keeps it as 16 bytes through unhex(?, '-'). Text that isn't hex became NULL, so the batch was stored as reusing nothing; hex of the wrong length failed the column's CHECK as a server error; and an uppercase UUID came back lowercase, a different ID from the one sent. It now goes through readBatchId like a decision's batchId, so each of these is a 400 bad-request.
This was referenced Nov 29, 2026
This branch has not been deployed
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.
The cloud sync route now refuses a pushed batch whose
reusedFromBatchisn't a lowercase, hyphenated UUID, answering 400bad-requestthe way it already does for a decision'sbatchId. Since #99, the store keepsreused_from_batchas 16 bytes, converting it withunhex(?, '-')(render-batches.ts). ButreceivedBatchstill passed through any text:"not-a-batch") became NULL, so the batch was silently stored as reusing nothing"abcd") failed the column'sCHECK (length(...) = 16)and came back as a server error rather than a 400docs/specs/renders.md→ Schema says batch IDs are exchanged lowercase.I checked the
unhexresults above against SQLite directly. The CLI always sends its own lowercase IDs, so this only matters for a malformed push. It follows #97, which closed the same gap forstoryFilter.Verification: a new case in
ui/test/workerd/sync.workerd.test.tspushes a batch that reuses a valid ID and reads it back throughRenderBatches.getBatch. It then pushes each malformed value and expects a 400. TheSelfieworkflow doesn't runpnpm test(#105 adds that), so I ran the full suite on scratch branches carrying this PR plus #105's test job. With the fix, it passed (run). With thesync.tschange reverted, only the new test failed, withexpected 200 to be 400(run). I've since deleted both scratch branches.