Skip to content

fix(csv-generate): make numeric zero seeds deterministic - #519

Open
wanghanyu654321-cell wants to merge 1 commit into
adaltas:masterfrom
wanghanyu654321-cell:fix/generate-zero-seed
Open

wanghanyu654321-cell wants to merge 1 commit into
adaltas:masterfrom
wanghanyu654321-cell:fix/generate-zero-seed

Conversation

@wanghanyu654321-cell

Copy link
Copy Markdown

Numeric seed: 0 currently selects Math.random(), so identical generator options produce different output despite the documented numeric-seed repeatability contract.

Normalize numeric zero to the existing nonzero starting seed (1). This makes zero repeatable while leaving false, the default, booleans and nonzero seeds on their existing paths. Zero intentionally shares the sequence of seed 1: letting the recurrence run from zero instead would produce only empty ASCII fields and prevent an unbounded object stream from yielding.

Adds public sync, callback and async-iteration regressions, plus a first-record regression in a child process with a 10-second deadline and 32 MB heap cap. The original implementation fails the three repeatability tests; the final change passes all nine seed tests. No stream accounting changes or new dependencies.

Validation on Node 20.20.2, 22.23.2 and 24.21.0 / Linux:

  • npm run test -- --concurrency=1: all 14 project test tasks, including configured TypeScript checks, pass.
  • npm run lint:check -- .: passes.
  • npm run build -- --concurrency=1: all 7 build tasks pass.
  • Source and built CJS sync/callback/stream, bounded first-record and positive-seed controls pass.

Dependencies were installed with npm ci --ignore-scripts; the reviewed official DuckDB prebuilt binding was installed for the existing sample test. Node 20 emits existing development-tool engine warnings, but all checks above finish successfully. Early Windows quoting/CRLF and Docker interruption attempts were excluded from the passing evidence; final checks used Git LF sources and one container at a time.

AI assistance: Codex implemented the change and tests and a separate Codex review assessed the diff. This disclosure does not claim personal human review or successful upstream CI.

Normalize zero to the existing nonzero starting seed so repeatability does
not introduce an all-empty ASCII recurrence. Cover sync, callback, stream
and bounded first-record behavior without changing stream accounting.
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