Skip to content

test(bin-e2e): dlopen the shipped js plugin cdylib for real - #370

Draft
raphaelvigee wants to merge 1 commit into
raphaelvigee/feat-plugin-js-m7-benchfrom
raphaelvigee/feat-plugin-js-m8-bin-e2e
Draft

test(bin-e2e): dlopen the shipped js plugin cdylib for real#370
raphaelvigee wants to merge 1 commit into
raphaelvigee/feat-plugin-js-m7-benchfrom
raphaelvigee/feat-plugin-js-m8-bin-e2e

Conversation

@raphaelvigee

@raphaelvigee raphaelvigee commented Aug 5, 2026

Copy link
Copy Markdown
Member

Part 8/8 of the stack — closes a gap flagged repeatedly since M0: plugin-js-cdylib was lint/fmt covered (devenv.nix's qualityCrates) but never actually loaded across the real ABI seam by any test.

What's here

  • devenv.nix's e2e script now stages plugin-js-cdylib as a fourth artifact, symmetric with go/gha in both the local-build and HEPH_E2E_FROM/CI branches (fingerprinting, copying, macOS-portable-patching all updated together).
  • Four new real bin-e2e tests in crates/bin-e2e/tests/plugin_dylib_js.rs:
    • shipped_js_cdylib_loads_and_answers_across_the_abi — construction + the sync inspect functions ABI call round-trips cleanly.
    • shipped_js_cdylib_discovers_a_real_workspace_packagequery -e //... against a real pnpm-shaped fixture resolves //packages/foo:package_info.
    • shipped_js_cdylib_resolves_pnpm_workspace_glob_membership — proves a package outside the packages/* glob is never admitted as a workspace member, across the real seam.
    • js_plugin_construction_failure_logs_before_the_abort — the same log-sink-before-abort regression coverage the go test already has.

Two things review caught worth naming

The first draft of shipped_js_cdylib_loads_and_answers_across_the_abi asserted inspect functions produced completely empty stdout — wrong, and it failed deterministically: the fs builtin provider's own functions are always registered regardless of plugin config, so stdout is never actually empty. Fixed to assert no line starts with js. instead (the js Provider never overrides functions(), unlike go's build_addr).

The discovery test's own doc comments originally claimed to exercise pnpm's workspace-glob membership resolution — they didn't. Traced it: Provider::list/list_packages discover packages by package.json presence alone, independent of pnpm-workspace.yaml content entirely; the glob-resolution path (workspace.rs's resolve_members) is only reached from Provider::get, which a plain query -e //... never calls. Rather than leave an overclaiming comment standing, added the dedicated shipped_js_cdylib_resolves_pnpm_workspace_glob_membership test that actually reaches that path, and corrected the original test's docs.

Verified for real, not just compiled

Ran the full e2e devenv script end to end — release build of heph + all three plugin cdylibs, staged, macOS-portable-patched, full bin-e2e suite against real dlopen'd artifacts:

tests/cli.rs:            4 passed
tests/plugin_dylib.rs:    4 passed
tests/plugin_dylib_js.rs: 4 passed  (all new)
tests/shell_pty.rs:       3 passed
tests/tui_pty.rs:         2 passed
17/17 total

Test plan

  • cargo build -p bin-e2e --tests
  • cargo clippy -p bin-e2e --all-targets -- -D warnings (clean)
  • cargo fmt --check -p bin-e2e
  • nix-instantiate --parse devenv.nix
  • Full e2e run against real staged release artifacts — 17/17 passed
  • CI (tst, lint, bin_e2e) on this PR

Stack created with GitHub Stacks CLIGive Feedback 💬

Closes a gap flagged repeatedly since M0: plugin-js-cdylib was lint/fmt
covered (devenv.nix's qualityCrates) but never actually loaded across
the real ABI seam by any test. Wires it into the e2e devenv script as a
fourth staged artifact (symmetric with go/gha in both the local-build and
HEPH_E2E_FROM/CI branches), and adds four real bin-e2e tests proving it:

- shipped_js_cdylib_loads_and_answers_across_the_abi: construction +
  the sync inspect functions ABI call round-trips cleanly. The js
  Provider never overrides functions() (falls through to the trait's
  empty-vec default, unlike go's build_addr), so this asserts no line
  in `inspect functions` output starts with "js." rather than asserting
  empty stdout outright -- the fs provider's own functions are always
  registered regardless of plugin config, so an empty-stdout assertion
  is simply wrong (caught by review, the first draft failed
  deterministically).
- shipped_js_cdylib_discovers_a_real_workspace_package: query -e //...
  against a real pnpm-shaped fixture resolves //packages/foo:package_info
  -- proves Provider::list/list_packages cross the seam intact.
- shipped_js_cdylib_resolves_pnpm_workspace_glob_membership: two real
  package.json files, one inside the packages/* glob and one deliberately
  outside it declared as a dependency; resolving the in-glob package's
  config must fail on the unresolved dependency, proving the excluded
  package was never admitted as a workspace member. Added because the
  discovery test above (despite its own doc comments originally claiming
  otherwise) never actually exercises workspace.rs's glob-membership
  resolution -- Provider::list discovers by package.json presence alone,
  independent of pnpm-workspace.yaml. Caught by review; the stale
  overclaiming comments were corrected rather than left standing.
- js_plugin_construction_failure_logs_before_the_abort: the same
  log-sink-before-abort regression coverage the go test already has,
  ported for js's identical construction-failure shape.

Verified for real: ran the full `e2e` devenv script (release build of
heph + all three plugin cdylibs, staged, macOS-portable-patched) end to
end -- 17/17 tests passed across the whole bin-e2e suite, all four new
plugin_dylib_js.rs tests included, against real dlopen'd release
artifacts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M3wZfyPsG8stfRQuybLRjN
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