Run a subset of the sqlite test suite under miri via -Zmiri-native-lib #5258
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 318 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5258"
general
weight: 0.35
weiznich
Fixes #5224
Run a subset of the sqlite test suite under miri via -Zmiri-native-lib
This PR extends the existing Miri coverage (currently limited to check_as_ref_ and the json type tests) to ~150 more sqlite lib tests, following the approach discussed in the issue: Miri's new FFI options allow loading the system libsqlite3 so that FFI calls from Rust into sqlite are checked, while two things remain unsupported and are gated out with #[cfg(not(miri))] :
1. Native → Rust callbacks. register_diesel_sql_functions becomes a no-op under cfg(miri) (the registered diesel_manage_updated_at carries an xDestroy destructor that native code invokes at connection close), and the tests exercising hooks, custom/aggregate SQL functions, auto extensions, and collation registration are compiled out.
2. Reading memory allocated by the native library. Tests that hit sqlite3_errmsg / sqlite3_value_text error paths, plus the OOM child-process tests, are compiled out.
The gating mirrors the existing #[cfg(not(miri))] // ffi call style already used in diesel/src/sqlite/types/json.rs .
To run this reliably, the commands are wrapped in cargo xtask run-tests --miri sqlite , which locates libsqlite3 via pkg-config (overridable with MIRI_NATIVE_LIB ), sets MIRIFLAGS=-Zmiri-native-lib=... , and runs the diesel lib tests on nightly. A new Miri-Native-Lib CI job runs it on ubuntu-latest with libsqlite3-dev installed.
Testing done locally:
Checklist:
[x] I checked for similar changes and make sure to reference them (extends the existing Miri: job in .github/workflows/ci.yml ; reuses the cfg pattern from the json type tests)
[ ] I included a changelog entry for relevant new features or changes (skipped: this is test/CI infrastructure only, no user-visible library change)
LLM/AI usage disclosure (per CONTRIBUTING.md): This change was developed with the assistance of an AI coding agent (Freebuff). I reviewed and verified the generated code, ran the test suites locally to confirm the behavior described above, and understand the changes well enough to discuss them.