feat(javascript)!: bump rquickjs to 0.12 and bundle big.js as BigDecimal - #163
Draft
yuhao-su wants to merge 1 commit into
Draft
feat(javascript)!: bump rquickjs to 0.12 and bundle big.js as BigDecimal#163yuhao-su wants to merge 1 commit into
BigDecimal#163yuhao-su wants to merge 1 commit into
Conversation
…imal` rquickjs 0.6 no longer compiles since Rust 1.100 changed the never type fallback, and every later release drops the QuickJS bignum extensions (0.7 strips them, 0.9 switches the engine to quickjs-ng), so the `BigDecimal` the JavaScript runtime maps decimals to no longer exists. The runtime now evaluates big.js v7.0.1 (MIT) into every context and exposes it as the global `BigDecimal`. Construction, `toString` and `toFixed`/`toPrecision` keep working; arithmetic moves to methods, and `valueOf` throws so `a + b` fails loudly instead of concatenating strings. Decimal output goes through `toFixed(scale)`: results are rounded half-up to the column scale instead of truncated, values exceeding the column precision are rejected instead of stored out of range, and values in (-1, 0) keep their sign, which the old parser dropped. API changes for 0.12: `AsyncContext::full` replaces the removed `Base` intrinsic, `#[rquickjs::class]` types derive `JsLifetime`, and the deprecated `async_with!` macro becomes `async_with(async |ctx| ..)`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
yuhao-su
force-pushed
the
yuhao/bump-rquickjs-0.12
branch
from
September 3, 2026 01:07
2545b0a to
261766c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #162.
Why
rquickjs-core0.6.2 no longer compiles on nightly (never type stabilized in rust-lang/rust#155499, stable in 1.100), and no later rquickjs has the QuickJSBigDecimalthe JavaScript runtime maps decimals to: 0.7 strips the bignum extensions, 0.9 switches the engine to quickjs-ng. So the bump has to redefine the decimal contract.What changed
rquickjs0.6 → 0.12 (quickjs-ng). API:AsyncContext::fullreplaces the removedBaseintrinsic;ResponsederivesJsLifetime; the deprecatedasync_with!becomesasync_with(async |ctx| …)— most of themod.rsdiff is the reindentation that causes.src/javascript/bigdecimal/, MIT), exposed as the globalBigDecimal.BigDecimal("1.5"),toString(),toFixed/toPrecisionkeep working; arithmetic isadd/sub/mul/div/cmp/…;valueOfthrows soa + b/a < bfail loudly instead of concatenating strings or comparing references.typeofis"object";toString()never uses exponent notation.toFixed(scale):Decimal128/256results are rounded half-up to the column scale (previously truncated), rejected if they exceed the column precision (previously stored out of range:1234.56intoDecimal128(5, 2)read back as123.45), and values in(-1, 0)keep their sign (the old parser turned-0.05into0.05).Verification
cargo test --features javascript: 41/41, fetch 9/9 (stable 1.91);cargo +nightly checkon 1.100 clean; clippy-D warnings, fmt, andcargo +nightly doc --cfg docsrsclean (one pre-existing private-link warning). No existing test expectation had to change for quickjs-ng.Downstream: RisingWave's
e2e_test/udf/tests/language_specific/javascript.sltassertstypeof decimal === "bigdecimal"and will need"object"when it picks this up.🤖 Generated with Claude Code