Skip to content

test(wasm): the fetchWithAuth test runs through run_web_source_with_dom - #14869

Merged
TheHypnoo merged 2 commits into
PerryTS:mainfrom
raliclo:fix/wasm-fetch-auth-test-helper
Nov 18, 2026
Merged

TheHypnoo merged 2 commits into
PerryTS:mainfrom
raliclo:fix/wasm-fetch-auth-test-helper

Conversation

@raliclo

@raliclo raliclo commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

cargo test -p perry-codegen-wasm --lib does not compile on main (5bad3ad):

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

fetch_with_auth_passes_url_method_body_and_authorization came in with #14718 (mine). On that PR's branch it called run_web_source_around, a helper the branch also defined. The helper did not survive the squash merge alongside the other wasm test-helper changes, so main has the call without the definition.

Main already has run_web_source_with_dom(source, dom, after_boot), whose dom prelude runs before the runtime boots. That is exactly where the test's globalThis.fetch stub needs to go. This PR moves the stub there, appended after STUB_DOM. The test's source and expected output are unchanged. Tests only; no product change.

Test plan

# main 5bad3ad5f9, isolated target dir
cargo test -q -p perry-codegen-wasm --lib
#   error[E0425]: cannot find function `run_web_source_around`

# this branch, isolated target dir
cargo test -q -p perry-codegen-wasm --lib
#   test result: ok. 119 passed; 0 failed
cargo test -q -p perry-codegen-wasm --lib fetch_with_auth
#   test result: ok. 2 passed

cargo fmt --all -- --check          # no diff in emit/tests.rs (the 9 files it reports are unformatted on main too)
./scripts/check_file_size.sh        # output byte-identical to main's

Paths touched

crates/perry-codegen-wasm/src/emit/tests.rs (test code only), plus the changelog fragment.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CUQanVsnitcrmYLAWWPc3p

Summary by CodeRabbit

  • Tests
    • Updated the authentication-fetch test setup to run with a simulated browser environment. The test continues to verify that the request URL, method, body, and authorization header are passed correctly.
    • Confirmed the WebAssembly code-generation unit tests compile on the main branch.
  • Product Impact
    • No user-facing behavior changes.

ralic and others added 2 commits November 17, 2026 09:48
fetch_with_auth_passes_url_method_body_and_authorization (PerryTS#14718) calls
run_web_source_around, a helper that existed only on that PR's branch;
main has run_web_source_with_dom, whose DOM prelude runs before the runtime,
so the fetch stub goes there after STUB_DOM. Without this the
perry-codegen-wasm lib tests do not compile on main.

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 fetch authorization test now runs through run_web_source_with_dom, with STUB_DOM and the fetch stub passed to the helper. A changelog entry records that this is a test change with no product change.

Changes: WASM test helper update

Layer / File(s) Summary
Fetch test harness update
crates/perry-codegen-wasm/src/emit/tests.rs, changelog.d/14869-wasm-fetch-auth-test-helper.md
The fetch authorization test uses run_web_source_with_dom with STUB_DOM and the fetch stub. The changelog records that the change affects tests only.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

  • PerryTS/perry#14718: Adds the run_web_source_around harness hook and the fetch authorization test that this change updates to use run_web_source_with_dom.

Suggested reviewers: thehypnoo

Merge Risk: Minimal · up to 3a2af

This change only updates a unit test helper call and adds a changelog note. It does not change product behavior, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: the fetchWithAuth test in perry-codegen-wasm now runs through run_web_source_with_dom. The changeset moves the globalThis.fetch stub into the DOM prelude passed to that hel…
Description check Passed The description follows the template's main sections: Summary, Changes (as Paths touched), Related issue (references #14718 as origin), and Test plan with commands and results. It explains the compile…
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 names the change: the fetchWithAuth test in perry-codegen-wasm now runs through run_web_source_with_dom. The changeset moves the globalThis.fetch stub into the DOM prelude passed to that helper, so the title matches the main change. It uses the conventional test(wasm): prefix and is 71 characters.

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Changes (as Paths touched), Related issue (references #14718 as origin), and Test plan with commands and results. It explains the compile failure on main, the fix, and why the stub moves to the DOM prelude. Template items not filled in include the Related issue formatting (no explicit Fixes/Refs keyword), the Changes bullet list, and the checklist, which the author did not tick. The Cargo version and CHANGELOG.md rules are not addressed, though the PR adds a changelog fragment under changelog.d/, which is the expected route. 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: 73445d11-6f50-4ff8-a59d-3de02036255d
Commits

Reviewing files that changed from the base of the PR and between 5bad3ad and 3a2af4c.

Files selected for processing: 2

  • changelog.d/14869-wasm-fetch-auth-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; 6 remain after this review.

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.

3 participants