Skip to content

fix: build null validity predicates without dynamic code generation - #501

Open
ibgreen wants to merge 1 commit into
apache:mainfrom
ibgreen:codex/validity-without-dynamic-code
Open

ibgreen wants to merge 1 commit into
apache:mainfrom
ibgreen:codex/validity-without-dynamic-code

Conversation

@ibgreen

@ibgreen ibgreen commented Oct 13, 2026

Copy link
Copy Markdown

Goals

Allow Arrow builders to work in runtimes that prohibit eval and the Function constructor, without carrying a downstream bundle patch.

Closes #54.

Changes

  • Replace dynamically compiled switch statements with captured validity predicates.
  • Preserve the always-valid empty case and use direct comparisons for a single sentinel, including NaN.
  • Use a snapshot Set for multiple sentinels, retaining primitive type distinctions and positive/negative-zero matching. Membership operates on supplied values directly rather than serializing them; object/symbol sentinels therefore use identity.
  • Cover null, undefined, NaN, zeros, bigint, quoted/multiline strings, duplicates, input-list mutation and a blocked Function constructor.
  • Remove the generated-source serializer and update the helper documentation.

Verification

  • New predicate tests plus existing builder conformance: 447 passed.
  • Final predicate rerun: 12 passed; changed-file ESLint passed.
  • Source build type check: tsc --noEmit -p tsconfig/tsconfig.esnext.esm.json passed.
  • Additional boundary checks passed with Node's --disallow-code-generation-from-strings flag.
  • General root type-check commands report errors outside these changed files (ix resolution and existing bin/test/dependency typings); no compiler configuration is changed here.

The old switch-vs-Map performance claim is removed rather than retained for a different implementation. The single-sentinel fast path avoids Set lookup; multi-sentinel performance remains a review consideration. This does not claim to resolve any npm scanning hold.

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.

[JS] apache-arrow doesn't work on platform restricting eval/new Function

1 participant