Skip to content

Batch opt-in D1 keyed and partition reads for 0.4.7 - #13

Merged
FlyOverCoderKY merged 3 commits into
mainfrom
claude/d1-mixed-read-batching-20261111
Nov 11, 2026
Merged

FlyOverCoderKY merged 3 commits into
mainfrom
claude/d1-mixed-read-batching-20261111

Conversation

@FlyOverCoderKY

@FlyOverCoderKY FlyOverCoderKY commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Extend the existing opt-in D1 read queue to batch independent keyed and whole-partition reads together. Both join the same schema-ready scheduling boundary. Each caller decodes its own result after transport validation, and failures settle every queued request.

Set readBatchSize above one to group independent reads. Direct mode uses native first/all calls. Results carry opaque versions and pass through each caller's codec. The D1 package targets the unpublished 0.4.7 candidate with its exact Core dependency.

This supports the Help Desk's Workers Free integration. Complete host workflow and deployed CPU qualification are separate acceptance work.

Validation

  • A real Miniflare causal run on the previous implementation observed a three-statement keyed batch and a separate partition call.
  • All 174 real D1 cases pass after review fixes, including populated partition-bound results and 13 transport faults across mixed and partition-only batches.
  • Types and release metadata checks passed. Two current-candidate version expectations were updated to 0.4.7 after the full Node run identified the stale 0.4.6 assertions.
  • Fresh complete Node 22/24 format, type, runtime, packaging, consumer and review gates are required before merge and publication.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T07:53:05.832774Z 3ce09b4 Manual request
🔒 Security Review ✅ Completed 2026-11-11T07:53:51.703147Z 3ce09b4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

OpenRouter review posted (clean). #13 (review)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: issues
Scope: full-pr (full-pr)
Mode: initial
Commit: 008974c75d5061ca2b784b62d0dc977334ae05ac
Judge: openai/gpt-5.6-luna
Cost: $0.2403 (lanes $0.2379 + judge $0.0023)

Lanes

  • openai/gpt-6.1-sol: ok (2 finding(s), 71.6s, 237962+2218 tokens (190025 cached), 6 tool round(s), via Azure, $0.18)
  • z-ai/glm-5.3-flash: ok (4 finding(s), 206.7s, 1108517+34506 tokens (1020352 cached), 22 tool round(s), via Together, $0.0608)

Findings

🟠 Issue 1 — Stale D1 candidate version and release-tag guidance

packages/storage-cloudflare-d1/README.md:6 · risk · identified by openai/gpt-6.1-sol

A maintainer following the release runbook will create v0.4.6 for source whose D1 package is now 0.4.7, causing release preparation to fail because that tag matches no current public package version. Readers also receive conflicting descriptions of which candidate contains mixed-read batching.

The remaining current-candidate references include:

  • packages/storage-cloudflare-d1/README.md:6–7: identifies this source as 0.4.6 with keyed-only batching.
  • README.md:224–225: describes the current candidate as 0.4.6 with keyed-only batching.
  • docs/RELEASING.md:12, 30, 41, 78–83, and 176: names 0.4.6, including explicit instructions to create v0.4.6.
  • docs/AWS_ADAPTER.md:89: identifies the separate D1 candidate as 0.4.6.
  • AGENTS.md:105–106: retains the previous candidate description.

I checked the updated package manifest, root workspace pin, lockfile, and release expectations: these consistently use 0.4.7. scripts/release-packages.mjs:655–665 explicitly rejects a release tag without a matching package version. Update the current-candidate documentation and operational tag instructions together, while preserving genuine historical version references.

🔵 Issue 2 — Vacuous returned-row batch-bound test

packages/storage-cloudflare-d1/src/index.test.ts:996 · nit · identified by openai/gpt-6.1-sol

A regression that truncates partition results to readBatchSize, or incorrectly accounts for returned rows when chunking populated partition reads, can pass the new test intended to distinguish statement counts from row counts.

The test sets readBatchSize: 2 but seeds no records. The shared beforeEach clears RECORDS, so both partition calls return empty arrays. Its [2, 2, 1] assertion establishes statement chunking only for empty results, not the returned-row behavior named in the title. Seed a partition with more than two live rows, include it in the mixed wave, and assert both the complete returned contents and the expected physical batch sizes.

I checked the neighboring populated mixed-read test and the Core list conformance cases. The former returns two rows with a bound of 512; the latter also run with 512 in the opt-in lane. Neither exercises a partition whose returned row count exceeds the configured statement bound.

🟠 Issue 3 — Release runbook still plans the D1 candidate as 0.4.6/v0.4.6 after the bump to 0.4.7

docs/RELEASING.md:41 · risk · identified by z-ai/glm-5.3-flash

