Repository navigation
fix(lsp): skip WASM and Python plugins in every build, as E8006 says - #2496
Conversation
The LSP tells the user (E8006) that it skips WASM and Python plugins.
That held only when it was built alone. Built with the CLI (a plain
workspace cargo build, or the flake's package), Cargo feature
unification turns on rustledger-loader's wasm-plugins and
python-plugins, and the LSP's LoadOptions::default() then resolved and
ran those plugins on every reload. Built alone, the same plugins
produced a "requires the wasm-plugins feature" / E8005 error next to
the E8006 note.
LoadOptions gains `native_plugins_only`. When set, run_plugins skips
every invocation that would not resolve to a native plugin (the same
registry lookup resolve_plugin tries first, plus python: forcing),
before resolution, so the outcome cannot depend on what was compiled
in. The LSP uses it for both its plugin passes and its journal load
(`lsp_load_options`). E8006 now also flags a `python:`-prefixed plugin,
which is skipped too.
Verified that features unify (`cargo tree -p rustledger-lsp -p
rustledger -i rustledger-loader -e features` lists wasm-plugins and
python-plugins; the LSP alone does not). New tests in the loader and
the LSP pass with and without the runtimes compiled in, and fail
without the fix in both builds: a load error for bad.wasm ("failed to
load" with the runtime, "requires the wasm-plugins feature" without)
and an E8004 for python:auto_accounts.
Closes #2486
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Review follow-up for #2486. The first version of native_plugins_only skipped every non-native name, so a misspelled native plugin (`autoaccounts`) lost its E8001 in the LSP and E8006 called it a skipped "Python plugin". rustledger_plugin::classify_external_plugin now holds the WASM / Python / unknown classification that resolve_plugin applies after its native lookup (resolve_plugin uses it, unchanged in behavior). In native-only mode the loader skips WASM and Python references and reports an unknown name as E8001 "Plugin not found", without consulting system Python, so it is identical in every build. The LSP emits E8006 only for real WASM/Python references, and writes a `python:` reference with its prefix. Tests cover every shape (native, typo, relative/absolute/missing .wasm, .py, ./path, dotted module, python:native and python:mod) in the loader and the LSP, with and without the runtimes compiled in. They fail both with the previous head's skip-everything behavior and with no native-only mode at all. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Review (adversarial pass)Found and fixed in e8280d1: unknown names lost E8001. The first head skipped every non-native name in native-only mode. So a misspelled native plugin ( The fix:
Tests: every shape, both builds. The shapes are native
Other
Second passCLI parity:
21 of 23 are byte-identical. The other two are the cases that actually run Side finding on main, not this PR: a trivial Python plugin runs out of fuel there. I'll propose it as a separate issue. API.
Cross-PR (test merge). I merged this branch onto origin/main in a scratch worktree with its own target, then #2490, #2495, #2498, #2491, #2488 and #2487. There are no code conflicts. The only conflicts are in
The resolution is to keep both entries. Each of those PRs merges cleanly against main alone, so whichever lands second needs that one-line resolution. Semantically:
Merge order does not matter for correctness. Third pass (code quality)
|
Review follow-up for #2486. resolve_plugin now delegates to classify_external_plugin, so pin the classification it used inline before: .wasm before python:, case-insensitive extensions, the host's path separator, dotted module names, python:-forced names, and bare unknown names. Mutating the order (python: before .wasm) fails it. Document that the separator test is the host's, and why the enum is deliberately not #[non_exhaustive]: callers decide per kind whether to skip or report, so a new kind must break their build. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
Review follow-up for #2486. The native lookup lived in three places: resolve_plugin, a mirror of it in the loader (is_native), and a pass-agnostic variant in the LSP's E8006 path. All three now call rustledger_plugin::find_native_plugin, the first step of resolve_plugin, so the definition of "native" exists once, as the external classification already does. Behavior is unchanged: the #2486 loader and LSP tests pass in both feature builds, and plugin 371 / loader 254 / LSP 346 tests pass. Also folds the non_exhaustive rationale into the enum's doc, and makes the CHANGELOG and LSP docs name the shared functions and stop claiming the CLI always says E8001 for an unknown name (it can say E8004 when system Python finds a module of that name). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr
What
The LSP reports each WASM or Python plugin as skipped (E8006, "skipped in LSP"). That was only true when it was built alone:
(re-checked on this branch.) A plain workspace
cargo build/cargo installor the flake's package therefore gave the LSP both runtimes. ItsLoadOptions::default()then resolved and ran those plugins on every reload. Built alone, the same plugins produced a spuriousWASM plugin 'x' requires the wasm-plugins feature/ E8005 error next to the E8006 note.This implements option 1 from the issue.
LoadOptions::native_plugins_only(defaultfalse). When it is set,run_pluginsskips WASM and Python references before resolution, so the outcome cannot depend on which runtimes were compiled in. A name that is neither native nor WASM/Python shaped (e.g. a misspelled native plugin) is still reported as E8001 "Plugin not found", the same in every build. The classification is the newrustledger_plugin::classify_external_plugin, whichresolve_pluginitself now uses.diagnostics.rsand the journal load inledger_state.rs, through onelsp_load_options().python:-prefixed plugin (shown with its prefix), which is forced onto the Python runtime and so is skipped too. An unknown name no longer gets a misleading "Python plugin" E8006.docs/development/lsp-support.mdexplains the skip, and the CHANGELOG has a### Breakingentry.LoadOptionsis not#[non_exhaustive], so a struct literal must set the field, as withplugin_max_time_secsin Plugins and importers: let the host configure the sandbox time budget #2484. Every in-repo literal uses..Default::default()or was updated.Tested
See the review comment for the all-shapes tests added in e8280d1. Original verification:
loader_test.rs::native_plugins_only_skips_wasm_and_python_plugins_2486: a ledger withauto_accounts, a garbagebad.wasm,bad_plugin.pyandpython:noduplicates. In native-only mode there are no errors at all, andauto_accountsstill runs (no E1001). The default-options control reportsbad.wasm, so the assertion is not vacuous.diagnostics.rs::non_native_plugins_are_skipped_whatever_the_build_2486:all_diagnosticsreturns only the two E8006 notes, andLedgerState::loadrecords no plugin-phase error.cargo test -p rustledger-lsp --features rustledger-loader/wasm-plugins,rustledger-loader/python-plugins,-p rustledger-loader --all-features) and without them.WASM plugin /tmp/bad.wasm failed: failed to load(runtime compiled in) orrequires the wasm-plugins feature(alone), plus E8004 forpython:auto_accounts. With the dispatch skip disabled, the loader test fails the same way.cargo test --all-features: rustledger-loader 254 passed, rustledger-lsp 346 passed. Workspaceclippy --all-features --all-targets -D warningsis clean, and so iscargo doc -D warningsfor both crates.Closes #2486
🤖 Generated with Claude Code
https://claude.ai/code/session_012nNGPA44Dt32NyxWem26xr