Skip to content

fix(bindings/nodejs): reject invalid BigInt chunk and gap options - #9604

Open
rohan4naik wants to merge 1 commit into
apache:mainfrom
rohan4naik:fix-nodejs-bigint-options-9569
Open

rohan4naik wants to merge 1 commit into
apache:mainfrom
rohan4naik:fix-nodejs-bigint-options-9569

Conversation

@rohan4naik

Copy link
Copy Markdown

Which issue does this PR close?

Closes #9569.

Rationale for this change

On the baseline, the Node.js binding accepts -1n and 1n << 64n for write chunk and read/reader gap. Sixteen new regression cases fail because the calls succeed rather than return InvalidArg.

What changes are included in this PR?

Use the generator's existing UsizeBigInt mapping for these three fields, regenerate the option structs and declarations, and remove the unused lossy mapping. This reuses bigint_to_usize, as CopyOptions.chunk does, instead of adding validation to individual operation entry points.

Tests cover rejection in all eight async/sync methods, unchanged stored content after rejected writes, and valid zero values. Surface tests now use valid values where they previously asserted truncation.

Local validation: debug native build; full memory-backed Vitest suite (617 passed, 114 capability-dependent skips); all 199 development-tool tests; 3 binding Rust tests; binding Clippy with warnings denied; Rust formatting and Prettier on changed tests. Other storage services and 32-bit targets were not exercised.

Are there any user-facing changes?

Negative or overflowing chunk/gap BigInts return InvalidArg. Zero remains accepted. TypeScript signatures are unchanged; generated documentation describes the validation.

Breaking changes

AI Usage Statement

  • Harness: OpenMausBot / Codex
  • Model: GPT-6 (the exact model variant is not exposed)
  • Effort: Not exposed by this harness
  • Role: AI-assisted reproduction, implementation, tests, diff review and PR description. Rohan Naik is the accountable contributor. Validation limits are stated above.

Copilot AI balanced review requested due to automatic review settings December 3, 2026 14:20

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added bindings/nodejs releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:L This PR changes 100-499 lines, ignoring generated files. labels Dec 3, 2026
@Xuanwo

Xuanwo commented Dec 3, 2026

Copy link
Copy Markdown
Member

Could you merge or rebase current main into this branch so typos picks up #9602? The failed check flagged three occurrences of caf in bindings/c/tests/write_options.cpp. #9602 rewrote that UTF-8 fixture on main.

(AI-generated comment)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bindings/nodejs releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(bindings/nodejs): reject negative and overflowing BigInt values in WriteOptions.chunk and Read/ReaderOptions.gap

3 participants