Skip to content

Fix WASM cfg proxy: remove test arm from wasm32 guards#116

Merged
cderv merged 3 commits into
mainfrom
fix/wasm-cfg-proxy-and-cleanup
Apr 16, 2026
Merged

Fix WASM cfg proxy: remove test arm from wasm32 guards#116
cderv merged 3 commits into
mainfrom
fix/wasm-cfg-proxy-and-cleanup

Conversation

@cderv

@cderv cderv commented Apr 14, 2026

Copy link
Copy Markdown
Member

The #[cfg(any(target_arch = "wasm32", test))] pattern in filter.rs and
shortcode.rs forced native tests through the WASM-restricted Lua stdlib.
This caused Windows test failures because the restricted stdlib (no io/os/debug)
doesn't work with Lua's C implementation on native targets.

Fix

Remove the test arm from the cfg guards so native tests use Lua::new() with
the full stdlib. WASM coverage is provided by dedicated WASM tests in CI.

Also marks the dofile_wasm::test_dofile_script_dir_stack test as
#[cfg_attr(not(target_arch = "wasm32"), ignore)] since it depends on
register_wasm_dofile which is only available in the WASM build.

Changed files

  • crates/pampa/src/lua/filter.rs — cfg guard fix
  • crates/pampa/src/lua/shortcode.rs — cfg guard fix
  • crates/pampa/src/lua/dofile_wasm.rs — ignore test on native
  • .claude/rules/wasm.md — document the prohibited cfg pattern
  • claude-notes/instructions/testing.md — update testing docs
  • dev-docs/wasm.md — update WASM architecture docs

@vezwork

vezwork commented Apr 15, 2026

Copy link
Copy Markdown
Member

@cscheid I'm gonna want something like wasm-qmd-parser again in the future for the Quarto extension, but putting that off for now.

@cderv

cderv commented Apr 15, 2026

Copy link
Copy Markdown
Member Author

Let's leave it then - I was just trying to cleanup while understanding things around and fixing the problem I found.

@cderv cderv changed the title Fix WASM cfg proxy and remove stale wasm-qmd-parser crate Fix WASM cfg proxy and clean up stale references Apr 16, 2026
@cderv

cderv commented Apr 16, 2026

Copy link
Copy Markdown
Member Author

Done — I've kept the crate skeleton (Cargo.toml, src/, tests/, licenses) and cleaned up the stale parts (old CI configs, C shim superseded by wasm-c-shim, wasm-sysroot headers, wasm-pack demo artifacts). The README now documents it as dormant.

Edit: I’ll probably split work on this. No need to cleanup if you plan to rework on it. But this is definitely stale.

@cderv cderv marked this pull request as draft April 16, 2026 11:31
cderv added 3 commits April 16, 2026 13:56
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.
- 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 cderv force-pushed the fix/wasm-cfg-proxy-and-cleanup branch from 6009f60 to 2db6f1e Compare April 16, 2026 12:58
@cderv cderv changed the title Fix WASM cfg proxy and clean up stale references Fix WASM cfg proxy: remove test arm from wasm32 guards Apr 16, 2026
@cderv

cderv commented Apr 16, 2026

Copy link
Copy Markdown
Member Author

Split this PR — the wasm-qmd-parser cleanup and workflow modernization are now in #125. This PR is just the cfg guard fix (removing the test arm from #[cfg(any(target_arch = "wasm32", test))]).

@gordonwoodhull

Copy link
Copy Markdown
Member

Thanks @cderv!

I've gone back and verified that adding test was a misunderstanding. The intent was to test io and os using the wasm runtime, not to make native tests use the wasm runtime!

@cderv cderv marked this pull request as ready for review April 16, 2026 15:36
@cderv cderv merged commit 5296880 into main Apr 16, 2026
4 checks passed
@cderv cderv deleted the fix/wasm-cfg-proxy-and-cleanup branch April 16, 2026 15:45
cderv added a commit that referenced this pull request Apr 24, 2026
# Conflicts:
#	.beads/issues.jsonl
AdaWorldAPI pushed a commit to AdaWorldAPI/q2 that referenced this pull request Jun 23, 2026
…artonomy

Replace the synthetic Morton-in-identity scheme (which crammed a whole
multi-level tile path into one u16 and nibble-walked it back — bad
addressing) with the deterministic tier model: each HHTL tier is one 8:8
[container:identity] pair = [mixin-node : instance-on-it], 256×256 = 64k
per tier. The high byte names the KIND mixin node (Organ/Chamber/Wall/
Tissue/Cell — the family things attach on), the low byte the instance.

  HEEL [Organ:Heart]  HIP [Chamber:id]  TWIG [Wall:id]  LEAF [Tissue:id]
  family [Cell:id]

The non-zero tiers ARE the partonomy path, so the address says where a
node sits — no Morton decode, no edge lookup. This is the q2 Cascade
reading of OGAR PR quarto-dev#116's [container:member] tier model (OGAR's skeleton
is the Located/spatial sibling). Mirrors OGAR's [bodypart:bone] LeafTile
and supersedes the 12+4 EdgeBlock with family-node grouping (the
container byte = the mixin/family node). classid stays 0x0A01 =
anatomical_structure in OGAR's ConceptDomain::Anatomy.

decodeSoa now exposes the five tiers (heel/hip/twig/leaf/family);
FmaGraph lays out straight from them (tierPos: y = depth, x = nested
slot under the parent's instance) instead of the Morton treemap — so the
HHTL block is finally load-bearing, not write-only ornamentation.

Verified: the cockpit's read offsets match the Rust-written GUID byte
for byte across organ→chamber→wall→tissue→cell; ceiling sentinel intact;
cockpit tsc clean. Browser render not exercised (no browser here).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF
gordonwoodhull pushed a commit that referenced this pull request Jul 2, 2026
Design spec (claude-notes/designs/2026-04-03-wasm-testing-and-cleanup.md)
and plan (claude-notes/plans/2026-04-07-wasm-testing-and-cleanup.md) for
replacing the lost cfg-proxy coverage (removed in #116) with real wasm32
smoke tests. Incorporates design-review findings: wasm-bindgen-cli
version pinning via cargo xtask dev-setup, the C toolchain prerequisite,
and Linux-CI-only scope (skipped on Windows).
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