Skip to content

fix(e2e): build argon2 WASM without SIMD; bump Playwright to 1.59.1#1

Open
cooper667 wants to merge 2 commits into
mainfrom
fix/no-simd-wasm-playwright-1.59
Open

fix(e2e): build argon2 WASM without SIMD; bump Playwright to 1.59.1#1
cooper667 wants to merge 2 commits into
mainfrom
fix/no-simd-wasm-playwright-1.59

Conversation

@cooper667
Copy link
Copy Markdown
Owner

Tests whether CI passes with a non-SIMD WASM build under Playwright 1.59.1.

Context

Renovate PR phi-ag#704 bumping @playwright/test to 1.59.1 broke the webkit e2e test with non-deterministic argon2 output (same password + salt → different hash each run). The renovate PR CI failure:
https://github.com/phi-ag/argon2/actions/runs/24701187889/job/72244551769?pr=704

Investigation

Reproduced locally on linux/amd64 with Rosetta disabled:

  • webkit-2272 (Playwright 1.59) + this repos SIMD WASM (-msimd128 -mavx2, src/opt.c) → garbage, non-deterministic
  • webkit-2272 + libsodium-sumo argon2id → deterministic, correct
  • webkit-2272 + this repo rebuilt from src/ref.c (scalar) → deterministic, correct
  • webkit-2230 (Playwright 1.58) + SIMD WASM → works

Conclusion: the webkit-2272 JIT on amd64 mis-codegens the v128 instructions emitted when compiling opt.cs SSE2/AVX2 intrinsics. Libsodiums WASM sidesteps it (no SIMD ops in this build). The bug is in the browser, but the workaround here is to stop emitting the trigger instructions.

Changes

  • build.sh: drop -msimd128 -mavx2 -D__AVX2__; compile src/ref.c instead of src/opt.c.
  • @playwright/test: 1.58.2 → 1.59.1.
  • Playwright docker image + run-playwright action pinned to match.

Trade-off

Loses the SIMD perf optimization. Future options:

  1. Restore SIMD once upstream webkit fixes the JIT.
  2. Ship dual WASM (SIMD + scalar) with runtime feature detection.

Not included

Upstream bug reports (Playwright / WebKit) — worth filing separately with the reproducer described above.

Playwright 1.59.x ships webkit-2272 whose JIT mis-handles SIMD WASM on
linux/amd64: given identical inputs, our argon2 WASM returns garbage,
non-deterministic output. Reproduced locally under linux/amd64 and
confirmed via: a) CI failure in previous renovate PR; b) libsodium
(no SIMD ops) passes on the same browser binary; c) rebuilding this
package from src/ref.c (scalar) instead of src/opt.c (SSE2/AVX2
intrinsics compiled to v128) makes the test pass.

Trade-off: drops the SIMD perf optimization. A future change can
restore SIMD (either after upstream webkit fix, or by shipping dual
WASM with runtime feature detection).

Changes:
- build.sh: drop -msimd128 -mavx2 -D__AVX2__; use src/ref.c
- @playwright/test: 1.58.2 -> 1.59.1
- playwright docker image + run-playwright action: bumped to match
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