Skip to content

Fix WASM cfg proxy and remove stale wasm-qmd-parser crate#116

Open
cderv wants to merge 7 commits intomainfrom
fix/wasm-cfg-proxy-and-cleanup
Open

Fix WASM cfg proxy and remove stale wasm-qmd-parser crate#116
cderv wants to merge 7 commits intomainfrom
fix/wasm-cfg-proxy-and-cleanup

Conversation

@cderv
Copy link
Copy Markdown
Collaborator

@cderv cderv commented Apr 14, 2026

The #[cfg(any(target_arch = "wasm32", test))] pattern in filter.rs and shortcode.rs
forced native tests through the WASM-restricted Lua stdlib, breaking Windows test runs.
Native tests now use Lua::new() unconditionally; WASM-specific paths only compile for
wasm32.

Also removes the abandoned wasm-qmd-parser crate (superseded by wasm-quarto-hub-client),
its CI workflow (build-wasm.yml), all wasm-pack references, and replaces
dtolnay/rust-toolchain with direct rustup in CI workflows.

Changes

  • Remove test arm from #[cfg(any(target_arch = "wasm32", test))] guards in filter.rs, shortcode.rs
  • Skip test_dofile_script_dir_stack on native targets (WASM-only test)
  • Delete crates/wasm-qmd-parser/ and .github/workflows/build-wasm.yml
  • Remove wasm-pack from CI and READMEs
  • Replace dtolnay/rust-toolchain with rustup in all workflows
  • Update docs and rules to reflect changes

Split from #109 — this ships the cfg fix and cleanup; #109 will rebase on this
and focus on adding WASM CI test infrastructure.

cderv added 5 commits April 13, 2026 22:22
The wasm-qmd-parser crate was superseded by wasm-quarto-hub-client but
never cleaned up. Remove it along with its dedicated build-wasm.yml
workflow and wasm-pack install steps in hub-client-e2e.yml. Update
READMEs and CLAUDE.md to remove stale references.
The cfg pattern #[cfg(any(target_arch = "wasm32", test))] forced native
tests through the WASM-restricted Lua stdlib (no io/os, synthetic modules
only). This caused 8 Windows test failures because the restricted stdlib
doesn't work without a real wasm32 target.

Change to #[cfg(target_arch = "wasm32")] so native tests use Lua::new()
with the full C stdlib on all platforms. WASM-specific code paths will be
tested by dedicated WASM smoke tests on the real wasm32 target in CI.
The test_dofile_script_dir_stack test validates WASM-specific dofile
behavior (script directory tracking via the VFS dofile override). The
native C dofile does not track the script directory stack, so this test
only passes on wasm32. Mark it ignored on native targets.

See #112 for the behavioral difference discussion.
rust-toolchain.toml already specifies the full toolchain configuration
(nightly channel, components, targets). The dtolnay/rust-toolchain action
was a redundant wrapper — rustup reads rust-toolchain.toml natively.

Replace with `rustup show active-toolchain` which triggers auto-install
from rust-toolchain.toml and displays the resolved toolchain. One fewer
third-party action dependency across all CI workflows.
- Add .claude/rules/wasm.md: prevent cfg test proxy regression
- Update xtask.md: wasm-pack → wasm-bindgen-cli, add version pinning
- Update testing.md: native tests use Lua::new(), remove stale cfg proxy docs
- Rewrite dev-docs/wasm.md: replace stale wasm-qmd-parser content with
  current wasm-quarto-hub-client architecture
cderv added 2 commits April 14, 2026 17:29
Removing wasm-pack (commit 1) left the E2E workflow without
wasm-bindgen-cli, which build-wasm.js requires. Extract the version
from Cargo.lock to stay in sync automatically.

Also fix xtask.md: dev_setup.rs hardcodes the version rather than
reading it from Cargo.lock as the doc previously claimed.
Use head -1 for safety in case of multiple entries. Also fix
ts-test-suite.yml which still hardcoded version 0.2.108.
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