Skip to content

test(wasm): restore run_web_source_around, which the fetchWithAuth test calls - #14870

Closed
raliclo wants to merge 2 commits into
PerryTS:mainfrom
raliclo:fix/main-red-wasm-test-helper
Closed

raliclo wants to merge 2 commits into
PerryTS:mainfrom
raliclo:fix/main-red-wasm-test-helper

Conversation

@raliclo

@raliclo raliclo commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

perry-codegen-wasm's unit tests do not compile on main 028b066 (error[E0425]: cannot find function run_web_source_around at src/emit/tests.rs:1286), which also fails the warnings job's all-targets check and the crate's cargo test. #14718 added the fetchWithAuth test together with that helper; the squash merge (abe5c40) kept the test but not the helper. This restores it on top of main's current harness.

Changes

  • crates/perry-codegen-wasm/src/emit/tests.rs: run_web_source_around(before_boot, source, after_boot) = run_web_source_with_dom(source, STUB_DOM + before_boot, after_boot); the dom script already runs before the runtime loads, which is where the test's globalThis.fetch stub must be.

Related issue

Refs #14718, #14711, #14595.

Test plan

  • main 028b066: RUSTFLAGS="-D warnings" cargo check --workspace --all-targets … → error[E0425]: cannot find function run_web_source_around

  • this branch: cargo test -p perry-codegen-wasm --lib fetch_with_auth → fetch_with_auth_passes_url_method_body_and_authorization ... ok, async_body_fetch_with_auth_sends_the_auth_header ... ok

  • BASE_SHA=upstream/main bash scripts/run_lint_gates.sh on this branch (macOS): the same 18 FAIL lines as on the sibling branches; none is new. The all-targets warnings gate stays red here for reasons outside this PR (Linux-only snap_image items are dead code on macOS; perry-wpfacts test helpers, fixed separately).

  • I have NOT bumped the workspace version or edited CHANGELOG.md

  • changelog.d fragment added

🤖 Generated with Claude Code

https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p

Summary by CodeRabbit

  • Tests
    • Restored support for WebAssembly code-generation unit tests that depend on browser-like globals during startup. The affected tests can compile and run with the required setup in place.
  • User impact
    • No changes to end-user functionality.

ralic and others added 2 commits November 17, 2026 10:57
…st calls

`perry-codegen-wasm`'s unit tests do not compile on main 028b066:

    error[E0425]: cannot find function `run_web_source_around` in this scope
       --> crates/perry-codegen-wasm/src/emit/tests.rs:1286:9

PerryTS#14718 (abe5c40) added `fetch_with_auth_passes_url_method_body_and_authorization`,
which stubs `globalThis.fetch` before the runtime boots through
`run_web_source_around(before_boot, source, after_boot)`. The branch
defined that helper beside `run_web_source_then`, but the squash merge
kept only the test. Main's harness has since grown
`run_web_source_with_dom(source, dom, after_boot)`, whose `dom` script
already runs before the runtime loads, so the helper is that call with the
stub DOM followed by `before_boot`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change restores run_web_source_around in the WASM test helpers. It runs supplied JavaScript before runtime loading and passes a separate script to the existing runner. A changelog entry documents the change.

Changes: WASM Test Helper

Layer / File(s) Summary
Add and document the test helper
crates/perry-codegen-wasm/src/emit/tests.rs, changelog.d/14870-main-red-wasm-test-helper.md
run_web_source_around prepends JavaScript to the stub DOM before runtime loading and passes the post-boot script to the existing runner. The changelog records the helper’s restoration and test compilation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • PerryTS/perry#14869: Changes the same test to move the globalThis.fetch stub into a prelude, avoiding the missing helper that this PR restores.

Suggested reviewers: thehypnoo

Merge Risk: Minimal · up to 103fe

This restores a missing test helper so the crate's unit tests compile again. It has no production impact and is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the main change: it restores the run_web_source_around test helper that the fetchWithAuth test calls, in the perry-codegen-wasm crate. It is specific and matches the changeset. The…
Description check Passed The description follows the template's main sections: Summary, Changes, Related issue, and Test plan. It explains why the helper is needed, lists the changed file and function, gives an issue referenc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title describes the main change: it restores the run_web_source_around test helper that the fetchWithAuth test calls, in the perry-codegen-wasm crate. It is specific and matches the changeset. The conventional 'test(wasm):' prefix fits the repository's commit convention.

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Changes, Related issue, and Test plan. It explains why the helper is needed, lists the changed file and function, gives an issue reference, and reports concrete test commands and results. The checklist confirms no version bump or CHANGELOG edit and notes a changelog.d fragment. The template's HTML comment guidance is not repeated, and the Screenshots section is absent. That section is optional. The description does not state which commands were run for the 'cargo build --release' and workspace test items, so those template checklist items are unaddressed. These gaps are minor.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b373fbc8-5695-4114-a161-e4a6ec5aa8df
Commits

Reviewing files that changed from the base of the PR and between 5bad3ad and 103fe99.

Files selected for processing: 2

  • changelog.d/14870-main-red-wasm-test-helper.md
  • crates/perry-codegen-wasm/src/emit/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@raliclo

raliclo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #14869, which fixes the same compile error (the fetchWithAuth test's missing run_web_source_around) by switching that test to the existing run_web_source_with_dom instead of re-adding the helper. Both were opened by me about 20 minutes apart; sorry for the noise.

@raliclo raliclo closed this Nov 17, 2026
@raliclo
raliclo deleted the fix/main-red-wasm-test-helper branch November 17, 2026 23:20
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.

2 participants