Skip to content

feat: Implement proposal-arraybuffer-base64#4630

Open
magic-akari wants to merge 1 commit intoboa-dev:mainfrom
magic-akari:feat/arraybuffer-base64-data-encoding
Open

feat: Implement proposal-arraybuffer-base64#4630
magic-akari wants to merge 1 commit intoboa-dev:mainfrom
magic-akari:feat/arraybuffer-base64-data-encoding

Conversation

@magic-akari
Copy link
Contributor

@github-actions
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 52,862 52,862 0
Passed 49,471 49,534 +63
Ignored 2,249 2,187 -62
Failed 1,142 1,141 -1
Panics 0 0 0
Conformance 93.59% 93.70% +0.12%
Fixed tests (63):
test/built-ins/Uint8Array/fromHex/length.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/odd-length-input.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/name.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/results.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/illegal-characters.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/string-coercion.js (previously Ignored)
test/built-ins/Uint8Array/fromHex/ignores-receiver.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/receiver-not-uint8array.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/length.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/omit-padding.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/option-coercion.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/alphabet.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/detached-buffer.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/name.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toBase64/results.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/length.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/writes-up-to-error.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/subarray.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/detached-buffer.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/throws-when-string-length-is-odd.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/name.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/results.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/illegal-characters.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/target-size.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromHex/string-coercion.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/length.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/trailing-garbage-empty.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/option-coercion.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/alphabet.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/detached-buffer.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/name.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/results.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/illegal-characters.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/whitespace.js (previously Ignored)
test/built-ins/Uint8Array/prototype/setFromBase64/string-coercion.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/receiver-not-uint8array.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/length.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/detached-buffer.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/name.js (previously Ignored)
test/built-ins/Uint8Array/prototype/toHex/results.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/length.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/descriptor.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/option-coercion.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/nonconstructor.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/alphabet.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/name.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/results.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/illegal-characters.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/whitespace.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/string-coercion.js (previously Ignored)
test/built-ins/Uint8Array/fromBase64/ignores-receiver.js (previously Ignored)
test/staging/Uint8Array/fromBase64/invalid-options.js (previously Ignored)
test/staging/sm/TypedArray/prototype-constructor-identity.js (previously Failed)

@magic-akari
Copy link
Contributor Author

Note

data-encoding gives us first-error boundaries (read/written/position), but stop-before-partial requires the last spec-acceptable full-chunk boundary, which is not always the same.

For setFromBase64, the spec requires early return once maxLength is reached (and trailing garbage after that must be ignored), while data-encoding has no output-cap-aware early-stop decode API.

Also, simple 4-character truncation is insufficient: whitespace affects read, padding legality depends on exact = placement, and strict/loose/stop-before-partial have different tail rules.

At the moment, we do not support stop-before-partial semantics.

If we decide to go with data-encoding (instead of simdutf), one realistic long-term path might involve forking data-encoding and add the API we need.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 3.13253% with 402 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.19%. Comparing base (6ddc2b4) to head (2ff9f60).
⚠️ Report is 650 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/builtins/typed_array/builtin.rs 0.00% 402 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4630      +/-   ##
==========================================
+ Coverage   47.24%   56.19%   +8.95%     
==========================================
  Files         476      548      +72     
  Lines       46892    60504   +13612     
==========================================
+ Hits        22154    34001   +11847     
- Misses      24738    26503    +1765     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@magic-akari magic-akari force-pushed the feat/arraybuffer-base64-data-encoding branch from f2d29eb to 2ff9f60 Compare February 16, 2026 15:15
@magic-akari magic-akari marked this pull request as ready for review February 16, 2026 15:29
@nekevss nekevss requested review from a team and jedel1043 February 17, 2026 22:18
@nekevss nekevss added the enhancement New feature or request label Feb 17, 2026
@jedel1043
Copy link
Member

jedel1043 commented Feb 20, 2026

Thank you, this looks nice. Just to be clear, what would be the full list of missing things from data-encoding's side?

I ask this because I plan to open a discussion with the data-encoding maintainers to know if they're interested in adding those features.

@magic-akari
Copy link
Contributor Author

The main missing feature is LastChunkHandlingOptions. Currently, data-encoding only offers two padding modes: None and Some, both of which enforce strict padding validation.

However, the ECMA-262 spec requires three distinct modes: strict("="), loose("="), and StopBeforePartial.

Our current implementation works around this limitation by checking for the presence of = in the input beforehand to toggle between Some("=") and None. Having native loose("=") support in data-encoding would eliminate this hack.

There's another subtle issue: ECMA-262 disallows concatenated padded inputs, but data-encoding with padding enabled accepts them. A proper loose mode shouldn't just be a binary switch—it needs to reject concatenated padded inputs to match the spec.

As for StopBeforePartial, we should probably pull some test cases from Test262 to ensure our implementation is correct.

@jedel1043
Copy link
Member

Thank! I'll open an issue with them to see if they're open to implementing the features.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants