Skip to content

Remove script-dir push/pop from WASM dofile override#127

Merged
gordonwoodhull merged 1 commit intomainfrom
bugfix/112
Apr 16, 2026
Merged

Remove script-dir push/pop from WASM dofile override#127
gordonwoodhull merged 1 commit intomainfrom
bugfix/112

Conversation

@gordonwoodhull
Copy link
Copy Markdown
Collaborator

Summary

  • Remove script-dir stack push/pop from the WASM dofile override in dofile_wasm.rs, making it a pure file I/O shim
  • Remove the test_dofile_script_dir_stack test that validated the removed behavior
  • Update plan (2026-04-01-lua-api-quarto-doc.md) and design doc (lua-wasm.md) to reflect the change

Context

The WASM dofile override was pushing/popping the script-dir stack around each call, causing resolve_path inside dofile'd scripts to resolve relative to the loaded file's directory. Native Lua's C dofile doesn't do this, nor do Pandoc or TS Quarto. No built-in extension relies on this behavior — the video extension's dofile call passes an already-resolved absolute path.

This eliminates the behavioral divergence by aligning WASM with native: option (2) from the issue discussion.

Closes #112

Test plan

  • cargo nextest run -p pampa — 3700 passed, 2 skipped
  • cargo nextest run --workspace — 7263 passed, 195 skipped
  • cargo build --workspace — clean

The WASM dofile override was pushing/popping the script-dir stack
around each call, causing resolve_path inside dofile'd scripts to
resolve relative to the loaded file's directory. Native Lua's C dofile
doesn't do this, nor do Pandoc or TS Quarto. No built-in extension
relies on this behavior.

Remove the push/pop to align WASM with native, eliminating the
behavioral divergence reported in #112. Remove the now-unnecessary
test_dofile_script_dir_stack test. Update plan and design docs.

Closes #112
@gordonwoodhull gordonwoodhull merged commit 1e2cb0a into main Apr 16, 2026
4 checks passed
@gordonwoodhull gordonwoodhull deleted the bugfix/112 branch April 16, 2026 18:22
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.

Behavioral difference: dofile() script-dir tracking on WASM vs native

1 participant