ci,test: harden CI and close coverage gaps with fault-injection tests - #24
Merged
Conversation
Coverage measured with cargo-llvm-cov showed the store internals at 74% (postgres) / 78% (sqlite) line coverage, with nearly every miss being a QueryError mapping that only fires when the underlying statement fails. Close them deterministically on both backends: - read path: drop each wallet table in turn, assert the read fails with that query's table label - write path: eight scenarios persisting changesets that touch only the statement under test against a store whose target table is gone - block upsert INSERT / None-hash DELETE: injected with RAISE triggers, since they can only fail after an earlier statement on the same table succeeded - the manual Clone impl: a cloned store shares the pool sqlite.rs is now at 100% line coverage, postgres.rs 96.5%, lib.rs 96.3% (98.3% total); the residual lines are documented-unreachable branches or mappings that require the connection dying mid-transaction. Replace the CI workflow with a hardened one: rustfmt, clippy (--all-targets -Dwarnings), docs (-D warnings, private items), test matrix on stable and beta against postgres 14 (all targets + doctests), MSRV 1.88 (verified and pinned via rust-version), a 97% line-coverage gate with lcov artifact, cargo-deny, and cross-platform checks on macOS and Windows. Actions are pinned to full commit SHAs, permissions are read-only, jobs have timeouts, and a weekly cron surfaces new RustSec advisories. cargo-deny replaces the rustsec/audit-check job, which failed on every run because Cargo.lock is gitignored; deny needs no lockfile and also gates licenses, bans, and registry sources (deny.toml). Cargo.toml gains the license field deny flagged, and the docs gate caught one broken intra-doc link in sqlite.rs.
portlandhodl
force-pushed
the
ci/hardened-ci-and-coverage
branch
from
August 9, 2026 19:29
7f7ac3b to
d4dabac
Compare
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.
Summary
sqlite.rs, 96.5% forpostgres.rs, 96.3% forlib.rs(98.3% total); the residual lines are documented-unreachable branches or error mappings that require the connection dying mid-transaction.QueryErrorcarrying that query's table label.INSERT/ None-hashDELETE: injected withRAISEtriggers, since they can only fail after an earlier statement on the same table succeeded.Cloneimpl: a cloned store shares the pool.rust.yml:--all-targets -Dwarnings), docs (RUSTDOCFLAGS=-D warnings, private items included)rust-versionin Cargo.toml)cargo llvm-cov --fail-under-lines 97, lcov uploaded as artifactrustsec/audit-check, which failed on every run becauseCargo.lockis gitignored ("Unexpected end of JSON input"); deny needs no lockfile and covers the same RustSec advisories plus license/source gating via the newdeny.tomlcargo checkon macOS and Windowspermissions: contents: read, per-job timeouts, PR concurrency cancellation, weekly cron so new advisories surface without a pushCargo.tomlgains thelicense = "MIT"field cargo-deny flagged; the docs gate caught one broken intra-doc link insqlite.rs.Every gate was verified passing locally (fmt, clippy, docs, full suite on postgres 14 + sqlite, coverage, deny, MSRV 1.88 check) before being added to CI.
Test plan
cargo test --all-targets+cargo test --docagainst postgres 14 and sqlite — 58 + 2 + 2 passcargo llvm-cov≥ 97% lines (98.3% measured)cargo deny check,cargo fmt --check,cargo clippy --all-targets -- -Dwarnings,RUSTDOCFLAGS="-D warnings" cargo doccargo +1.88 check --all-targets(MSRV)