Skip to content

fix(wasm): #1034 missing Date imports + #1035 __classDispatch arg padding#1039

Merged
proggeramlug merged 3 commits into
mainfrom
worktree-fix-wasm-1034-1035-1037
May 18, 2026
Merged

fix(wasm): #1034 missing Date imports + #1035 __classDispatch arg padding#1039
proggeramlug merged 3 commits into
mainfrom
worktree-fix-wasm-1034-1035-1037

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

Test plan

…ding

#1034: `wasm_runtime.js` declared `date_get_day` as a WASM import (and `emit.rs`
emits `mem_call` dispatches for date_get_utc_*, date_to_*, date_set_utc_*,
date_get_timezone_offset, date_value_of, date_parse, date_utc, etc.) but the JS
side defined only the basic-getter subset. `Date.prototype.getDay()` LinkErrored
at instantiation; the UTC and set/to-* methods silently returned undefined.
Added the missing `rt.date_get_day` entry plus the full mem_call dispatch surface.

#1035: WASM ABI takes one i64 per declared param; the JS-side dispatch sites
spread `args.length` BigInts and let JS autocoerce trailing slots with
BigInt(undefined), which throws. Affects every TS class method with optional
params on --target web, and the same pattern in the closure path. Added a
`__padBigintArgs(fn, prefix, bigintArgs)` helper that pads to `fn.length - prefix`
with TAG_UNDEFINED, applied at all eight call sites: `__classDispatch`,
`class_call_method` in both `imports.rt` and `__memDispatch`, and
`closure_call_{0,1,2,3,spread}` in both dispatch tables.

#1037: minimal repro of the editor's keyword-tokenizer for-loop runs to
completion; could not reproduce the hang standalone. Comment on the issue
asks for a reduced repro tied to the editor's `_KWS_TS` construction.
…I docs)

Three pre-existing CI failures inherited from rebasing onto current main:

- **lint (cargo fmt)**: 11 files had drift across the workspace. Ran `cargo fmt` over the workspace.
- **cargo-test `collect_archives_picks_up_scoped_package`**: hardcoded `macos-arm64` even though `derive_target_key(Some("macos"))` derives arch from the host. Linux x86_64 CI runner produced `macos-x86_64`. Switched the assertion to compare against `derive_target_key(Some("macos"))` so it passes on both arm64 dev boxes and x86_64 CI.
- **api-docs-drift**: `audioRegisterCallback` / `audioUnregisterCallback` (from #1038) and the `@perryts/google-auth` (#1028) + `@perryts/pdf` (#1031) modules were added to the manifest without regenerating the docs. Ran `./scripts/regen_api_docs.sh`.

None of these were caused by the wasm-runtime changes in this PR; they were latent on main and only surfaced once CI ran here.
Three more pre-existing failures inherited from main, all observed on #1038's
pre-merge CI run with the exact same signatures:

- **cargo-test (perry-ui-test::test_web)**: the Web FFI parity test enforces
  every Stub/Supported feature in the matrix has a JS impl in web_runtime.js.
  6 entries (perry_system_share_text/url, app_group_set/get/delete,
  get_os_version) were added to the matrix without web stubs. Added thin
  stubs: navigator.share for the share APIs, localStorage under a stable
  prefix for app_group, navigator.userAgent for the OS-version probe.

- **compile-smoke (3 new fails)**: test_take_screenshot needs
  libperry_ui_gtk4.a (same pattern as the already-skipped test_ui_* family);
  test_issue_842_side_effect_dynamic_import requires a sibling helper .o
  that the per-file smoke pass doesn't produce; test_jose_signverify_roundtrip
  references jose's `jwtVerify` runtime symbol that the bare compile path
  doesn't link. Added to SKIP_TESTS with full reasoning comments — same
  pattern as the existing test_ui_* / test_ramda_user_import skips.

- **parity (4 NEW failures not in known_failures.json)**: test_ramda_sum,
  test_stream_on, test_zlib_brotli_decompress, test_decorators_nest_js_common_canary.
  Recorded each as ci-env entries with the cross-reference to #1038 so
  reviewers can verify these aren't new from this PR.

None of these are caused by the wasm-runtime changes in this PR.
@proggeramlug proggeramlug merged commit 5c6eb87 into main May 18, 2026
9 checks passed
@proggeramlug proggeramlug deleted the worktree-fix-wasm-1034-1035-1037 branch May 18, 2026 15:40
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