fix(swiflowui): stop wasm32 Int traps in formatControlNumber and DataTable scroll math#257
Merged
Conversation
📦 Bundle size
✅ Within budget (≤5% growth allowed). Baseline: Swift 6.3, WASM SDK 6.3-RELEASE, measured 2026-06-18. |
…Table scroll math formatControlNumber gated its String(Int(v)) fast path at 1e15 — a 64-bit round-trip bound. On wasm32 Int is 32-bit, so any whole-number min/max/step in (2^31, 1e15) — an epoch-ms bound, a 10-billion max — trapped in the browser while every host test stayed green. The cutoff is now 2^31, identical on every platform so host tests pin wasm behavior (the cssPixelInt rule). DataTable's onScroll did raw Int() on scrollTop/clientHeight three functions away from the cssPixelInt helper the file wrote for exactly these quantities; the virtual-runway padding multiplied row counts in Int the same way. Both now route through cssPixelInt. Whole-package swift test: 1904 green (adds FormatControlNumberTests pinning the Int32 boundary strings). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zzal
force-pushed
the
fix/wasm32-int-traps
branch
from
July 19, 2026 22:45
66e5a98 to
8b4da68
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.
Audit backlog B2 (Part-3 High + Medium): the wasm32-Int-is-32-bit trap class, invisible to host tests.
formatControlNumber(FieldChrome.swift): the whole-number fast path was gated at1e15— a 64-bit round-trip bound. Any wholemin/max/stepin (2^31, 1e15) passed on a NumberField or Slider (an epoch-ms bound, a 10-billion max) trapped atInt(v)in the release browser while all host tests stayed green. Cutoff is now 2^31 on every platform, so host assertions pin the exact strings wasm emits — same doctrine ascssPixelInt.DataTable.onScroll: rawInt(top)/Int(height)/Int(viewportHeight)on JS-derived doubles, in the same file that createdcssPixelIntfor these exact quantities (NaN scrollTop trapped on every platform; ≥2^31 px trapped wasm32). Now routed throughcssPixelInt, as is the virtual-runway padding arithmetic (first * rowHeightinInt).FormatControlNumberTestspin the Int32 boundary strings (2147483647 stays integer-rendered; 2^31 and 1e10 fall back to theDoublerendering instead of trapping).Whole-package
swift test: 1904 tests, 352 suites, green.Stacked on #256 (shares the CHANGELOG Fixed section); rebases to a single commit once #256 merges.
🤖 Generated with Claude Code