Skip to content

test: skip plugin-feature-gated fixtures in corpus_parity (#1809) - #1812

Merged
robcohen merged 2 commits into
mainfrom
fix/corpus-parity-plugin-skip
Jul 19, 2026
Merged

robcohen merged 2 commits into
mainfrom
fix/corpus-parity-plugin-skip

Conversation

@robcohen

Copy link
Copy Markdown
Member

What

corpus_parity compares the featureless component wasm's load errors against the native rustledger_ffi_wasi::helpers::load_source reference. Under cargo test --workspace, cargo feature unification compiles that native reference with python-plugins/wasm-plugins (the rustledger CLI enables them by default), so on a fixture declaring such a plugin it attempts the plugin and reports a real error, while the always-featureless component reports requires the …-plugins feature. Same function, two feature builds — an artifact of the harness, not a component regression.

The divergence is invisible to CI (which never builds the debug wasm in a --workspace job — verified: the workspace test job doesn't build wasm, the component-tests job builds wasm but runs -p …-tests, not --workspace), but it breaks the documented "run the full suite locally before pushing" workflow for anyone who has built the debug wasm.

Why this shape of fix

The issue floated "compare against a --no-default-features native build" — that isn't achievable inside a single --workspace test binary: features are already unified at link time, and whether the native reference is featured is decided by the rest of the build set, not by anything the test controls.

So: skip a fixture when the component emits the plugin-feature-gate sentinel (-plugins feature). Such a fixture exercises a surface the featureless component structurally can't implement, so asserting parity on it is meaningless. Keying on the component's sentinel rather than a source plugin "…" scan deliberately keeps native-Rust plugins — which the featureless component does run — in the compared set. The skip is surfaced as its own count in the summary line (no silent cap), and applies uniformly whether or not features are unified (301 compared / 4 plugin-feature-skipped in both configs).

Not a product bug

The shipping component is featureless by design; requires the …-plugins feature is its correct, intended message, and rustfava runs those plugins host-side. This PR only re-scopes the harness.

Verification

Reproduced the original failure locally (build debug wasm, cargo test --workspace), then confirmed the fix: corpus parity: compared 301, skipped 21 (of which 4 for the component's plugin-feature gate), green under both --workspace (unified) and -p rustledger-ffi-component-tests (featureless). Clippy/fmt clean. (The pre-existing nd/wd loop variables were renamed to native_dir/wit_dir — touching the file made the typos hook re-scan them, nd → and.)

Related

The stale-.cwasm-cache robustness bug this investigation also exposed (the 4th diverging fixture's environment-dependent deserialization error) is a real, user-facing bug fixed separately in #1811.

Closes #1809.

🤖 Generated with Claude Code

https://claude.ai/code/session_013gJH7uBBF9Xw9et9QFRcsU

corpus_parity compares the featureless component wasm's load errors
against the native rustledger_ffi_wasi::helpers::load_source reference.
Under cargo test --workspace, feature unification compiles that native
reference WITH python-plugins/wasm-plugins (the rustledger CLI enables
them by default), so on a fixture declaring such a plugin it attempts
the plugin and reports a real error, while the always-featureless
component reports "requires the ...-plugins feature". Same function, two
feature builds — an artifact, not a component regression. The divergence
is invisible to CI (which never builds the debug wasm in a --workspace
job) but breaks the local full-suite workflow for anyone who has.

Skip a fixture when the component emits the plugin-feature-gate sentinel:
it exercises a surface the featureless component structurally cannot
implement. Keying on the component's sentinel rather than a source
`plugin "..."` scan keeps NATIVE-Rust plugins (which the featureless
component DOES run) in the compared set. The skip is surfaced as its own
count in the summary line (no silent cap), and applies uniformly whether
or not features are unified.

The stale-cwasm-cache robustness bug this investigation also exposed is
fixed separately in #1811.

Closes #1809.
@robcohen
robcohen requested a review from a team as a code owner July 19, 2026 12:40
Copilot AI review requested due to automatic review settings July 19, 2026 12:40
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the corpus_parity integration test to avoid false mismatches caused by Cargo feature unification when running cargo test --workspace, where the native reference path may be compiled with python-plugins/wasm-plugins enabled while the component WASM remains intentionally featureless.

Changes:

  • Skip corpus fixtures when the component returns the plugin feature-gate sentinel error ("requires the …-plugins feature"), and track these skips separately in test output.
  • Rename loop variables (nd/wd → native_dir/wit_dir) to avoid typos/clarity issues.
  • Expand the printed summary line to include the new “plugin-feature gate” skip count.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Tool Time Memory
rustledger 34.6ms ± 0.6ms 23.8 MB
beancount 947.5ms ± 12.1ms 50.7 MB
Comparison 27.4x faster 2.1x less

vs main branch (2026-07-19)

Metric main this PR Change
Time 35ms 34.6ms -1.1% ✅
10K transactions · 5 runs, 2 warmup · hyperfine
What do these numbers mean?
  • Time: Wall-clock time to parse and validate the ledger (± std dev)
  • Memory: Peak resident set size (RSS)
  • vs main: Compared to latest nightly benchmark on main branch

@github-actions

Copy link
Copy Markdown
Contributor

✅ Compatibility Test Results

Metric Result
Check Compatibility 100%
BQL Compatibility 100%
Full AST Match 100%
Total Files 811
What's tested
  • Check: Exit codes and error counts match bean-check
  • BQL: Query results match bean-query
  • Files: ~800 test files downloaded from 10+ beancount repositories

Full results available in workflow artifacts

…ings)

The first cut keyed the skip on the component's error alone, which the
deep review flagged as too weak. Tighten:

- Skip only when the component gated AND native did NOT gate. Requiring
  !native_gated stops the over-skip in a featureless native build
  (-p ...-tests, no feature unification), where both sides emit the same
  gate message and legitimately compare EQUAL — those fixtures stay
  covered (305 compared / 0 skipped) instead of being dropped, while the
  unified --workspace build still skips the 4 (301 compared / 4 skipped).
- Match the exact "requires the {python,wasm}-plugins feature" phrases
  rather than the loose "-plugins feature" substring, so a "Plugin not
  found" error echoing a plugin name can't trigger an over-skip.
- Collapse guards: bound skipped_plugin_feature (<=30) and require most
  fixtures to be compared (>= files/2), so a component regression that
  emitted the gate broadly trips an assert instead of silently shrinking
  the compared set to a green-but-empty run.
- Drift guard test plugin_feature_gate_message_is_stable: loads a Python
  plugin through the featureless component and asserts the exact phrase
  the skip matches, so a rustledger-loader reword fails there loudly
  rather than breaking the corpus test spuriously.
@robcohen
robcohen merged commit 59b1fb4 into main Jul 19, 2026
42 checks passed
@robcohen
robcohen deleted the fix/corpus-parity-plugin-skip branch July 19, 2026 13:56
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.

corpus_parity diverges under workspace feature unification when the debug component wasm is present

2 participants