Repository navigation
[host01] Batch D1 reads within request-scoped limits #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a01df00
Batch D1 reads within explicit per-page limits
FlyOverCoderKY d4695f7
[host01] Isolate historical release fixtures for D1 reuse
FlyOverCoderKY 39a3d33
[host01] Prepare D1 0.4.6 with qualified registry reuse
FlyOverCoderKY 0b7f5e4
[host01] Address D1 review findings and pin complete packed acceptance
FlyOverCoderKY 3fffe55
[host01] Pin fixture provenance to canonical public response
FlyOverCoderKY da9744b
[host01] Correct historical D1 batch accounting evidence
FlyOverCoderKY File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Reversed Cloudflare D1 quota-accounting claim (batch = one query) is now asserted as fact and underpins the feature's value proposition (
risk)If the linked Cloudflare limits page does not actually say that one
db.batch()counts as a single query against the per-invocation limit, the new documentation actively misleads Free-plan users: a 512-statement read batch or a 100-action transaction would still consume 50/100+ queries per invocation, and a host that adoptsreadBatchSize: 512to stay inside the 50-query Free budget would instead be throttled mid-request.This is not a neutral restatement: the code comment being edited asserted the exact opposite before this PR ("every statement inside a batch counts against the Worker invocation's D1 query budget"), and the whole rationale for
MAX_TRANSACTION_ACTIONS = 100was premised on that older understanding. The PR flips the claim in three places at once:packages/storage-cloudflare-d1/src/index.tsMAX_TRANSACTION_ACTIONS comment (~line 32): "D1 counts a batch as one query against the invocation budget"packages/storage-cloudflare-d1/README.md(~line 113): "onedb.batch()counts as one query against that limit, not one per statement" and "50 queries per Free Worker invocation"packages/storage-cloudflare-d1/README.mdtransaction section (~line 168): "Cloudflare counts the batch as one query against the invocation query budget"I could not verify the external claim: the review environment has no network access, and no repository file or test pins the Cloudflare-documented accounting. Given the repository's own discipline of not asserting unqualified external facts, the claim should be re-verified against the linked page (and ideally pinned with a quoted excerpt and observation date, as
tests/fixtures/release-registry/README.mddoes) before this text is published in the 0.4.6 package README.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current Cloudflare limits page explicitly documents this accounting rule. Under “Batch limits” it says: “a
db.batch()call counts as a single query against it”. The same page lists 50 queries per Worker invocation on Free and 1,000 on Paid. See Cloudflare D1 limits, updated October 30, 2026.The per-statement SQL limits still apply to each individual statement. Our README separates those limits from the adapter's configurable 1–512 statement batching bound. This PR makes no claim that a local test proves live Free CPU or daily usage acceptance.
The finding's conditional premise is therefore contradicted by the current primary documentation. I am retaining the correct accounting statement and leaving this thread visible with the supporting evidence.