Following docs/RELEASING.md after this merge sends the maintainer to create a signed annotated v0.4.6 tag for a package that now declares "version": "0.4.7". The publish workflow hard-fails that combination: for the selected source package it requires record.version === manifest.releaseTag.slice(1) (.github/workflows/publish.yml line 551, "source origin differs"), and the npm-version gate rejects a tag/version mismatch the same way the recorded v0.4.3 attempt failed. The repo treats signed tags and failed-release records as immutable, so the mistake burns a permanent failed-attempt entry and delays the real v0.4.7 release.

🔵 Issue 4 — Stale "0.4.6 candidate" self-descriptions left across the D1 docs after the 0.4.7 bump

packages/storage-cloudflare-d1/README.md:6 · nit · identified by z-ai/glm-5.3-flash

The PR bumps the package to 0.4.7 and updates only the two test assertions, so every prose reference to the candidate version now contradicts packages/storage-cloudflare-d1/package.json.

🔵 Issue 5 — Batch-length failure of an all-partition batch is mislabeled "mixed-read"

packages/storage-cloudflare-d1/src/index.ts:355 · nit · identified by z-ai/glm-5.3-flash

If two concurrent listVersioned calls (or one list call) under readBatchSize > 1 are batched with no keyed reads and D1 returns a wrong-length results array, batchSettlements reports "D1 returned an invalid mixed-read batch." because the label is chosen by jobs.some((job) => job.kind === "partition"), not by whether the batch is actually mixed. A developer debugging the failure is sent looking for a keyed/partition mix that never existed; the label should be derived from job composition (all keyed → keyed-read, all partition → partition-read, otherwise mixed-read).

🔵 Issue 6 — Partition-read validation branches lack the fault matrix that pins the keyed-read branches

packages/storage-cloudflare-d1/src/index.test.ts:1116 · nit · identified by z-ai/glm-5.3-flash

The keyed-read slots of batchSettlements are pinned by an 11-fault matrix test ("rejects %s results from the real backend...": short, extra, sparse, null-slot, rows-not-array, extra-row, null-row, empty-version, numeric-version, invalid-deleted, invalid-json-field), but the new partition-read branches are exercised by only one shape fault (numeric version) plus two decode faults. If a future edit loosens the partition-row validation — e.g. drops the non-empty version check, accepts a non-string record_json, or mishandles { results: null } / a short or extra results array for a partition slot in a mixed batch — no test fails, even though each of those inputs reaches batchSettlements in production whenever a corrupted or mocked D1 response feeds a list/listVersioned slot.

Workflow run

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 008974c75d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 008974c75d

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

Fixed r1-1, r1-3 and r1-4 in 3ce09b4. Active D1 candidate and operator guidance now use unpublished 0.4.7 and v0.4.7. Published 0.4.6 and immutable historical release evidence retain their recorded versions. Current local format, type, 174-case Native D1 and release-metadata checks passed. Fresh current-head CI and review are running.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3ce09b43d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 3ce09b43d9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenRouter pull-request review

Verdict: clean
Scope: latest-commit (commit-range)
Mode: verify
Commit: 3ce09b43d9de0cbc3dee12134a08f16c795f67fd
Judge: openai/gpt-5.6-luna
Cost: $0.1039 (lanes $0.1038 + judge $0.0001)

Lanes

  • openai/gpt-6.1-sol: ok (0 finding(s), 31.8s, 59494+841 tokens (37417 cached), 3 tool round(s), via Azure, $0.0741)
  • z-ai/glm-5.3-flash: ok (0 finding(s), 352.9s, 390550+47669 tokens (301338 cached), 14 tool round(s), via OpenInference, $0.0298)

Round 2 resolution

  • ✅ r1-1 fixed correctly — Stale D1 candidate version and release-tag guidance: The D1 package README, root README, and related operator documentation now consistently identify 0.4.7 as the unpublished mixed keyed/whole-partition batching candidate, matching the package manifest. References to 0.4.6 distinguish the published keyed-read release rather than the current candidate. Repository-wide version searches found no remaining stale current-candidate references.
  • ✅ r1-3 fixed correctly — Release runbook still plans the D1 candidate as 0.4.6/v0.4.6 after the bump to 0.4.7: The release runbook now plans v0.4.7 and explicitly instructs maintainers to create its signed annotated tag. Its preparation, publication, and D1 acceptance guidance all name 0.4.7, matching the package manifest and the publish workflow's tag/version equality guard. Historical versions remain distinct.
  • 4 nit finding(s) from earlier rounds retired (severity floor for follow-up rounds is risk).
  • Open findings after this round: 0 (0 bug-severity).

No structured findings from the successful lane(s).

Workflow run

@FlyOverCoderKY
FlyOverCoderKY merged commit 536c2a3 into main Nov 11, 2026
5 checks passed
@FlyOverCoderKY
FlyOverCoderKY deleted the claude/d1-mixed-read-batching-20261111 branch November 11, 2026 08:23
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