perf(ci): add fast WASM validation for pull requests#2520
Draft
ttw225 wants to merge 1 commit into
Draft
Conversation
Contributor
WalkthroughChangesWASM size-gated validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant wasm-pack
participant npmCheckSize
participant npmPublish
GitHubActions->>wasm-pack: Build PR or optimized non-PR WASM artifact
wasm-pack-->>GitHubActions: Produce dist WASM artifact
GitHubActions->>npmCheckSize: Run npm run check:size
npmCheckSize-->>GitHubActions: Return size validation result
GitHubActions->>npmPublish: Publish only after validation and tests pass
Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3 tasks
ttw225
marked this pull request as ready for review
July 17, 2026 05:47
Use wasm-pack --no-opt for pull request builds while retaining optimized builds and size enforcement on main and publish paths. Add shared size checks, test coverage, workflow metrics, and timeouts.
ttw225
force-pushed
the
perf/wasm-ci-fast-pr-builds
branch
from
July 17, 2026 05:50
f1c9144 to
6c190eb
Compare
ttw225
marked this pull request as draft
July 17, 2026 06:06
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.
Summary
This draft proposes a faster validation path for WASM pull requests while
retaining fully optimized builds and size enforcement on production paths.
It is intentionally opened as a draft because this changes when optimized-size
regressions are detected. I would like maintainer feedback on that trade-off
before treating the implementation as ready to merge.
Part of #2518. This does not close the issue because the main-owned cache work
is tracked separately.
Context
Recent
Build WASM + TypeScript SDKruns took approximately:wasm-optwasm-packtotalThe Binaryen
wasm-optpass therefore contributes approximately 15–18 minutesto every pull request, independently of the Cargo cache state.
Proposed behavior
--no-optmainnpm publishnpm publishThe timeout values are upper bounds for detecting stuck jobs; they are not
expected runtimes. The first cold-equivalent PR run completed in 11:18, including a 10:47
wasm-pack --no-optphase. This meets the ≤12-minute cold target. A true warmrun has not yet been observed, so the 2–3 minute warm estimate remains
unconfirmed.
What changed
wasm-pack build --target web --release --no-optonly for pull requests.main.npm run check:sizeimplementation shared by:mainbuild;measurement.
npm publishwhen an optimized artifact exceeds the limit.wasm-packduration in the Actions job summary.
PR.
The 15 MiB limit is not newly introduced here. The current optimized artifact
is approximately 13.8 MiB gzip; this PR centralizes the existing check and also
applies it directly to both publish paths.
Trade-off and feedback requested
The main trade-off is that an optimized-size regression would be detected on
the first
mainbuild after merge rather than during the pull request.The current
mainruleset does not require status checks, so the optimized PRsize result is advisory today rather than an enforced merge gate. Nevertheless,
pre-merge visibility may still be valuable to maintainers, and I do not want to
assume that shorter PR feedback is necessarily more important than running the
full optimizer on every PR.
I would especially appreciate feedback on:
mainacceptable?even though it is not currently an enforced merge gate?
or would different values/no timeout be preferable?
limit before
npm publish, as proposed here?If pre-merge optimized validation is preferred, I am happy to retain the
current full PR build. Another future option would be enforcing the optimized
gate through a merge queue using
merge_group.CI measurement
Two PR runs have completed successfully:
wasm-packmainRuns:
In both runs, the PR fast path, typecheck, and all 43 tests passed. The optimized
build and production size gate were correctly skipped.
Although
actions/cachereported an exact-key restore, neither run was a usablewarm build. Both restored the same main cache, which was created on July 15,
while
rust-toolchain@stableresolved to Rust 1.97.1 after the July 16 stableupdate. Because the current key does not include compiler identity, Cargo
invalidated the restored fingerprints and performed a near-full rebuild.
The second run naturally reproduces this behavior after rebasing onto
main;the unchanged exact key was restored again and could not be refreshed.
These runs should therefore be treated as cold-equivalent rather than warm:
wasm-pack: 29:04wasm-pack: 10:47–10:51A true warm-path measurement is still pending. I will not force one by deleting
or manipulating caches. The repeated stale exact-hit behavior also provides
concrete evidence for the compiler-aware cache-key work tracked in the
follow-up cache PR.
Validation
Completed locally:
just test: 43/43 passednpm test: 43/43 passednpm run typecheck: passedactionlintfor all three modified workflows: passedgit diff --check: passedgzip -c <file> | wc -c: 14,547,440 bytesAfter opening the draft, I will record the actual warm/cold PR timings and
confirm that the post-merge optimized path retains the existing size result.
Summary by CodeRabbit
npm run check:size, with configurable gzip-size limits and clearer reporting.