Repository navigation
test(ffi): corpus-driven CLI↔FFI parity sweep - #1680
Merged
Merged
Conversation
Feed every self-contained .beancount in the repo (287 compared locally; more in CI when compat fixtures are fetched) through BOTH the native load path (rustledger_ffi_wasi::helpers::load_source) and the component load export, diffing per-entry (kind, date) and asserting the native errors appear as a message-level PREFIX of the component errors (the component appends the #1663 semantic-validation errors; phase cannot separate the sets since native tags booking/process errors validate too). This is the silent-green invariant: nothing the native path reports may vanish through the component. The hand-written parity.rs cases each pin one behavior; the v0.17-v0.19 bug class was drift on inputs nobody wrote a case for — this sweeps the corpus wholesale. Skips include-using / non-UTF-8 / >200KB files (counted, printed, guarded by a minimum-corpus-size assert). Runtime ~3s. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a corpus-driven integration test to continuously verify parity between the native “load source” pipeline and the WASI Preview 2 component-model load export, preventing unnoticed drift on real-world ledger inputs across the repo.
Changes:
- Introduce
corpus_parity.rs, a repo-wide sweep over.beancountfixtures comparing directive stream shape and enforcing the “native errors are a prefix of component errors” invariant. - Add
rustledger-coreas a dependency ofrustledger-ffi-component-teststo discriminate native directive kinds/dates. - Update
Cargo.lockaccordingly.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/rustledger-ffi-component-tests/tests/corpus_parity.rs | New corpus sweep parity test between native load and component load. |
| crates/rustledger-ffi-component-tests/Cargo.toml | Adds rustledger-core dependency needed by the new test. |
| Cargo.lock | Locks the additional dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Contributor
📊 Benchmark Results
vs main branch (2026-07-01)
What do these numbers mean?
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements improvement idea #2 — the hand-written
parity.rscases each pin one behavior; the v0.17→v0.19 bug class was drift on inputs nobody wrote a case for. This sweeps every self-contained.beancountin the repo through both surfaces (nativeload_source+ the componentloadexport, ownbindgen!harness incl. the 3.2.0host.decryptimport), diffing per-entry (kind, date) plus the silent-green invariant: the native path's errors must appear as a message-level prefix of the component's (loadappends #1663's validation errors; phase can't separate the sets — native tags booking/process errorsvalidatetoo).Maiden run honesty
The first sweep flagged 9 files — all turned out to be an artifact of a phase-based filter in the test, not product bugs. With the correct prefix invariant: 287/287 files identical locally (more in CI when compat fixtures are fetched). The corpus is clean — and now stays that way by construction.
Skips (include-using / non-UTF-8 / >200 KB) are counted + printed, with a minimum-corpus-size assert so a broken walker can't pass vacuously. Runtime ~3s.
🤖 Generated with Claude Code