You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: enforce 65% integration-test coverage and add tests (XRPLF#298)
## High Level Overview of Change
ClosesXRPLF#297. The CI integration workflow now runs all five integration
test binaries (previously only `integration_test`) under
`cargo-llvm-cov` and enforces a 65% line-coverage gate scoped to
integration-territory files. Six commits add tests that lift integration
coverage from 44.52% → 70.30% to satisfy the gate.
Beyond the integration gate, this PR also adds `is_success()` unit tests
(`src/models/results/mod.rs`), splits the codecov patch gate into
per-flag sections (unit/integration), fixes
`get_latest_open_ledger_sequence` (it requested `ledger { ledger_index:
"open" }`, which rippled rejects), and documents both coverage flows in
`CONTRIBUTING.md`. (The unit thresholds — 83% lines / 85% regions / 73%
functions — were set earlier in XRPLF#296 and are unchanged here.)
### Context of Change
The integration suite was running only `tests/integration_test.rs` (40
transaction tests, all routed through one `test_transaction` helper).
Several public APIs sat at 0% integration coverage: the sync wrappers in
`src/{account,ledger,transaction}/mod.rs`,
`asynch::transaction::submit_and_wait`'s poll loop, the WebSocket
request/response path, multisign, the sync faucet generator, and the
`clients::json_rpc::JsonRpcClient` sync facade. xrpl-py gates its
integration suite at 70%; this PR starts xrpl-rust at 65%, with room to
tighten as coverage grows.
### Type of Change
- [x] New feature (CI coverage gate)
- [x] Tests
- [x] Bug fix (`get_latest_open_ledger_sequence`)
- [x] Documentation (CONTRIBUTING coverage guide)
## Before / After
**Workflow.**
- **Before:** `cargo test --test integration_test …` — ran a single test
binary, no coverage measured.
- **After:** coverage runs in three steps:
1. `cargo llvm-cov --no-report … --test integration_test --test
cli_integration --test funding --test utils --test test_utils` —
collects coverage across all five integration binaries.
2. `cargo llvm-cov report --lcov --ignore-filename-regex
"$COVERAGE_IGNORE_REGEX"` — writes an lcov scoped to
integration-territory files.
3. That lcov is uploaded to codecov, which enforces the 65% gate
(`codecov.yml → project.integration`), and is also saved as a CI
artifact.
`COVERAGE_IGNORE_REGEX` is defined once (workflow `env`), so the scoped
report and the gate always use the same file list.
**Scoped coverage:** 44.52% lines → **70.30% lines**. Notable per-file
moves:
| File | Before | After |
|---|---|---|
| `account/mod.rs` (sync) | 0% | 100% |
| `ledger/mod.rs` (sync) | 47.37% | 100% |
| `transaction/mod.rs` (sync) | 0% | 100% |
| `wallet/faucet_generation.rs` | 0% | 100% |
| `asynch/ledger/mod.rs` | 62.50% | 94.64% |
| `asynch/account/mod.rs` | 55.17% | 95.40% |
| `asynch/clients/client.rs` | 0% | 91.67% |
| `asynch/clients/websocket/websocket_base.rs` | 12.73% | 78.18% |
| `asynch/transaction/submit_and_wait.rs` | 0% | 72.87% |
## Test Plan
All tests run against `rippleci/xrpld:develop` (CI's standalone rippled
image). New test files / functions:
- `tests/transactions/submit_and_wait.rs::test_submit_and_wait_payment`
— autofill, sign, submit, poll loop, with a background `ledger_accept`
driver.
- `tests/utils.rs` — three new WS tests: `server_info` round-trip +
close, `account_info` against genesis, three sequential requests on one
connection (exercises id-based message routing).
- `tests/transactions/sync_wrappers.rs` — 10 tests covering every sync
wrapper in `src/{account,ledger,transaction}/mod.rs`, plus
`clients::json_rpc::JsonRpcClient` and `wallet::faucet_generation`. Each
owns a `tokio::runtime::Runtime` + `EnterGuard` so `reqwest` can find
the reactor while `embassy_futures::block_on` parks the thread.
- `tests/transactions/multisign_payment.rs::test_multisign_payment` —
register a 2-of-2 signer list, autofill with `signers_count=2`, each
signer signs a copy, `multisign()` merges, `submit()` confirms
`tesSUCCESS`.
Verified locally by running the same `cargo llvm-cov` invocation CI
uses, with the same exclusion regex; the scoped report clears the 65%
gate.
---------
Co-authored-by: Phu Pham <ppham@ripple.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,16 +17,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
17
- New `xrpl::signing` module containing the pure-crypto signing helpers (`sign`, `multisign`, `prepare_transaction`) extracted from `asynch::transaction` and `transaction`. Available with just `core + models + wallet` features (no `helpers`/runtime/client dependency). The legacy paths `asynch::transaction::sign` and `transaction::multisign` are preserved as re-exports for backward compatibility.
18
18
- Expanded unit-test coverage and raised CI thresholds: lines `73 → 83`, regions `75 → 85`, functions `67 → 73`.
19
19
- Codecov integration with per-PR project (≥83%) and patch (≥80% on new/modified lines) gates.
20
+
- Integration-test coverage gate: a CI workflow runs all five integration test binaries under `cargo-llvm-cov`, uploads to codecov under an `integration` flag, and gates the project at ≥65%.
20
21
21
22
### Changed
22
23
23
24
- Unit-test and integration-test coverage are now scoped via Cargo feature flags rather than path regex. The unit-test workflow builds with `--no-default-features --features std,core,utils,wallet,models`, so integration-territory code (CLI, async clients, sync wrappers, faucet) simply isn't compiled and doesn't appear in the unit coverage report.
24
25
- Network-dependent inline tests in `src/asynch/transaction/` and `src/asynch/wallet/` (`test_autofill_txn`, `test_autofill_and_sign`, `test_submit_and_wait`, `test_generate_faucet_wallet`) are now gated behind `feature = "integration"` so `cargo test --release` is hermetic by default.
26
+
- Codecov **patch** coverage is now gated per flag (separate `unit` and `integration` sections) rather than a single combined gate.
25
27
26
28
### Fixed
27
29
28
30
-`RipplePathFind::destination_amount` changed from `Currency<'a>` to `Amount<'a>` to match the XRPL wire format.
29
31
-`NoRippleCheckRole` no longer serializes with the `#[serde(tag = "role")]` discriminator; now emits a plain `snake_case` string matching the XRPL wire format.
32
+
-`is_success()` now reports success correctly for responses deserialized into typed `XRPLResult` variants (e.g. `ServerInfo`); it consults the preserved raw result JSON instead of the re-serialized typed value.
33
+
-`get_latest_open_ledger_sequence` now uses the `ledger_current` request; it previously sent `ledger { ledger_index: "open" }`, which rippled rejects with `invalidParams`.
under `account/`, `ledger/`, `transaction/`). Scoped via
121
+
`--ignore-filename-regex` so unit-territory files do not dilute the
122
+
integration metric.
106
123
107
-
Install the tool and run a coverage report locally:
124
+
Install the tool once:
108
125
109
126
```bash
110
127
cargo install cargo-llvm-cov --locked
111
-
cargo llvm-cov --summary-only
112
128
```
113
129
114
-
The CI enforces the following minimum thresholds (current baseline is ~78% lines / ~68% regions / ~75% functions, measured with default features only — integration tests are excluded from coverage):
0 commit comments