VarDictRust Master Test Matrix & CI/CD Pipeline Audit¶
Authoritative Technical Reference — Seven-Level Test Architecture & Verification Matrix
Governing Standard: rewrites.bio Manifesto (§0 Evidence Before Completion, §0b Integrity, §5 Default --compat=vardictjava Parity on Valid Inputs + Opt-In --compat=off Diff-Confinement)
Target Release: VarDictRust v1.2.0 (release/v1.2.0)
Certified Release Engine Fingerprint: 729cf0f46bd30c4b (Certified Invariant)
Repository: https://github.com/palakpsheth/VarDictRust
Author / Maintainer: Palak Sheth palakpsheth@gmail.com
Companion Report: docs/validation/omnibus-empirical-validation.md (Biological Truth & Empirical Parity)
1. Executive Summary & Architectural Overview¶
To ensure that VarDictRust meets the exacting standards of the rewrites.bio manifesto and provides clinical-grade reliability for deep whole-genome sequencing (WGS), every release candidate is governed by a Seven-Level Test Architecture flanked by pre-commit hooks and cloud CI/CD pipelines.
This architecture operates on two complementary pillars: - Pillar A (Biological Parity & Empirical Truth): Documented in the Omnibus Master Empirical Validation Report, verifying variant-level concordance against gold-standard consortium benchmarks (NIST GIAB, FDA SEQC2, Hartwig) across GRCh38 and GRCh37. - Pillar B (Engineering Mechanics & Verification Pipeline): Documented in this report, establishing the software testing hierarchy, developer feedback loops, crash resilience corpus, statistical invariants, continuous performance budgets, and SLSA-attested CI/CD workflows.
Across all testing layers, VarDictRust executes 934 automated Cargo workspace tests (Level 1: Unit & Component Tests), 92 integration regression testcases (Level 2: Upstream Integration Regression Corpus), 17 differential parity benchmarks (Level 3: Dual-Engine Differential Parity Testing), 16 committed evidence JSONs (spanning differential parity, robustness twins, truth concordance, performance budgets, and musl packaging), 5 ground truth concordance evaluations via rtg vcfeval (Level 4: Ground Truth Concordance Benchmarking, all certified EQUAL), 5 continuous performance budgets (Level 5: Performance & Memory Budgets), 37 diagnostic self-tests (Level 6: Diagnostic Self-Tests), and automated pre-PR and release acceptance compound gates (Level 7: Pre-PR & Release Acceptance Compound Gates) alongside 6 automated cloud CI/CD pipelines.
flowchart TD
subgraph PreCommit ["Developer Local Pre-Commit (<3s)"]
P1[".githooks/pre-commit (Track A Native)"]
P2[".pre-commit-config.yaml (Track B Python)"]
P1 & P2 -->|Checks| P_Fmt["cargo fmt --check"]
P1 & P2 -->|Checks| P_Clip["cargo clippy -D warnings"]
P1 & P2 -->|Checks| P_Leak["gitleaks protect --staged"]
end
subgraph Level1 ["Level 1: Unit & Component Tests (934 Total)"]
C_Core["crates/vardictrust-core (680 lib + 110 corpus_parity + 65 engine_behavior + 2 amplicon_stream_mem + 3 cram_stack tests)"]
C_CLI["crates/vardictrust (38 cli tests)"]
C_Prof["crates/vardictrust/tests/profile_smoke.rs (3 tests)"]
C_Rob["crates/vardictrust/tests/robustness.rs (32 tests)"]
C_Ver["crates/vardictrust/tests/version.rs (1 test)"]
end
subgraph Level2 ["Level 2: Upstream Integration Regression Corpus (92 Fixtures)"]
I1["harness/run_integration.sh\n(91 static PASS / 1 static XFAIL (UB-4) Class D defect)"]
I2["Live Oracle Parity\n(100% byte-identical across all 92 fixtures)"]
end
subgraph Level3 ["Level 3: Dual-Engine Differential Parity Testing (Tier-2)"]
D_Micro["fixtures/micro/ (Synthetic Micro BAM)"]
D_Slices["harness/slices.tsv (10 Standard Slices: s1a-s9)"]
D_Pub["Public Cohorts: HG008, SEQC2 Exome, HG002, Amplicon"]
D_Ext["Extended Modalities Suite (17 Modes: RNA, SVs, Flags)"]
D_Multi["Multi-Cohort Slice Suite (18 Slices across 6 Cohorts)"]
end
subgraph Level4 ["Level 4: Ground Truth Concordance Benchmarking (Tier-3)"]
T_HG002["GIAB HG002 NIST v4.2.1 (F1: 0.9699, EQUAL)"]
T_SEQC2["SEQC2 HCC1395 v1.2.1 Somatic (EQUAL)"]
T_HG008["GIAB HG008 NIST Draft v0.3 (EQUAL)"]
T_HG005["GIAB HG005 NIST v4.2.1 (F1: 0.9667, EQUAL)"]
T_NA24385["GIAB NA24385 b37 NIST v4.2.1 (F1: 1.0000, EQUAL)"]
T_Sites["Bitwise Site List Identity: tp/fp/fn.sites diff == 0"]
end
subgraph Level5 ["Level 5: Performance & Memory Budgets"]
S_Chr1["harness/scale_bench.sh (Chr1: 3.04x speedup, 1.27x RSS)"]
S_Budg["harness/perf_budget.py (5 Targets: HG008, SEQC2, HG002, Amp, CRAM Twin)"]
end
subgraph Level6 ["Level 6: Diagnostic Self-Tests (37 Tests)"]
H_Self["bash harness/run_self_tests.sh\n(Comparator, Evidence, Git Hooks, VCF Header, Resource Throttling, BAM edges)"]
end
subgraph Level7 ["Level 7: Pre-PR & Release Acceptance Compound Gates"]
G_Rgate["harness/rgate.sh (Inner Loop <30s)"]
G_PR["harness/pr_check.sh (6-Stage PR Gate)"]
G_Accept["harness/acceptance.sh (8-Item Release Acceptance)"]
end
subgraph CloudCI ["Cloud CI/CD & Supply Chain Verification"]
CI_Main[".github/workflows/ci.yml (Build, Test, Corpus, Robustness)"]
CI_Sec[".github/workflows/security.yml (Gitleaks, Deny, Audit)"]
CI_Rel[".github/workflows/release.yml (cargo-dist, musl, SLSA 3)"]
CI_Diff[".github/workflows/differential.yml (Oracle, Micro, Slices)"]
CI_Docs[".github/workflows/docs.yml (Zensical Strict Site Build)"]
CI_Wiki[".github/workflows/wiki.yml (Wiki Sync)"]
end
PreCommit --> Level1
Level1 --> Level2
Level2 --> Level3
Level3 --> Level4
Level4 --> Level5
Level5 --> Level6
Level6 --> Level7
Level7 --> CloudCI
1.1 Verification Tiers (Tier-1, Tier-2, Tier-3) vs Seven-Level Test Architecture¶
VarDictRust organizes scientific variant calling validation into three rigorous Verification Tiers, mapped directly to its Seven-Level Engineering Architecture:
Tier-1: Corpus Intermediate Table Parity (.var Tables)¶
- Definition: Evaluates the engine's intermediate tabular output generated prior to VCF serialization using
python3 harness/compare_var.py golden/<case>.var <ours.var>. - Validation Scope: Enforces exact column count schemas across calling modes (Simple 36/38, Amplicon 38/40, Somatic 55/61), raw float formatting vs banker's rounding, strand bias contingency counts, and candidate classification strings.
- Architectural Mapping: Operationalized in Level 1 (table serialization unit tests) and Level 2 (the 92-fixture upstream integration regression corpus; Release Acceptance Gate Item 2).
Tier-2: Live Dual-Engine Differential Parity (VCF Differential vs Oracle)¶
- Definition: Executes VarDictRust (in default
--compat=vardictjavaparity mode) and VarDictJava v1.8.3 concurrently on identical BAM/CRAM alignment inputs, feeding both outputs intoharness/compare_vcf.pyunder strict IEEE 754 half-even float tolerance \(\varepsilon \le 10^{-6}\) (complemented by targeted--compat=offdiff-confinement tests inengine_behavior.rsandrobustness.rs). - Validation Scope: Aligns records strictly by
CHROM:POS:REF:ALT, asserting 100% exact parity across FILTER decisions, INFO tags, FORMAT genotype fields, and variant types. Requires exactly 0 variant discrepancies. - Architectural Mapping: Operationalized as Level 3: Dual-Engine Differential Parity Testing (micro fixture, 10 standard slices
s1a–s9, 17-modality extended coverage suite, 18 multimodal slices across 6 cohorts, and whole-cohort WGS/WES sweeps; Release Acceptance Gate Item 3).
Tier-3: Biological Ground Truth Concordance (NIST GIAB / SEQC2 via rtg vcfeval)¶
- Definition: Evaluates variant calling performance independently against orthogonally certified physical truth datasets using Real Time Genomics
rtg vcfeval. - Validation Scope: Measures biological precision, recall, and \(F_1\) score against high-confidence gold standards (NIST GIAB v4.2.1, FDA SEQC2 Somatic v1.2.1). Proves the rewrites.bio Transitivity Principle: because \(\text{VarDictRust} \equiv \text{VarDictJava}\), their concordance against biological reality is bitwise site-identical (
diff tp/fp/fn.sites == 0). - Architectural Mapping: Operationalized as Level 4: Ground Truth Concordance Benchmarking (Release Acceptance Gate Item 6).
2. Master Verification Matrix¶
The table below summarizes the complete testing inventory executed across the development and release lifecycle:
| Level | Category | Target Suite / Location | Test Count | Execution Trigger | Pass Criterion | Typical Runtime |
|---|---|---|---|---|---|---|
| Pre | Pre-Commit Hook (Track A) | .githooks/pre-commit |
3 checks | git commit (local) |
fmt, clippy, gitleaks clean | \(<3\text{ s}\) |
| Pre | Pre-Commit Hook (Track B) | .pre-commit-config.yaml |
6 hooks | git commit (local) |
yaml, toml, whitespace, gitleaks | \(<4\text{ s}\) |
| 1 | Level 1: Core Library Tests | crates/vardictrust-core/src/ |
680 tests | cargo test -p vardictrust-core --lib |
0 failures, 0 panics | \(\sim 2\text{ s}\) |
| 1 | Level 1: Corpus & Modality Parity | crates/vardictrust-core/tests/corpus_parity.rs |
110 tests | cargo test -p vardictrust-core --test corpus_parity |
92-corpus + 17 modalities + manifest PASS | \(\sim 1.5\text{ s}\) |
| 1 | Level 1: Engine Behavior & Hostile Inputs | crates/vardictrust-core/tests/engine_behavior.rs |
65 tests | cargo test -p vardictrust-core --test engine_behavior |
CRAM, Fisher, SVs, filters, hostile inputs, tiled conservation, Perl -A/-f, all 49 COMPAT_OFF switches ((only_i, loo_i) 4-law matrix, split-tile seam/spill, portable BAM==CRAM, acrocentric --csi, Wave-7/Wave-8 real-BAM confinement, Switch 42 fgumi duplex/MI interop, Switch 46 MSI12/LOH, Switch 49 SV/BND bcftools concat/norm interop), SA:Z SV chaining & foldback-hairpin rejection, HP:i/PS:i HapBias, --methylation cis-CpG ASM/DMR, --noise-model PolymerNoise, --orientation-bias[=annotate], --preset wgs\|wes\|amplicon\|ctdna\|hifi\|ont, -sp, AstraZeneca-NGS/VarDict#172, AstraZeneca-NGS/VarDictJava#393 & AstraZeneca-NGS/VarDictJava#378 PASS |
\(\sim 1.0\text{ s}\) |
| 1 | Level 1: Amplicon Streaming Memory | crates/vardictrust-core/tests/amplicon_stream_mem.rs |
2 tests | cargo test -p vardictrust-core --test amplicon_stream_mem |
Bounded memory on huge BED intervals | \(\sim 0.2\text{ s}\) |
| 1 | Level 1: CRAM Decoder Stack | crates/vardictrust-core/tests/cram_stack.rs |
3 tests | cargo test -p vardictrust-core --test cram_stack |
64 MiB Rayon stack, CRAM==BAM, reference cache bound | \(\sim 0.3\text{ s}\) |
| 1 | Level 1: CLI Front-End Tests | crates/vardictrust/src/ |
38 tests | cargo test -p vardictrust --bin vardictrust |
0 failures, 0 panics | \(<0.1\text{ s}\) |
| 1 | Level 1: Profiling Smoke Tests | crates/vardictrust/tests/profile_smoke.rs |
3 tests | cargo test -p vardictrust --test profile_smoke |
Feature guards & profile artifacts PASS | \(\sim 0.2\text{ s}\) |
| 1 | Level 1: Crash Robustness Corpus | crates/vardictrust/tests/robustness.rs |
32 tests | cargo test -p vardictrust --test robustness |
Locale, BGZF/TBI/CSI (--vcf-all-alleles --compat=off, --preset, --noise-model, --methylation, spanning-SV --csi leaf-bin loffset clintval/vartovcf#161, paired amplicon .cram + -sp + vardictcpp aliases) + stale sidecar cleanup, --stats-json, BrokenPipe, FD/TTY/symlink/0555 O_NOFOLLOW staging, BGZF .fa.gz/.bed.gz/FIFO BED, companion indices, hostile .fai/CRAM/CIGARs (AstraZeneca-NGS/VarDictJava#393, AstraZeneca-NGS/VarDict#172), ANSI/OSC stderr sanitization, --vcf-* thresholds, -th positional BED & Commons-CLI duplicate parity, -r overflow, HLA colon-contigs & --completions/--manpage PASS |
\(\sim 0.6\text{ s}\) |
| 1 | Level 1: Release Metadata & AI | crates/vardictrust/tests/version.rs |
1 test | cargo test -p vardictrust --test version |
Version, pure MIT license, Lai (2016), AI disclosed |
\(<0.01\text{ s}\) |
| 2 | Level 2: Integration Regression Corpus | harness/run_integration.sh |
92 fixtures | PR gate & Acceptance Item 2 | 91 PASS / 1 XFAIL (UB-4 signature, 8 workers) |
\(\sim 1.6\text{ s}\) |
| 3 | Level 3: Micro Differential | fixtures/micro/ |
1 fixture | PR gate & Acceptance Item 3 | Live Oracle MATCH (0 diffs) | \(<1\text{ s}\) |
| 3 | Level 3: Standard Slices | harness/slices.tsv (s1a–s9) |
10 slices | Inner loop (rgate), PR gate & Acceptance |
Live Oracle MATCH (0 diffs, 8 workers) | \(\sim 4\text{ s}\) |
| 3 | Level 3: Primary Public WGS/WES | hg008, seqc2, hg002, amplicon |
4 cohorts | Evidence recertification & Acceptance | MATCH (\(\varepsilon \le 10^{-6}\), 0 diffs) | \(\sim 8\text{ m}\) |
| 3 | Level 3: Extended Modalities | harness/run_extended_coverage.sh |
17 modes | PR gate (--no-record) & Acceptance Item 3 |
MATCH (RNA, SVs, flags, 0 diffs, 8 workers) | \(\sim 5\text{ s}\) |
| 3 | Level 3: Multi-Slice Expansion | harness/run_multimodal_slices.sh |
18 slices | PR gate (--no-record) & Acceptance Item 3 |
MATCH (6 cohorts, 9 chrs, 0 diffs, 8 workers) | \(\sim 6\text{ s}\) |
| 4 | Level 4: Truth Concordance (HG002) | harness/concordance_germline.sh |
1 evaluation | Release Acceptance Item 6 | \(F_1 = 0.9699\), Bitwise Site EQUAL | \(<1\text{ s}\) (cached) |
| 4 | Level 4: Truth Concordance (SEQC2) | harness/concordance.sh seqc2 |
1 evaluation | Release Acceptance Item 6 | \(F_1 = 0.1555\), Bitwise Site EQUAL | \(<1\text{ s}\) (cached) |
| 4 | Level 4: Truth Concordance (HG008) | harness/concordance.sh hg008 |
1 evaluation | Release Acceptance Item 6 | \(F_1 = 0.3856\), Bitwise Site EQUAL | \(<1\text{ s}\) (cached) |
| 4 | Level 4: Truth Concordance (HG005) | harness/concordance_multimodal.sh |
1 evaluation | Ground Truth Verification Gate | \(F_1 = 0.9667\), Bitwise Site EQUAL | \(<1\text{ s}\) (cached) |
| 4 | Level 4: Truth Concordance (NA24385 b37) | harness/concordance_multimodal.sh |
1 evaluation | Ground Truth Verification Gate | \(F_1 = 1.0000\), Bitwise Site EQUAL | \(<1\text{ s}\) (cached) |
| 5 | Level 5: Whole Chromosome 1 Scale | harness/scale_bench.sh |
1 benchmark | Release Acceptance Item 5 | \(S_8 \ge 2.4\times\) (\(\text{bar}(P)=0.6\cdot\min(8,P)\)), Peak RSS \(\le 1.5\times\) | \(\sim 50\text{ m}\) |
| 5 | Level 5: Continuous Perf Budget | harness/perf_budget.py |
5 targets | PR gate Stage 5 & Acceptance Item 5 | Runtime \(\le +5\%\), RAM ratio \(\le 1.0\), CRAM/BAM \(\le 2.5\times\) | \(<0.2\text{ s}\) |
| 6 | Level 6: Diagnostic Self-Tests | bash harness/run_self_tests.sh |
37 scripts | Automated Diagnostics Runner | Exit code 0 across all 37 tests | \(<10\text{ s}\) |
| 7 | Level 7: Inner Developer Gate | harness/rgate.sh |
Compound | Developer inner loop | Cargo + Corpus + Micro + 5 slices PASS | \(<15\text{ s}\) |
| 7 | Level 7: Standard PR Gate (Tier A) | harness/pr_check.sh |
6 stages | Pre-PR validation | Stages 1–6 PASS (Hygiene, Corpus, Tier-2 --no-record, Perf) |
\(<25\text{ s}\) |
| 7 | Level 7: Release Acceptance Gate (Tier B) | harness/acceptance.sh |
8 items | Release qualification gate | Items 1–8 PASS under fingerprint | \(<30\text{ s}\) |
| CI | Cloud CI: Test & Coverage Matrix | .github/workflows/ci.yml |
9 steps | Git push to main, PRs & dispatch |
Format/Lint, Build, Unit, Integration, Parity, >90% Coverage, 30 Self-Tests, Governance |
\(\sim 3\text{ m}\) |
| CI | Cloud CI: Security Audits | .github/workflows/security.yml |
4 stages | Weekly cron, push main, PRs |
Gitleaks, Deny, Audit, Clippy SARIF PASS | \(\sim 1\text{ m}\) |
| CI | Cloud CI: Packaging & Provenance | .github/workflows/release.yml |
Dist/SLSA | Git tag push (v1.2.0) & PRs |
Release Guard (--require-head-fingerprint), Musl PIE, SLSA 3 |
\(\sim 6\text{ m}\) |
| CI | Cloud CI: Differential Parity | .github/workflows/differential.yml |
6 steps | Git push to main, PRs & dispatch |
Cached golden-store, Micro, 10 Slices, 17 Modes (--no-record), 7 Oracle Self-Tests |
\(\sim 8\text{ m}\) |
| CI | Cloud CI: Documentation Site | .github/workflows/docs.yml |
3 stages | Git push to main, PRs & dispatch |
prepare_docs_site.py, zensical build --clean --strict, test_docs_ui.py |
\(<1\text{ m}\) |
| CI | Cloud CI: Wiki Sync | .github/workflows/wiki.yml |
1 sync job | Git push to main (wiki/**) & dispatch |
.wiki.git matches wiki/ or clean no-op |
\(<1\text{ m}\) |
3. Level 1: Unit & Component Tests (934 Cargo Workspace Tests & > 90% Line Coverage)¶
Executing cargo test --workspace validates 934 tests across crates/vardictrust-core, crates/vardictrust, and integration test suites (enforcing > 90% Rust line coverage via cargo llvm-cov report --ignore-filename-regex '(^|/)tests/' --fail-under-lines 90):
3.1 crates/vardictrust-core (680 Library Tests + 180 Integration Tests)¶
The core variant calling engine enforces #![forbid(unsafe_code)] and zero unhandled panics. Its 680 library unit tests, 110 corpus and modality parity tests, 65 engine behavior tests, 2 amplicon streaming memory tests, and 3 CRAM stack integration tests are partitioned across the following modules:
- Output Formatting & Tables (
output/— 88 tests): output::table(32 tests): verifies column schema counts (Simple 36/38, Amplicon 38/40, Somatic 36/55/61*_append&*_into),TableModeStylemode-specific float/precision quirk conservation (ar09_table_mode_style_preserves_all_four_vardictjava_quirks),COMPAT_OFFexact_binary_half_evenbinary tie rounding (±5e-{4,5,6,9}) andcontinuous_pstd_qstdsample SD rendering, raw float formatting vs banker's rounding, null-record row rendering for-pmode, and header generation.output::vcf(56 tests): verifies Perl falsy-row skipping (perl_row_skippedmatchingvar2vcf_valid.pl:141dropping empty or"0"REF cells), single-sample-f 0Perl falsy0.02AF threshold fallback (test_var2vcf_valid_zero_af_threshold_falls_back_to_0_02) and verbatimaf_threshold_raw-ffilter token formatting, decoupled--vcf-*filter thresholds (VcfThreshold,effective_vcf_cluster_dist,defined()zero overrides, fractional filter header IDs),--orientation-bias[=MAX_AF:MIN_SOB:MAX_OBP|annotate](INFO/OBP,INFO/SOB,FORMAT/F1R2,FORMAT/F2R1,FILTER=OrientationBias,duplex_cntbalancing, andannotateheader/filter suppression),SingleRecordStreamer/SingleVcfEvent(ClusterNbp,AmpBiasSnvClusterProbe,SvSplitreadFlush),COMPAT_OFF(##VarDictRustCompat=off, bijectiveAstraZeneca-NGS/VarDictJava#116INFO/SAMPLEpercent-encoding, mixed sex/mitochondrial contig preservation,UB-5preserve_discordant_svsdiscordant-only<DUP>/<INV>/<DEL>retention with explicit--min-splitreadsoverride,canonical_sv_vcf_anchoring##ALT/signedSVLEN/single+amplicon+pairedEND;SVTYPE;SVLEN,paired_somatic_ampliconGDAMP;TLAMP;NCAMP;AMPFLAG+AMPBIAS+LikelyLOH/rescued-Germlinenormal concordance +pSTDsuppression,nonnegative_subtracted_meansQUAL >= 0,strict_vcf_ad_number_rNumber=RFORMAT/AD,omit_nonsv_vcf_endnon-SVINFO/ENDomission,canonical_vcf_gt1/0 -> 0/1& subclonal0/0 -> 0/1promotion,insertion_hicov_and_local_amp_dpmsint == 1LongMSIClause 1,spliced_overhang_and_homopolymer_filter< 1%monomer8 <= MSI <= 121-bpMSI12filter withduplex_cnt >= 1and paired LOH immunity,continuous_pstd_qstdsample SD formatting, andexact_binary_half_eventie rounding), IEEE 754 half-even banker's rounding (round_half_even), VCFv4.2 header generation and upfront.fai/-G/-Nhygiene validation, SVEND=tag computation, and INFO/FORMAT tag serialization.- CIGAR Parsing & Indel Realignment (
cigar/&realign/— 128 tests): cigar::modify,cigar::parse&cigar::tests(73 tests: 16 incigar::modify, 55 incigar::parse, 2 incigar::tests): verifies CIGAR string parsing, single-Mand>= 10S/>= 12Spure-S/Mmodify_cigarfast-path endpoint mismatch clipping, hostile/corrupt CIGAR operator guards andCOMPAT_OFFcigar_homopolymer_mergemulti-indel rescue (AstraZeneca-NGS/VarDictJava#402),COMPAT_OFFcigar_strip_outer_hard_clipsouter<N>[HP]stripping and interiorPadhandling (AstraZeneca-NGS/VarDictJava#341,AstraZeneca-NGS/VarDictJava#103),COMPAT_OFFeqx_cigar_read_lengthSAM=/Xcoalescing and read-length accounting,COMPAT_OFFconsensus_bam_compat(Switch 42) aligned-'N'NMneutralization, terminal-'N'modify_cigarexemption, andReadOrientation(F1R2/F2R1/DuplexBalanced) tracking,COMPAT_OFFspliced_overhang_and_homopolymer_filter(Switch 46) bilateral un-anchoredNsplicetpclamping (<= 10 bp, deduplicating consecutiveNops and outer-k 0deletions) and anchored-exon preservation,--preset hifi|ontMAX_LONG_READ_SCLIP_BASES = 2,048cap and(10..=99)Sbypass,COMPAT_OFFmate_overlap_both_strandsmolecule-keyed-uFR overlap strand rebalancing,COMPAT_OFFreconcile_strand_and_hq_sumsVariation::reset_counts_compat,--amplicon-single-primer(-sp) primed-edge filtering, loaded-window± 5_000 bpdeletion coverage clipping and coordinate-compressedi64sweep (finish_ref_coverage), pre-regionMatch\(O(1)\) skip and single-baseMatchpileup fast-paths, indel/soft-clip rewriting (modify_cigar), mismatch gate filtering, cached&LoadedRegion\(O(1)\) reference indexing, supplementary-readmax_read_lengthupdates,M-after-IreferenceNmismatch counting, signedelement_len\(3'\) soft-clip rescue, secondaryLoadedRegionlookup during structural-variantpartial_pipelinere-parsing (parse_cigar_selects_secondary_loaded_region_for_partial_pipeline), chimeric \(3'\) soft-clip seed checks with/withoutSAtags, VCF-delimiter base neutralization while preserving SAM=,u64COMPAT_OFFlive_duprateaccounting, and CRISPR cut-site filtering.realign(55 tests): verifies SWAR \(3'\)-to-\(5'\) overhang matching (find_35_match,COMPAT_OFFexact_35_overlaprem5 < rem3assembly rescue, and pre-sentinelactual_mismatch), zero-allocationis_match/find_mm5/find_mm3helpers,COMPAT_OFFno_passing_reads--eqx(=/X) spanning-read counting,exact_cigar_dlen_matchexact CIGAR<dlen>Doperator matching,adj_snv_full_sclip_matchfull-flank soft-clip SNV rescue,mnp_exact_right_fold&mnp_cis_haplotype_phasing(Switch 44) spanning-readDPconservation, cis/trans haplotype separation,up_cov_masksplicedNintron tracking, and multi-offset orphan cis prefix pruning,strict_unspanned_lgins_stitch&complex_indel_and_lgins_concordance(Switch 45) TruSeq chimera / unilateralbi == 0rejection (gating beforepartial_pipeline),\^\d+deletion-length stripping, and+ins\(\to\)+ins&Xshift_removeconsolidation,add_var_factor&rm_cntWelford(p_m2, q_m2)and proportionalmeth_prob_sum/meth_cntpropagation,reconcile_strand_and_hq_sumsrealigndelextracntclearing,adaptor_all_consensus_dirsall-direction--adaptorsoft-clip screening,sv_respect_min_lensub-100 bp<inv-N>and sub-50 bp<dup-N>soft-clip recruitment, andcanonical_sv_vcf_anchoringpre_anchored_dup<dupN>tagging,<dupN>\(3'\) flank substring offset (test_dup_ins3_flank_substring_offset_matches_java_substr), secondary mate-window reference seed loading (ensure_reference_loaded), complex MNP adjustments (adjust_mnp), window-sliced large insertion/deletion realignment (realignins,realigndel,lgins30,lgins,lgdel+--preset hifi|ontfind_bp_with_modeparity), and soft-clip SV field merging.- Postprocessing & Variant Classification (
postprocess/— 92 tests): postprocess::simple(13 tests): verifies single-winner multi-allelic collapsing (UB-7),--vcf-all-allelesretention,COMPAT_OFFstrict_region_bounds&canonical_sv_vcf_anchoring1-bp upstream SV bounds,canonical_vcf_complex_left_align&indel_only_shift3,coordinate_sorted_varsascending.varcoordinate emission and deterministic VCF tie-breaking,pileup_preserve_shifted_ref-pmulti-deletion shifted-reference emission (AstraZeneca-NGS/VarDictJava#330),sanitize_iupac_alt_allelespost-adj_complexREF == ALTfiltering,recompute_vartype_after_adj_complexvar_typerefresh,UB-1sentinel suppression, raw start grouping, and pileup null-record fallback branches.postprocess::somatic(47 tests): verifies tumor/normal subtraction, multi-allele somatic rescue (combine_analysis,somatic_post_process_at),F1R2/F2R1/duplex_cnt/Welford-SD/HP/METHsomatic propagation and symbolic<INS>SVLENallele-key discrimination,COMPAT_OFFsomatic_continue_after_bad_varsecondary-allele continuation,somatic_reconcile_split_allelessplit Tumor/Normal allele reconciliation (including cross-class(presence_class, start_pos, ref, alt)orientation &duplex_cntkeying),somatic_loh_homozygous_alt&somatic_multiallelic_loh_rescue(Switch 47) trailingv2multi-allelic rescue andFisherExact < 0.05LikelyLOHclassification,paired_somatic_ampliconconcordance propagation,nonnegative_subtracted_meanssubtracted-mean clamping,reconcile_strand_and_hq_sums&reconcile_rd_vd_dpdepth/strand reconciliation,sanitize_iupac_alt_alleles&recompute_vartype_after_adj_complex,strict_region_bounds+ unextendedregion.start - 1<dupN>retention,max_read_lengthandsplicepropagation acrosscombine_analysiswindows, in-placev2nt.is_noise()coverage propagation across tumor alleles (test_is_noise_mutation_on_first_v2_variant_propagates_to_second_tumor_allele), and somatic status classification (StrongSomatic,LikelySomatic,StrongLOH,LikelyLOH,Germline).postprocess::amplicon(32 tests): verifies overlapping primer bias detection (is_amp_bias_flag), primer trimming (including 5'-VCF-padded deletion and 1-bp-anchored symbolic SV insert bounds),--amplicon-single-primer(-sp),F1R2/F2R1/duplex_cnt/HP/PS(dom_ps) amplicon consensus aggregation and symbolic<INS>SVLENconcordance keying, active-interval streaming sweeps, bounded suffix-minimum horizon deduplication and immediateemiterror propagation,--vcf-all-allelesretention,COMPAT_OFFstrict_region_bounds,canonical_vcf_complex_left_align,indel_only_shift3,sanitize_iupac_alt_alleles,recompute_vartype_after_adj_complex, &UB-2sentinel suppression, null-rowtlamp/ncampformatting,good_variantspersistence across amplicons,GoodVarCount/TotalVarCountratios, andAMPBIASassignment.- Statistical Analysis, Polymer-Stutter Noise & Epigenetic Models (
stats/,noise,methylation— 44 tests): stats::fisher(21 tests): verifies Fisher's exact test \(2 \times 2\) contingency table p-values,EXP_UNDERFLOW_LN_F64(-746.0) 0-ULP cutoff and hoistedp3binomial invariants, streaming hypergeometric summations, and odds ratios against R (fishers_exact) and Java (test_java_fisher_ultradeep_parity) oracles.stats::f80(6 tests): verifies 80-bit extended precision emulation for hypergeometric summations.stats::hypergeom(6 tests): verifies cleanroomMITsaddlepoint binomial and hypergeometric routines (stirling_error,binomial_deviance,binomial_pmf,log_binomial_pmf,hypergeom_pmf,hypergeom_cdf).stats::zeroin(4 tests): verifies Brent's zero-finding root solver (UnirootZeroIn) for odds ratio confidence intervals.noise(5 tests): verifies zero-allocation Lanczos (\(g=7, N=9\))lgamma,O(1)hybrid exact-recurrence / Lentz continued-fraction Beta-Binomial upper tail \(P_{\text{BB}}(X \ge \text{VD} \mid \text{DP}, \mu, \rho)\),parse_noise_model_spec,100%ERRP = 0.0immunity on SNVs/MNVs/SVs and non-repeat EGFR / BRCA1/2 indels, modality VAF ceilings, unreconciledvd2 > dp2clamping, andduplex_cnt >= 1/is_hotspotexemptions.methylation(2 tests): verifies SAMMM:Z(.and?modes across+/-strands, trailing-comma rejection, and mixed?/.series isolation) andML:B:Ccis-CpG (±200 bp) 5mC+5hmC extraction (ReadCisCpGIndex).- Structural Variants & Variation Models (
sv/&variations/— 74 tests): sv(34 tests): verifies discordant mate-pair clustering (is_overlap,check_cluster),SA:Zsupplementary split-read SV chaining and normal somatic veto (svlen<INS>discrimination &min_readsdepth reconciliation),COMPAT_OFFUB-6mark_dup_sv_inclusive_endpre-decrement boundary marking,sv_respect_min_len-L(--min-sv-len) discordant suppression and boundedMAX_EXPLICIT_SV_SEQ_BP(32,768bp) explicit sequence materialization (AstraZeneca-NGS/VarDictJava#328),reconcile_strand_and_hq_sumsSV accumulator clearing,adaptor_all_consensus_dirsdir = 5/3soft-clip screening,canonical_sv_vcf_anchoringpre_anchored_duptagging,sv_lazy_mate_pileupseededbam_piled_spans/Side::Threemerge_plantedlazy mate-window pileups, andmerge_variation_entry/ ref-subtraction Welford(p_m2, q_m2)conservation,-r(min_reads)u32/i32overflow hardening, single-BAM colon-path preservation infind_all_sv_paths, inversion anchor clustering (find_inv_sub), \(5'\)/\(3'\) inversionvref.cntpreservation, \(5'\) candidate deletion post-decrement coverage lookup (test_find_sv_5prime_deletion_uses_post_decrement_p5_plus_1_ref_coverage), upfrontSOFTP2SVSclipSlotlive.usedmutation visibility and safeBTreeMaprange helpers (test_softp2sv_slot_map_live_used_mutation_and_max_rl_zero_ranges), soft-clip unused state preservation (sync_sclip_after_conseqintest_find_sv_5prime_deletion_uses_post_decrement_p5_plus_1_ref_coverage,test_find_sv_inversion_accumulates_existing_variation_count,is_best_sv_used_follows_java_string_hash_order), and short soft-clip deletionSEED_2retries.variations(40 tests: 10 invariations::tests, 14 invariations::debug_tests, 16 invariations::util): verifies candidate variant filters (is_good_var),Variation::reset_counts_compat&Variant::adj_complex_compat, Chan parallel Welford (p_m2,q_m2) merge/downdate (continuous_pstd_qstd), commutativePhaseSetCountstop-3 coalescing & Misra–Gries majority retention,ReadOrientation(F1R2/F2R1/duplex_cnt) accumulation and rebalancing,Variant::canonical_left_align(Tan et al. 2015Algorithm 1),sclip_majority_count_firstcount-first consensus tie-breaking,approx_heap_bytesaccounting,debug_variants_contentround_half_evenformatting, low-complexity sequence masking, strand bias counters,COMPAT_OFFexact_35_overlapoverhang assembly rescue, and lockstep soft-clip consensus sequence finding.- Coordinates, Tiling & Reference (
types,regions,reference— 47 tests): types(11 tests): verifies strict 0-based (Pos0) to 1-based (Pos1) coordinate translations and stack-buffered banker's rounding (round_half_evenandCOMPAT_OFFround_half_even_compatexact binary ties) edge cases.regions(21 tests): verifies BED parsing (read_bed_lines.gz/.bgz/BOM/\r\r\n,MAX_BED_BYTEScap, control-character/NUL rejection, single-passdetect_amplicon_bed_from_lines&parse_bed_from_lines),resolve_preset_col_gene(--preset wgs|wes|amplicon|ctdna|hifi|ont), rightmost-colon-RGRCh38HLA-A*01:01:01:01contig parsing, 5/6-column default-index warnings, 0-based vs 1-based BED flags (-z), segment column resolution, tile-halo boundary coverage, and genomic-span-bounded (MAX_UNSPLIT_BATCH_BP = 32,768) same-chromosome tile batching (batch_tiles).reference(15 tests): verifies uncompressed and BGZF-compressed (.fa.gz+.fai+.gzi) FASTA subsequence fetching (test_fetch_subsequence_and_get_reference, companion.fai/.gziresolution,read_validated_fai_index& hostile.gzivalidation, and process-wideOnceLockSharedFastaMetamulti-thread coalescing +FastaFileStamprewrite invalidation), quantized>= 64 KiBinterval-subtractedONT-ULoverhang FASTA loading and cross-seam stitching (ensure_overhang_reference_loaded/contiguous_or_stitched_slice), colon-containing contig resolution,site_end\(17\text{-bp}\)SEED_1lookahead truncation (seed_map_and_get_reference_match_legacy), lazy seed-map indexing (test_lazy_seed_map_defers_indexing_until_queried,index_sequence), fused(SEED_1, SEED_2)SeedKey::pair_17_12extraction,AstraZeneca-NGS/VarDictJava#393missing.faicontig and past-end coordinate bounds rejection (fetch_subsequence_past_end_is_err), and k-merseedmapindexing (seedmap).- Utilities (
util/— 16 tests): - Verifies safe slice extraction, bounds-checked negative-index character lookup,
itoainteger formatting helpers (push_i32), reverse complementation, and arithmetic overflow protection. - Streaming Execution & Concurrency (
runner,bam— 65 tests): runner(12 tests): verifies worker thread panic catching without process hang, 16 MiBWORKER_THREAD_STACK_FLOOR_BYTESfloor (and automatic 64 MiB stack sizing on.craminputs) respectingRUST_MIN_STACK, unweighted4 * num_threadsdispatch-window bounding alongside non-starvingFlowStatebyte-weighted pending-output throttling (MAX_PENDING_BYTES = 64 MiB,MAX_PENDING_BATCHES = 262,144), batched tile execution, and deterministic sorted output.bam(53 tests): verifies SAM/BAM/CRAM decoding,SA:Z/HP:i/PS:i/MM:Z/ML:B:Cauxiliary tag extraction,Switch 42(consensus_bam_compat)cD/aD/bD/MIconsensus tag decoding across BAM/CRAM/SAM (including CRAM duplicate-tag last-seen-wins parity) andMI-keyed-tDupKeypreservation, Picard<stem>.bai/<stem>.csi/<stem>.craiand canonical symlink index resolution, pre-validated.bai/.csiheader and count bounds (MAX_BAI_BYTES/MAX_CSI_BYTES), colon-containing contig BAM queries, bounded512 MiBContigSlotCRAM reference cache with tile-scopedCramContigPinGuard(pin_cram_contig_for_spec) andIndexedCraislice seek, CRAM container/slice header bounds & windowed buffered landmark validation,16 MiBMAX_CACHED_CRAM_CONTAINER_BYTESper-container decoded-record heap cap across4 × 4slots (4shards ×40 MiB=<= 160 MiBviaMAX_SHARD_CACHED_CRAM_BYTES) with per-key singleflight container decode coalescing (cram_container_cache_coalesces_concurrent_decodes), epoch-guarded 2-slot thread-localBamMeta/CramMetacaching andclear_bam_caches()dual-Releaseinvalidation,<= 4096 BreusableBamFeedInnerstashes, multi-BAM per-file duplicate-set reset (reset_for_next_bam),(u32, i32, u32)-tduplicate tuple keys andCOMPAT_OFF--eqx(=/X) unmapped-mate CIGAR coalescing +get_aligned_length_compat, soft-masked lowercase CRAM base uppercasing (fill_from_alignment_record_uppercases_soft_masked_cram_bases), omitted CRAMNMreconstruction (compute_cram_nm_reconstructs_edit_distance_when_omitted_by_cram), 32-shardCachedBgzfReaderblock caching, CIGAR query-consumption validation against SEQ length, non-advancing text SAM CIGARErrloop termination, and corrupt record rejection.- Singletons, Finalization & Core Integration Suites (
javamap,config,counters,tovars,tests,tests/corpus_parity.rs,tests/engine_behavior.rs,tests/amplicon_stream_mem.rs,tests/cram_stack.rs— 126 library + 180 integration tests): javamap(29 tests): verifiesJavaHashMapOpenJDK 8+ hash bucket spread, compactJavaHashMap<i32, Vars>layout andinto_entriesmove extraction,IterExactSizeIteratorand cloning withoutK: Clone, V: Clone,java_hashmap_key_orderdelegation, arena node free-list reuse, binning, andTreeNodeRed-Black bin treeification, balancing,moveRootToFront,removeTreeNodepointer-topology untreeification, andsplit(UNTREEIFY_THRESHOLD = 6) against real Java oracle traces.config(14 tests): verifies configuration,WorkflowPreset/Config::from_preset(--preset wgs|wes|amplicon|ctdna|hifi|ont),OrientationBiasConfig/parse_orientation_bias_spec,NoiseModelConfig/parse_noise_model_spec,CompatTarget/CompatProfile(COMPAT_VARDICTJAVA_1_8_3& all 49COMPAT_OFFswitches,only_switch,without_switch,from_mask),af_threshold_rawsanitization, andVcfThresholdvalidation.counters(2 tests): verifies thread-local diagnostic counter accumulation and zero-overhead non-debug builds.tovars(37 tests): verifies candidate variant finalization,F1R2/F2R1/duplex_cntvariant finalization (includingu128overflow-safeclamp_orientation_pair_u64),drain_vars_intoexact single-allele capacity reservation, doomed sub-min_readsPhase-2build_aligned_variants_prunedreference pruning while conservingaligned_variantskeys, single-positionbuild_vars_at_position_with_ref_mode, sparse copy-on-write overlay parity, andCOMPAT_OFFAstraZeneca-NGS/VarDictJava#342<DUP>+AstraZeneca-NGS/VarDictJava#292-33'-shifted allele normalization +canonical_sv_vcf_anchoring1-bp upstream SV anchoring (including isolated<dup-N>normalization) +sv_respect_min_len-Lexplicit<DUP>/<INV>sequence materialization (AstraZeneca-NGS/VarDictJava#328) +indel_only_shift3equal-length substitutionSHIFT3=0clamping +insertion_hicov_and_local_amp_dp(Switch 43)insertion_variationshicov& localposition + 1&-DP+continuous_pstd_qstd(Switch 48) Welfordpstd_sd/qstd_sd+nonnegative_subtracted_means+reconcile_strand_and_hq_sums+reconcile_rd_vd_dp+sanitize_iupac_alt_alleles+pileup_preserve_shifted_ref+exact_binary_half_even5e-5tie rounding +reconcile_vd_dp(AstraZeneca-NGS/VarDictJava#92,AstraZeneca-NGS/VarDictJava#386,AstraZeneca-NGS/VarDictJava#400) +coordinate_sorted_vars(UB-3/AstraZeneca-NGS/VarDictJava#282).- Root library tests (44 tests): verifies splice-tile and mate-window ownership, unsorted
-text_feedhalo deduplication, genericSplitVarDeduper<P>(200 kbpcross-tile.varand--vcf-all-allelesboundary retention andflush_before_unsplit_tile), flattened single-pool250 kbpbandmax_read_lengthpre-scan (COMPAT_OFF--eqx=/Xandcigar_strip_outer_hard_clips<N>[HP]aware) +u64live_duprateparent counts and lazy 2-bitACGT+'N'side-map 12-mer indexing (test_multi_band_prescan_and_lazy_seed12_index_parity&BoundedParentRefScanner65,536 bplong-read overhang loading),SpillableVcfAccumulator(8 MiBdisk-backed whole-stream VCF spill bound, associative multi-allele and single-allelemulti_sv_bucketsdisk spill/merge,--output-parent spill directory placement withstd::env::temp_dir()fallback,0700/0600private spill tempfiles,SingleVcfEventspill round-trip & corrupt tag/span rejection, and forced-1B-spillSingleRecordStreamer/PairedRecordStreamercross-tileClusterNbpconservation),DirectTempStaged/O_NOFOLLOW0555read-only-parent output staging, Tabix and CSI (Indexer::<LinearIndex>::new(14, 6)->Index<BinnedIndex>clintval/vartovcf#161+ acrocentric leading-zero window backfill) SVEND=indexing and input-collision/BGZF-residue/FD-alias/corrupt-ENDguards, paired somatic ampliconrun_somatic_amplicon(COMPAT_OFFpaired_somatic_amplicon), somatic BAM1-to-BAM2spliceset inheritance, upfront tumor/normal BAM specification validation, empty-ref winner suppression, amplicon covering-position streaming, and adaptive region tile sizing (test_effective_tile_size_untiled_up_to_1mbp_and_100kbp_above_1mbp). tests/corpus_parity.rs(110 tests): verifies all 92 upstream integration test cases, 17 extended calling modalities (Simple,Somatic,Amplicon,Splicing, CRISPR,<INV>,<DUP>, and CLI flags), and corpus manifest completeness directly in-process viavardictrust_core.tests/engine_behavior.rs(65 tests): verifies CRAM soft-masked base normalization andNMreconstruction (cram), somatic Fisher 61-column output (fisher),-f 0vs-f 0.0/-f 0.050/-f 1e-5/-f .01VCF threshold filtering (vcf_filters),<DUP>, \(5'\) deletion, and<INV>structural variants (structural_variants), pileup and filtering modes (filtering_and_pileup),AstraZeneca-NGS/VarDictJava#378paired-BAM +-adefaultSomaticModevs--compat=offpaired amplicon dispatch contract, hostile input resilience includingAstraZeneca-NGS/VarDictJava#402malformed CIGARs, missing.baiindices,AstraZeneca-NGS/VarDictJava#393.faibounds, andAstraZeneca-NGS/VarDict#1723'_UTRBED annotations (hostile_inputs), multi-thread tiled-vs-untiled conservation across.var,.vcf, SV, and-isplice outputs (concurrency), audited Java/Perl parity edge cases (parity_edge_cases), CI-portable Perl-A(var2vcf_{valid,paired}.pl -A) differential equivalence across Simple/Amplicon/Somatic modes,--amplicon-single-primer(-sp),--preset wgs|wes|amplicon|ctdna|hifi|ontBED/region/paired-Q20guards,--orientation-bias[=annotate]onSEQC224h FFPE &fgumiduplex, long-readHG002HiFi/ONT-UL&HG008-TONTscaling,SA:Z<DEL>/<DUP>/<INV>/<INS>chaining + split-tile seam lookback + foldback-hairpin rejection + normal veto,HP:i/PS:iHapBias,--methylationcis-CpG ASM/DMR,--noise-model[=MAX_ERRP|annotate|off]PolymerNoise, and all 49COMPAT_OFFswitches including the exhaustive(only_i, loo_i)4-law isolation matrix, split-tile seam/spill parity, portableBAM == CRAMtwin parity, acrocentric--csibackfill (vcf_all_alleles_and_compat_off), Wave-7 committed-BAM confinement (compat_wave7_switches_39_to_41_committed_bams_real_data_confinement), Wave-8Switch 46end-to-endMSI12/paired-LOH preservation, andSwitch 49bcftools concat/normSV/BND interop.tests/amplicon_stream_mem.rs(2 tests): verifies bounded memory on huge amplicon intervals across standard-aand-a -ppileup modes.tests/cram_stack.rs(3 tests): verifies 64 MiB Rayon worker stack sizing fornoodles-cramrANS decoding, single-threadrun_with_worker_stacksurvival on a 2 MiB caller thread (run_single_thread_survives_2mib_caller), and CRAM-vs-BAM somatic parity.
3.2 crates/vardictrust (38 Unit Tests)¶
Located in crates/vardictrust/src/cli.rs (32 tests), crates/vardictrust/src/completions_man.rs (1 test), crates/vardictrust/src/profile.rs (2 tests), and crates/vardictrust/src/main.rs (3 tests, including malloc_conf_target_split_and_nul_termination and C0/C1/OSC sanitize_for_terminal neutralization):
- Verifies CLI argument parsing via clap, including Commons-CLI single-dash long-flag normalization (-sp, -adaptor, -crispr, -fisher, -deldupvar, -nosv, -splice, -chimeric, -dedup, -amplicon, -trim, -VS, etc.), hidden vardictcpp v2..v4 aliases (--vcfall, --noend, --vcfpass, --vcf), and boolean-prefix short-option cluster splitting (-pz, -uk, -ua, -pR).
- Thread count resolution: verifies explicit -th 4, bare -th / --threads (including positional-BED-safe -th <bed> and Commons-CLI duplicate first-wins parity), RAYON_NUM_THREADS fallback when -th is omitted (otherwise all cores), and -th 0 normalization to 1 core.
- Verifies header flag -h prints table headers (and does not trigger help), while -H / -? / --help render the 7-section grouped CLI help screen.
- Verifies --completions <SHELL> (bash, zsh, fish) and --manpage (roff vardictrust(1)) generation, --output / --tbi (--index) / --csi / --no-end / --stats-json / --parity / --compat vardictjava|off / --preset wgs|wes|amplicon|ctdna|hifi|ont validation, --amplicon-single-primer / -sp, all consolidated var2vcf post-filter and threshold options across the 95-flag CLI surface (7 functional groups: --pass-only, --paired-strict, --vcf-all-alleles / --all-alleles, --orientation-bias, --noise-model, --methylation, --vcf-pval, --min-splitreads, --no-pstd-filter, --vcf-af, --vcf-min-depth, --vcf-min-vd, --vcf-qmean, --vcf-mapq, --vcf-pmean, --vcf-sn, --vcf-max-nm, --vcf-gt-freq, --vcf-msi, --vcf-cluster-dist + single-dash GNU typo guards), newly ported upstream flags (-T / --trim, -n, -VS SILENT|LENIENT), accepted upstream compatibility flags (-v, --default-printer), multi-sample BAM header extraction (-b "b1|b2"), and value-aware UNSUPPORTED_FLAGS / unsupported-mode rejection (-C, -Z / -downsample / --downsample, and -VS STRICT via AGENTS.md §12, plus invalid --compat modern target rejection in parse_compat_target).
- Verifies error propagation on invalid flag arguments (-F bogus, 0-valued -c/-S/-E/-s/-e BED columns, -d empty, --adaptor non-ACGTN) and zero tile size (--tile-size 0).
3.3 CLI Integration Test Binaries (crates/vardictrust/tests/ — 36 Tests)¶
Located in crates/vardictrust/tests/:
1. tests/profile_smoke.rs (3 default tests + 4 feature-gated tests):
- Verifies VARDICT_PROFILE_CPU, VARDICT_PROFILE_HEAP, and VARDICT_PROFILE_DHAT environment-variable activation in profile::Session::start(), empty-path fail-fast validation (<VAR> must be a non-empty directory path), compiled-out stderr warnings with zero files created in default builds, and artifact generation (cpu-collapsed.txt, cpu-profile.pb, cpu-meta.json, cpu-flamegraph.svg, heap.pb.gz/heap.pb, heap-flamegraph.svg, dhat-heap.json) when compiled with opt-in profiling features.
2. tests/robustness.rs (32 tests):
- locale_independence_c_vs_de_de_on_micro_bam: verifies that floating-point numbers are emitted with standard decimal points (.) rather than European decimal commas (,) even when LC_ALL=de_DE.UTF-8 is forced.
- unsupported_and_invalid_cli_flags_exit_nonzero: verifies that --tile-size 0, malformed SAM filter flags (-F bogus), and invalid CLI flags fail fast with actionable non-zero exit codes.
- dp_err_and_default_printer_route_to_stderr: verifies that diagnostic printer messages route strictly to stderr without contaminating stdout VCF output.
- verbose_flag_y_emits_region_debug_to_stderr: verifies that -y region debug traces emit cleanly to stderr.
- jemalloc_startup_emits_no_stderr_warnings: verifies that _rjem_malloc_conf startup emits zero allocator warnings on stderr, vardictrust --version reports pure License: MIT, and corrupt/truncated BGZF BAM streams fail with an actionable UnexpectedEof error.
- upstream_toml_manifest_present_and_pinned: verifies UPSTREAM.toml pins VarDictJava v1.8.3 (0886261), VarDict (009e017), and vardictcpp 3 (hc52dbad_0).
- output_plain_and_bgzf_match_stdout_and_stats_json_emits_telemetry: verifies --output plain/BGZF .vcf.gz output parity with stdout and --stats-json telemetry emission.
- output_bgzf_tbi_and_parity_compat_flags: verifies --tbi / --csi index creation alongside --parity and --compat (vardictjava / vardictjava-1.8.3 / 1.8.3) byte-identical parity acceptance and invalid --compat modern target rejection.
- broken_pipe_stdout_and_stderr_exit_cleanly_and_preserve_stats_json: verifies clean exit 0 on SIGPIPE / BrokenPipe (stdout and -y stderr) while still flushing --stats-json.
- output_and_stats_json_reject_input_collisions_and_leave_no_empty_residue: verifies --output, --tbi, and --stats-json reject paths colliding with inputs or each other and leave zero empty output/BGZF residue on failure.
- bgzf_tbi_somatic_amplicon_and_sv_end_to_end: verifies end-to-end .vcf.gz + .tbi generation and Tabix region queries across somatic, amplicon, and <DEL>/<INV>/<DUP> structural variants (END= span indexing).
- hostile_missing_qual_huge_deletion_and_i32_min_tlen_do_not_panic_or_oom: verifies hostile records (* missing QUAL, 268435455D huge deletions, i32::MIN TLEN) never panic or OOM.
- commons_cli_single_dash_flags_and_zero_bed_col_behavior: verifies Commons-CLI single-dash long flags (-fisher, -nosv, -adaptor), single-dash -vcf-* typo rejection, and 0-valued -c/-S/-E/-s/-e BED column rejection.
- vcf_threshold_overrides_and_cluster_streamer_e2e: verifies all 11 decoupled --vcf-* filter thresholds across Simple, Amplicon, and Paired Somatic modes (--vcf-af, --vcf-min-depth + paired pSTD, --vcf-min-vd, --vcf-qmean, --vcf-mapq 0, --vcf-pmean, --vcf-sn, --vcf-max-nm, --vcf-gt-freq, --vcf-msi, --vcf-cluster-dist + --pass-only + AMPBIAS probe + SV splitreads flush across multi-tile boundaries).
- high_min_reads_and_hla_colon_contig_bed_and_region_e2e: verifies -r 2147483645 no-panic overflow hardening and GRCh38 HLA-A*01:01:01:01 variant calling via both BED and -R "HLA-A*01:01:01:01:1-60".
- compressed_fasta_bed_companion_index_and_fd_stream_safety_e2e: verifies BGZF -G .fa.gz + .fai + .gzi parity across BAM and CRAM, plain-gzip/hostile .gzi fail-fast, extensionless & <stem>.fai contigs, .bed.gz/.bed.bgz/BOM/FIFO single-pass BEDs, Picard <stem>.bai & symlinked BAM companion indices, --output - / /dev/fd/3 / /dev/stdout (>>) / symlink-to-FD-alias safety, /dev/null pair exemption, safe AsFd default-FD collision guards, BGZF .var.gz/.tsv.gz parity, and early --completions/--manpage dispatch.
- malformed_fai_invariants_and_contig_injection_fail_before_vcf_header: verifies malformed .fai records (line_base_count > line_width, i64::MAX end-offset overflow, and comma/angle-bracket/control-character contig IDs) exit cleanly before emitting any partial VCF header bytes.
- spoofed_cram_container_length_and_slice_record_count_fail_cleanly_single_thread: verifies truncated CRAM containers, i32::MAX container lengths, and spoofed SliceHeader record counts fail cleanly under -th 1 without panics or multi-GiB allocations.
- cli_and_bed_control_char_rejection_sam_eq_bases_and_colon_bam_sv_success: verifies -G/-R/-N/BED control/NUL injection rejection while preserving SAM = (Seq::Eq) reference-match bases and colon-containing single-BAM SV paths (chr17:100-200.bam, colon:sample.bam).
- stderr_neutralizes_ansi_osc_and_c1_escapes_on_clap_and_runtime_errors: verifies C0/OSC (\x1b]52;c;...\x07) and C1 (\u{9b}) terminal escape neutralization on fatal clap and runtime stderr exits.
- readonly_parent_direct_temp_staged_and_nofollow_symlink_rejection: verifies 0555 read-only-parent DirectTempStaged / DirectPinned output commits and O_NOFOLLOW symlink rejection without mutating symlink targets.
- output_bgzf_without_index_cleans_stale_sidecars_and_preflights_hazards: verifies overwriting .vcf.gz without --tbi/--csi removes stale .tbi/.csi sidecars (including bare relative filenames in CWD) while rejecting directory/colliding sidecars and 0555 unremovable stale sidecars in preflight before modifying target bytes.
- threads_flag_positional_bed_and_commons_cli_duplicate_parity: verifies bare -th/--threads before positional BED (-th micro.bed, -th micro.bed -N SAMPLE1, -th 2 -th micro.bed) and Commons-CLI duplicate -th 2 -th bogus micro.bed first-wins parity vs -th bogus micro.bed rejection.
- vcf_all_alleles_and_compat_off_bgzf_tbi_and_csi_e2e: verifies --vcf-all-alleles / --all-alleles + --compat=off (##VarDictRustCompat=off, bijective INFO/SAMPLE, mixed X/chrX contig preservation, and UB-5 discordant-only <DUP> emission vs --compat=off --min-splitreads 1 override) with BGZF --output and noodles::tabix (.vcf.gz.tbi) / noodles::csi (.vcf.gz.csi) index round-tripping.
- wave3_cli_fai_bounds_393_and_bed_apostrophe_172: verifies end-to-end CLI handling of AstraZeneca-NGS/VarDict#172 4-column BED 3'_UTR apostrophes (across both R-port stats::hypergeom and --fisher modes) and AstraZeneca-NGS/VarDictJava#393 past-end / missing-contig .fai bounds fail-fast without panicking.
- wave4_vardictcpp_cli_aliases_and_paired_amplicon_cram_tbi_csi_stats_e2e: verifies hidden vardictcpp v2..v4 CLI aliases (--vcfall, --noend, --vcfpass, --vcf + conflict guards) and end-to-end paired somatic amplicon .cram (tumor_spe.cram|normal_spe.cram) + 8-col QIAseq SPE BED + --compat=off -a 10:0.95 -sp --vcfall --fisher --output .vcf.gz --tbi / --csi + --stats-json.
- csi_spanning_sv_returned_across_leaf_bins, csi_above_512mbp_spanning_sv, csi_empty_header_only_vcf_gz, and index_rejects_unsorted_pos_split_contigs_and_bad_end: verify multi-BGZF-block --csi linear-index loffset propagation across 16,384-bp leaf-bin boundaries (clintval/vartovcf#161), > 512 Mbp chromosome spanning SVs, header-only .vcf.gz CSI generation, and fail-fast VardictError::Parse rejection of unsorted POS, revisited contigs, and malformed/overflowing INFO/END tags.
- workflow_presets_cli_end_to_end: verifies end-to-end --preset wgs|wes|amplicon|ctdna|hifi|ont and --orientation-bias[=MAX_AF:MIN_SOB:MAX_OBP|annotate] CLI execution on real git-tracked sequencing BAMs and verbatim fgumi/SEQC2/GIAB real-read tuples (##VarDictRustPreset=<PRESET>, BED3/BED4 3'_UTR/custom-column/UCSC-BED8/8-col -sp/paired somatic amplicon Q20 deduplication, explicit CLI overrides, --completions, --manpage, and non-panic fail-fast rejection on unknown presets, -preset, -orientation-bias, and conflicting flags).
3. tests/version.rs (1 test):
- version_credits_original_and_discloses_ai: verifies that vardictrust --version displays the exact package version (env!("CARGO_PKG_VERSION")), pure License: MIT SPDX metadata, original author credit (Zhongwu Lai et al. 2016, AstraZeneca-NGS), upstream commit pins (0886261 / 009e017), and full AI tooling disclosures.
4. Level 2: Upstream Integration Regression Corpus & UB-4 Audit Defense¶
When executing Level 2 integration regression testing via harness/run_integration.sh, the test runner outputs:
PASS: 91 XFAIL: 1 FAIL: 0 SKIP: 0 XPASS: 0
XFAIL: Simple;hard_clip_case.fa;hard_clip_next_to_del_test2.bam;test;6434-6564;-f 0.0 -p -r 1.txt (UB-4 upstream fixture defect, verified against live-oracle signature)
An uninformed external reviewer might interpret FAIL: 1 as an unaddressed regression in VarDictRust. This section documents the mathematical and biological proof that this mismatch is an upstream fixture defect (Class D / UB-4) and that VarDictRust achieves 100% live oracle parity.
4.1 Provenance of the Upstream Data Defect¶
- Target Fixture:
Simple;hard_clip_case.fa;hard_clip_next_to_del_test2.bam;test;6434-6564;-f 0.0 -p -r 1.txt. - Root Cause: In
VarDictJava/testdata/fastas/hard_clip_case.fa, the reference FASTA sequence for contigtestwas generated by concatenating two overlapping CSV sequence chunks: - Chunk 1:
test,5234..7764 - Chunk 2:
test,5475..8024 - Across the 2,290 base pairs of overlap between these two chunks, 1,734 bases disagree (a 75.7% sequence conflict within the reference fixture itself).
- The Upstream Fixture Split:
- The static expected file for
test2was generated years ago using a FASTA generator that used a first-chunk-wins reconstruction. - The sibling fixture
test1was generated using a last-chunk-wins reconstruction. - Today's upstream script
convert_fastas.pyin VarDictJava implements last-chunk-wins. - Consequently, VarDictJava v1.8.3 itself cannot reproduce its own static expected file today. When live
VarDictJava v1.8.3is run againsthard_clip_case.fa, it fails against its own checked-in.txtfixture with the exact same 34 mismatching lines.
4.2 Proof of 100% Live Oracle Parity¶
When VarDictRust and VarDictJava v1.8.3 are both executed live on hard_clip_case.fa:
- Both engines produce 7 table rows (diff -u exits 0).
- Both engines produce 5 VCF variant records (diff -u exits 0).
- Both engines reproduce the exact -p pileup null-record formatting quirks (UB-1 and UB-2).
- Zero discrepancies exist between VarDictRust and VarDictJava on this fixture.
4.3 Gate Pinning Invariant¶
In harness/pr_check.sh, harness/acceptance.sh, and GitHub Actions CI, the test runner enforces:
grep -qx 'PASS: 91 XFAIL: 1 FAIL: 0 SKIP: 0 XPASS: 0' <log>
grep -qxF 'XFAIL: Simple;hard_clip_case.fa;hard_clip_next_to_del_test2.bam;test;6434-6564;-f 0.0 -p -r 1.txt (UB-4 upstream fixture defect, verified against live-oracle signature)' <log>
91 PASS / 1 XFAIL, the gate fails immediately. Thus, 100% of valid upstream test cases pass.
5. Level 3: Dual-Engine Differential Parity Testing (Tier-2)¶
VarDictRust maintains 16 committed, cryptographically fingerprinted evidence files in benchmarks/evidence/ that certify parity across 17 primary benchmark targets:
| Benchmark Target | Evidence JSON | Modality / Assay | Variant Count | Gate Status | Certified Invariant Fingerprint |
|---|---|---|---|---|---|
| Synthetic Micro | In-line execution | Simple Germline (Synthetic) | 2 | MATCH | 729cf0f46bd30c4b |
| 10 Standard Slices | In-line execution (s1a–s9) |
Germline / Somatic Slices | 100+ | MATCH | 729cf0f46bd30c4b |
| GIAB HG008 Somatic | hg008-tier2.json |
Somatic Paired WGS (PDAC) | 18,426 | MATCH | 729cf0f46bd30c4b |
| GIAB HG008 CRAM Twin | hg008-cram-twin.json |
CRAM vs BAM Twin Parity | 18,426 | MATCH | 729cf0f46bd30c4b |
| SEQC2 Somatic Exome | seqc2-exome-tier2.json |
Somatic Paired WES (HCC1395) | 623,444 | MATCH | 729cf0f46bd30c4b |
| SEQC2 Somatic Slices | seqc2-slices-tier2.json |
Multi-Chr Slices (chr1-21) | 4,151 | MATCH | 729cf0f46bd30c4b |
| GIAB HG002 Germline | hg002-tier2.json |
Germline WGS (chr20 20 Mbp) | 227,562 | MATCH | 729cf0f46bd30c4b |
| Targeted Amplicon | amplicon-tier2.json |
Overlapping Primer Panel | 2 | MATCH | 729cf0f46bd30c4b |
| Extended Modalities | extended-coverage-tier2.json |
17 Modes (RNA, SVs, All Supported Flags) | 4,993 | MATCH | 729cf0f46bd30c4b |
| Multi-Modal Slices | multimodal-slices-tier2.json |
18 Slices across 6 Cohorts | 1,129 | MATCH | 729cf0f46bd30c4b |
| GIAB HG002 Truth | hg002-truth.json |
NIST v4.2.1 High-Confidence | \(F_1 = 0.9699\) | EQUAL | 729cf0f46bd30c4b |
| SEQC2 Somatic Truth | seqc2-truth.json |
SEQC2 v1.2.1 Somatic Truth | \(F_1 = 0.1555\) | EQUAL | 729cf0f46bd30c4b |
| GIAB HG008 Truth | hg008-truth.json |
NIST Draft v0.3 Somatic Truth | \(F_1 = 0.3856\) | EQUAL | 729cf0f46bd30c4b |
| GIAB HG005 Truth | hg005-truth.json |
NIST v4.2.1 Han Chinese WGS | \(F_1 = 0.9667\) | EQUAL | 729cf0f46bd30c4b |
| GIAB NA24385 b37 Truth | na24385-b37-truth.json |
NIST v4.2.1 Ashkenazi Son b37 | \(F_1 = 1.0000\) | EQUAL | 729cf0f46bd30c4b |
| Chr1 Scale Benchmark | scale.json |
Chromosome 1 Full Scaling | \(S_8 = 3.04\times\), RSS \(1.27\times\) | PASS | 729cf0f46bd30c4b |
| Continuous Perf Budget | perf-budget.json |
5 Target Workload Regression | Wall/RAM gates | PASS | 729cf0f46bd30c4b |
| Musl CI Distribution | musl-ci.json |
Static PIE Linux Packaging | Byte identity | PASS | 729cf0f46bd30c4b |
Store-Served Oracle Baselines & Golden Provenance¶
To guarantee fast, deterministic regression testing without repeatedly executing static oracle pipelines across test cycles, Level 3 oracle arms are routed through the Golden Baseline Store (harness/golden_store.sh). Pinned outputs for immutable reference implementations (VarDictJava v1.8.3 and vardictcpp hc52dbad_0) are keyed cryptographically by wrapper SHA, conda environment pin, input file hashes, and normalized execution arguments. Differential comparators (compare.sh, compare_vcf.py, compare_var.py) and evidence stamping mechanisms remain identical whether an oracle output is generated live or replayed from a verified store cell. All benchmark evidence JSON records capture complete store transaction telemetry under the extra.golden provenance block (run, hit, live, and event ledgers), certifying whether oracle comparisons were served from the baseline cache or executed live.
6. Level 4: Ground Truth Concordance Benchmarking (Tier-3 / GIAB / SEQC2)¶
A foundational question in scientific verification is: Why are certain datasets evaluated under Level 3 Live Oracle Parity while others are also evaluated under Level 4 Biological Ground Truth Concordance?
- Level 3 (Dual-Engine Differential Parity Gate, Tier-2): Evaluates whether \(\text{VarDictRust} \equiv \text{VarDictJava v1.8.3}\) on valid inputs (\(\varepsilon \le 10^{-6}\), 0 variant diffs). Requires only reference FASTA and input BAM/CRAM. Can and must be run on 100% of sequencing datasets. Pinned vardictcpp 3
hc52dbad_0(bioconda, samevardict-oracleenv) runs beside each Level 3 arm as an advisory third arm (never gating;CPP_SKIP=1escapes it). - Level 4 (Ground Truth Concordance Gate, Tier-3): Evaluates variant calling performance (\(F_1\), Precision, Recall) using
rtg vcfevalagainst physical biological reality. Requires independent consortium ground truth VCF + high-confidence BED.
The rewrites.bio Principle of Transitivity:¶
For any dataset \(D\) and benchmark truth set \(T\) under default --compat=vardictjava (--parity) execution:
$\(\text{VarDictRust}_{\text{compat=vardictjava}}(D) \equiv \text{VarDictJava}(D) \implies \text{rtg}\!\left(\text{VarDictRust}_{\text{compat=vardictjava}}(D), T\right) \equiv \text{rtg}(\text{VarDictJava}(D), T)\)$
Because VarDictRust in default --compat=vardictjava mode produces 0 variant discrepancies and 0 filter differences compared to VarDictJava, rtg vcfeval yields 100% identical True Positives, False Positives, False Negatives, and identical \(F_1\) scores (0 site diffs). Level 4 proves biological equivalence to the original caller (while opt-in --compat=off switches are verified via targeted diff-confinement gates).
| Dataset / Assay | Modality & Reference Build | BAM / CRAM Source | Level 3 (Differential Parity) | vardictcpp (advisory) | Level 4 (Truth Concordance) | Reason / Ground Truth Asset |
|---|---|---|---|---|---|---|
| GIAB HG002 Euchromatic WGS | Germline WGS (GRCh38) | Illumina NovaSeq 125× (20 Mbp) | RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-9) + CPP-1; F1 raw 0.6624 (CPP-6) | RUN (EQUAL, \(F_1 = 0.9699\) at QUAL >= 128; raw 0.6622) |
NIST GIAB v4.2.1 High-Confidence Benchmark |
| FDA SEQC2 HCC1395 Somatic | Somatic WES (GRCh38) | Whole Exome (300×/100×) | RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-9); F1 0.1555 (CPP-6) | RUN (EQUAL, \(F_1 = 0.1555\)) | FDA SEQC2 v1.2.1 High-Confidence Somatic Truth |
| GIAB HG008 Somatic PDAC | Somatic WGS (GRCh38) | Tumor/Normal WGS (195×/169×) | RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-9); F1 0.3858 (CPP-6) | RUN (EQUAL, \(F_1 = 0.3856\)) | NIST Draft Somatic Benchmark v0.3 |
| GIAB HG005 Han Chinese | Diversity WGS (GRCh38) | Slices s4a/b/c (chr3, 6, 21) |
RUN (MATCH, 0 diffs) | advisory F1 raw 0.9508 (CPP-6) | RUN (EQUAL, \(F_1 = 0.9667\) at QUAL >= 226; raw 0.9508) |
NIST GIAB v4.2.1 Han Chinese Trio Benchmark |
| GIAB NA24385 b37 WGS | Germline WGS (GRCh37/b37) | Multi-chr WGS (chr1, 19, 20) | RUN (MATCH, 0 diffs) | advisory F1 raw 0.1099 (CPP-6); b37 CPP-7/CPP-8 | RUN (EQUAL, \(F_1 = 1.0000\) at QUAL >= 160; raw 0.1099) |
NIST GIAB v4.2.1 Ashkenazi Son (b37 build) |
| SEQC2 Somatic Slices | Somatic WES (GRCh38) | chr1, 2, 3, 17, 19, 21 slices | RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-1) | RUN (EQUAL, 0 site diffs) | FDA SEQC2 v1.2.1 Sub-Regions |
| Targeted Amplicon Panel | Amplicon Assay (hg19) | EGFR L861Q primer panel | RUN (MATCH, 0 diffs) | advisory SKIP (CPP-3) | Methodologically Ineligible | Targeted primer assay testing AMPBIAS; no diploid NIST truth VCF |
| RNA-seq Splicing Introns | Transcriptome (GRCh38) | STAR spliced BAM (chr8) | RUN (MATCH, 0 diffs) | advisory SKIP (-i splice-table unsupported) | Methodologically Ineligible | Tests exon-intron junctions (-i); rtg vcfeval rejects non-DNA features |
| Hartwig COLO829 / COLO829BL | Somatic WGS (GRCh37) | Tumor/Normal (s1a/b/c) |
RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-1); s6 SKIP (CPP-3) | Methodologically Ineligible | Structural variant benchmark (Valle-Inclan 2022); no diploid small-var VCF |
| COLO829 CRISPR Target | CRISPR Cut Site (GRCh37) | Illumina HiSeq WGS | RUN (MATCH, 0 diffs) | advisory M4 MISMATCH (CPP-2) | Methodologically Ineligible | Targeted cut site (\(50,454,941\)); evaluates CRISPR offset -J/-j |
10 Standard Slices (s1a–s9) |
Micro-Slices (GRCh38/b37) | Integration slices | RUN (MATCH, 0 diffs) | advisory MISMATCH (CPP-1); b37 CPP-7/CPP-8 | Covered by Parent Truths | Slices derive from SEQC2/HG002/Colo829 |
| 92 Integration Corpus Fixtures | Synthetic / Corner Cases | Upstream test cases | RUN (100% Live Oracle) | advisory per-fixture lines; concat-flags SKIP (CPP-4) | Methodologically Ineligible | Miniature synthetic alignments testing CIGAR parser edge cases |
7. Level 5: Continuous Performance & Memory Budgets¶
Level 5 guarantees that VarDictRust delivers decisive scaling improvements over VarDictJava while preventing memory regressions:
- Whole-Chromosome Scaling (
harness/scale_bench.sh): - Evaluated across all 249 Mbp of human chromosome 1 on HCC1395 (
SCALE_CPUS=0-7/taskset -c 0-7, \(P = 4\) physical cores under pin). - Enforces the signed host-class 8-thread parallel speedup bar \(S_8 \ge \text{bar}(P) = 0.6 \times \min(8, P) = 2.4\times\) (achieved 3.04× (8 threads vs 1 thread:
85.94svs261.06s3-run median, certified gate ≥ 2.40×)). - Enforces flat resident set size scaling: peak RSS ratio across a 25-fold increase in genomic span (10 Mbp to 249 Mbp) must remain \(\le 1.5\times\) (achieved 1.27× (249 Mbp vs 10 Mbp:
1.39 GiBvs1.10 GiB3-run median, certified gate ≤ 1.50×)). - Five-Target Workload Budget (
harness/perf_budget.py): - Continuous gate comparing wall clock time and peak resident memory against VarDictJava v1.8.3 across 5 core modalities: HG008 somatic WGS, SEQC2 somatic WES, HG002 germline WGS, targeted amplicons, and HG008 CRAM-vs-BAM twin (
cram_to_bam_wall_ratio <= 2.50, achieved2.36×). - Requires \(\text{Runtime}_{\text{Rust}} \le \text{Runtime}_{\text{Java}}\) and \(\text{RSS}_{\text{Rust}} \le \text{RSS}_{\text{Java}}\).
8. Level 6: Diagnostic Self-Tests (harness/run_self_tests.sh)¶
Automated via harness/run_self_tests.sh, these 37 specialized scripts (25 shell tests and 12 Python unit test suites) validate the correctness of the testing infrastructure, documentation rendering, and zero-PyPI environment contracts in \(<10\text{ seconds}\):
The runner dynamically discovers and executes:
1. test_bench_profile.sh: validates that .cargo/config.toml configures [profile.bench] with debuginfo and unstripped symbols (strip = false) for cargo bench without polluting release profiles.
2. test_bioconda_recipe.py: validates the Bioconda meta.yaml and Nextflow nf-core meta.yml packaging schemas, workspace MSRV (rust-version = "1.91.0") inheritance, licenses, .agents/skills/ SDO frontmatter, and release consistency checks.
3. test_compare_sh.sh: validates exit code conventions, diff formatting, and temporary file cleanup in the primary Level 3 differential comparator.
4. test_compare_vcf.py: validates strict-bytes VCF parsing, floating-point half-even rounding tolerances (\(\varepsilon = 10^{-6}\)), and duplicate key detection.
5. test_concordance.sh: validates the Real Time Genomics rtg vcfeval wrapper script, SDF reference building, and concordance metric parsers.
6. test_concordance_sv.sh: tests structural variant concordance evaluating bgzip and tabix index requirements, Truvari execution gating, and summary report parsing.
7. test_courtesy.sh: tests host resource throttling and scheduling guard enforcement (harness/courtesy.sh), validating that resource-intensive benchmarking tasks respect configurable blackout windows (COURTESY_NOW, EST_MIN), minimum available disk headroom (MIN_FREE_GB), and memory thresholds (MIN_AVAIL_GB) without disrupting shared infrastructure.
8. test_docs_ui.py: validates table column consistency, non-HTML angle bracket escaping, KaTeX math hygiene, and Playwright headless Chromium GFM browser rendering across repository documentation.
9. test_edge_cases.sh: tests variant caller handling of 4 BAM boundary conditions: zero-read empty BAMs (empty.bam), zero-coverage target regions, single-read BAMs, and contig boundary alignments.
10. test_env_pinned.sh: validates toolchain version pinning across benchmarks/env/ (vardict-oracle.yml, g4-tools.yml, toolchain.txt).
11. test_evidence.sh: validates JSON schema conformity, fingerprint validation, raw git blob OID hashing in harness/engine_fingerprint.sh, and rejection of stale benchmark evidence in harness/acceptance.sh:ev() and ev_cpp().
12. test_evidence_inputs.py: validates SHA-256 and byte-size provenance manifests inside benchmarks/evidence/*.json.
13. test_fetch_data.sh: validates formatting, URL schemes, and destination paths inside the asset registry (harness/assets.tsv).
14. test_gate_command_parity.sh: verifies command-line argument parity across compound gate runners (rgate.sh, pr_check.sh, recertify.sh, acceptance.sh).
15. test_gcp_paper_runner.sh: validates the end-to-end cloud reproducibility driver (harness/gcp_paper_runner.sh).
16. test_git_hooks.sh: validates harness/setup_hooks.sh, .githooks/pre-commit, .githooks/pre-push, and harness/pr_check.sh syntax, [HH:MM:SS] stage timestamp helpers, thread limits, and Git-2.34-compatible 3-way git merge-tree conflict detection.
17. test_golden_store.py: validates golden baseline store operations including key derivation, locked atomic writes, corrupt artifact detection, tombstoning, and cache hit/miss statistics.
18. test_golden_wiring.sh: performs repository-wide linting to ensure no test harness runner invokes upstream oracles without routing through harness/golden_store.sh.
19. test_linkedin_carousel.py: validates the publication figure and carousel generation pipeline (paper/linkedin/).
20. test_no_gnu_isms.sh: audits harness shell scripts to forbid non-portable GNU-only flags (sed -i, grep -P, readlink -f, stat -c).
21. test_oracle_platform.sh: validates the x86_64 80-bit long double platform guard (harness/run_oracle.sh, harness/compare.sh, harness/golden_store.py).
22. test_oracle_r_canary.sh: validates R fisher.test() 80-bit extended-precision canary checks inside the vardict-oracle environment.
23. test_perf_budget.py: unit-tests harness/perf_budget.py wall-clock, RSS, and cram_to_bam_wall_ratio budget evaluators.
24. test_perf_budget.sh: validates performance budget mathematical formulas on simulated JSON benchmarks.
25. test_perf_pr.sh: validates the per-PR differential performance runner (harness/perf_pr.sh).
26. test_portable_shell.sh: validates POSIX-portable shell helper routines in harness/lib/portable.sh.
27. test_profile_catalog.py: validates harness/profile_catalog.py: dhat/CPU/heap attribution to the innermost vardictrust_core:: frame (never the allocator leaf), the CPU drop fraction, the hand-written pprof protobuf decoder against a real captured heap.pb.gz, root-to-leaf collapsed stacks, relative SVG links, and the inferno-flamegraph hook (skipped when absent, invoked via a PATH stub when present).
28. test_profile_sh.sh: validates harness/profile.sh with stub profiler binaries: dry-run plan, cell selection and unknown-cell errors, the benchmarks/evidence/ write refusal, courtesy refusal propagation, systemd-run MemoryMax=14G guarding of dhat runs, time -v capture and catalog generation.
29. test_release_deps.sh: guards that the default-feature dependency graph (the production/release build) contains none of the profiling-only crates behind the profile-* features.
30. test_release_workflows.py: validates GitHub Actions CI/CD workflow contracts, 40-SHA action pinning, cargo-dist multi-stage --artifacts=lies tag checkout, SLSA v1 provenance predicate/attestation verification, SHA-256 cargo-dist bootstrap, idempotent crates.io publishing, and repository tag ruleset lockout rollback.
31. test_run_cpp.sh: validates harness/run_cpp.sh vardictcpp version pinning, missing-env exit 3 skip behavior, micro fixture VCF output, and <4-column BED padding.
32. test_run_oracle.sh: tests argument forwarding and flag preservation in harness/run_oracle.sh.
33. test_scale_bench.sh: tests Whole Chromosome 1 scaling benchmark measurement protocols, including courtesy wrapper gating, core pinning, and --no-cpp flag propagation.
34. test_select_slice_regions.py: validates interval slicing, multi-interval BED grouping, and variant density sampling algorithms.
35. test_seqc2_align.sh: verifies that required alignment pipeline commands (bwa mem, samtools fixmate/sort/markdup/index) are correctly invoked in SEQC2 alignment scripts.
36. test_stdlib_purity.py: performs automated AST inspection of all Python files in harness/, asserting 100% Python standard library compliance (zero external PyPI dependencies).
37. test_vcf_header.py: validates standards-compliant VCFv4.2 header generation and contig length extraction from FASTA .fai index files (resolving issue #320).
9. Level 7: Pre-PR & Release Acceptance Compound Gates¶
Level 7 aggregates all lower levels into a two-tier verification lifecycle separating rapid per-PR verification from release-cut evidence certification:
- Inner Developer Loop (
harness/rgate.sh): Fast-feedback developer loop (<15s) running formatting, Clippy, workspace tests, 92-fixture corpus (8 workers), and parallel micro/slice differential validation. - Tier A — Pre-PR Regression Gate (
harness/pr_check.sh): Mandatory 6-stage per-PR gate running Hygiene (934 workspace tests) plus thecrates/vardictrust-core/fuzzcompile check, Crash Robustness, Level 2 Corpus (91/1 signature across 8 workers), Level 3 Parity (micro,s1a..s9, 17-modality extended coverage--no-record, zero-JVM portable CI invariant gateharness/run_portable_invariants.sh, 18-slice multimodal suite--no-record), Level 5 Performance Budget, and Security & Supply-Chain Hygiene (gitleaks,cargo deny --all-features check advisories licenses bans sources, andcargo audit) (<25s) without rewriting committedbenchmarks/evidence/*.jsonfiles. - Tier B — Master Release Recertification & Acceptance Gate (
harness/recertify.sh&harness/acceptance.sh): Executed when cutting a release (release/vX.Y.Z) or certifying a milestone baseline.recertify.shrefreshes all 15 non-scalebenchmarks/evidence/*.jsonfiles (reusing pinnedVarDictJava/vardictcppbaselines and cachedrtg vcfevalresults), updates documentation SHA-256/fingerprint tables (harness/sync_evidence_docs.py), and runsacceptance.shacross all 8 release items (includingcrates/vardictrust-core/fuzzcompile hygiene in Item 7). Every item is strictly PASS or FAIL — there is no waiver mechanism. - Local Public-Data Omnibus Verifier (
harness/verify_public_data.py): Single-pass stdlib DAG runner (--suite {wave4,wave5,presets,wave6,v120,hifi,ont,rnaseq,ablation,tiling,all}, with compatibility shimsverify_{wave4,wave5,presets,wave6}_public_data.sh) validating all 17 real-world sequencing modalities with singleflight(cohort, mode, flags)run caching (-78%BAM spawns), reuse of on-disk.sdfindices (0rtg formatbuilds), universal.var/.vcf/VCFv4.2/bcftools norm/tabix/bcftools view -rauditing, 49-switchonly_1..49&loo_1..49CompatProfileablation across 12 real-BAM cases,Spill == Unspilled, andTiled == Untiledconservation (including tracked bounded-horizon checks for>500 bpcross-seam<DUP>/<INV>discordant clusters and the~100 kbpper-tileReference.seed17-mer horizon that preventsVarDictJava#197/#384whole-chromosome OOM).
10. Cloud CI/CD Automation & Supply Chain Security¶
VarDictRust utilizes 6 automated GitHub Actions workflows with strict security hardening, concurrency cancellation on superseded PR commits, and $GITHUB_STEP_SUMMARY stage telemetry:
10.1 Continuous Integration (.github/workflows/ci.yml)¶
- StepSecurity Runner Hardening & Caching: pinned to
step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25(# v2.10.4) withSwatinem/rust-cache@v2and zero external apt/conda dependencies (noodlespure-Rust BAM/CRAM builders). - 9 Numbered Pipeline Steps (
build-and-test): 1. Format & Lint Gate (rustfmt & clippy)(id: fmt-lint): runscargo fmt --all -- --check,bash harness/lint_ratchet.sh --scan-only, the 3-mode Clippy feature matrix (--no-default-features, default features, and--all-features) under-D warnings,cargo test --benches -p vardictrust-core, andcargo check --manifest-path crates/vardictrust-core/fuzz/Cargo.toml --bins.2. Build Instrumented Workspace & Test Targets(id: build): pre-compiles all instrumented library, binary, and integration test targets viacargo llvm-cov --no-report --workspace --bins --tests -- --list.3. Unit Tests (vardictrust-core & vardictrust)(id: unit-tests): runs all 718 library and CLI binary unit tests (680core lib +38CLI bin;--lib --bins -- --test-threads=2).4. Integration & Hostile-Input Tests (Modes, Filters, CRAM & Bounded Memory)(id: integration-tests): runsengine_behavior(65 tests),amplicon_stream_mem(2),cram_stack(3),robustness(32),profile_smoke(3), andversion(1) (106tests total).5. Corpus & Modality Parity Tests (110 Golden & Modality Cases)(id: parity-tests): runscorpus_parity(110 tests across all 92 upstream corpus fixtures and 17 extended modalities).6. Code Coverage Gate (cargo-llvm-cov >= 90% Lines)(id: coverage-gate): aggregates coverage across steps 3–5 and enforces--fail-under-lines 90.7. Harness Diagnostic Self-Tests (30 Zero-Conda Suites)(id: self-tests): executes all 19 zero-conda shell self-tests and 11 stdlib Python test suites.8. Release Consistency, Performance Budget & Cleanliness Gate(id: governance-gate): runscheck_release_consistency.py --phase pre-tag(with--require-head-fingerprintonrelease/*PRs),perf_budget.py, and working-tree cleanliness verification.9. Publish CI Telemetry Summary: writes step outcomes, durations, and total line coverage % to$GITHUB_STEP_SUMMARY.
10.2 Security & Supply Chain Scans (.github/workflows/security.yml)¶
- Gitleaks Secret Scanning: executes
gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e(# v3.0.0) withfetch-depth: 0across full git commit history. - Supply Chain Advisories, Licenses, Bans & Sources: runs
cargo deny --all-features check advisories licenses bans sources(configured viadeny.toml) viataiki-e/install-action. - RustSec & Clippy SARIF Audit: runs
cargo audit(configured via.cargo/audit.toml), uploads Clippy SARIF results, and writes stage status to$GITHUB_STEP_SUMMARY.
10.3 Release Packaging & SLSA Level 3 (.github/workflows/release.yml)¶
- Automated by
cargo-dist 0.33.0with a pre-build Tier B Release Certification Guard (check_release_consistency.py --phase pre-tag --require-head-fingerprint+perf_budget.pyon tag pushes). - Builds standalone archives across all 5 targets (
x86_64-unknown-linux-gnu,x86_64-unknown-linux-musl,aarch64-unknown-linux-musl,aarch64-apple-darwin,x86_64-apple-darwin). - Emits cryptographic checksums, GitHub OIDC SLSA Level 3 build provenance attestations, and publishes
vardictrust-coreandvardictrusttocrates.io.
10.4 Differential Parity vs Live Oracle (.github/workflows/differential.yml)¶
- Triggers & Caching: push to
main, PRs touching engine/harness/workflow paths, andworkflow_dispatch(timeout-minutes: 15), withstep-security/harden-runner,Swatinem/rust-cache, andactions/cachepersistingscratch/golden-storeacross runs (golden_store.sh verifyon restore). - 6 Numbered Steps: Step 1 (
Build Release Binary & Verify Pinned Golden Store), Step 2 (Tier-2 Micro Differential Parity), Step 3 (Tier-2 Standard Slices Differential Parity: 10 Slices s1a..s9), Step 4 (Tier-2 Extended Modality Differential Parity: 17 Modes), Step 5 (Level 6 Oracle & BAM Edge-Case Self-Tests: runsharness/run_portable_invariants.shplus the 7 oracle-backed scriptstest_vcf_header.py,test_run_oracle.sh,test_run_cpp.sh,test_compare_sh.sh,test_edge_cases.sh,test_concordance.sh, andtest_oracle_r_canary.sh), and Step 6 (Publish Differential Telemetry Summaryto$GITHUB_STEP_SUMMARY).
10.5 Wiki Sync (.github/workflows/wiki.yml)¶
- Triggers: push to
maintouchingwiki/**(plusworkflow_dispatch); never runs on PRs, so fork tokens stay read-only. - Action: pushes
wiki/into the separate<owner>/<repo>.wiki.gitrepo (HEAD:master), committing only on diff and reporting sync status to$GITHUB_STEP_SUMMARY.
10.6 Documentation Site Gate (.github/workflows/docs.yml)¶
- Triggers: push to
mainand every PR. - Action: stages all repository markdown files via
python3 harness/prepare_docs_site.py, builds the Zensical documentation site underzensical build --clean --strict, runspython3 harness/tests/test_docs_ui.py(including built-site HTML and headless Chromium Playwright checks), cleans staging artifacts, and writes a stage summary to$GITHUB_STEP_SUMMARY.
11. Cross-Reference Index¶
- Biological Truth & Empirical Proofs:
docs/validation/omnibus-empirical-validation.md - Developer Contributor Guide & Release Runbook:
CONTRIBUTING.md - Main Project Readme & Scoreboard:
README.md - Pull Request v1.2.0, v1.1.0, v1.0.10, v1.0.9, v1.0.8, v1.0.7, v1.0.6, v1.0.5, v1.0.4, v1.0.3, v1.0.1 & v1.0.0 Certifications:
docs/release/v1.2.0-pr.md,docs/release/v1.1.0-pr.md,docs/release/v1.0.10-pr.md,docs/release/v1.0.9-pr.md,docs/release/v1.0.8-pr.md,docs/release/v1.0.7-pr.md,docs/release/v1.0.6-pr.md,docs/release/v1.0.5-pr.md,docs/release/v1.0.4-pr.md,docs/release/v1.0.3-pr.md,docs/release/v1.0.1-pr.md&docs/release/v1.0.0-pr.md - Known Upstream Bugs & Divergences:
docs/upstream-bugs.md&DIVERGENCES.md - Master Release Roadmap:
ROADMAP.md
12. Master Reproducibility Runbook & Dataset Provenance Catalog¶
Future contributors and clinical bioinformaticians can independently reproduce every empirical claim made in the VarDictRust v1.2.0 release using the structured runbook below.
12.1 Biological Asset Provenance Catalog¶
| Dataset ID | Public Accession / URL | Specimen & Assay | Platform & Mean Depth | Reference Build | Target BED Interval | Standard Dataset / Cache Path (DATA_DIR) |
|---|---|---|---|---|---|---|
| GIAB HG002 | NCBI / GIAB S3 (Ashkenazim Trio) | NA24385 Son (B-lymphocyte) | NovaSeq 6000 (125× WGS) | GRCh38 | chr20:10000000-30000000 |
${DATA_DIR:-scratch/g4}/hg002/HG002.chr20.bam |
| SEQC2 HCC1395 | ENA PRJNA488340 / NCBI SEQC | Primary Breast Carcinoma / BL | NovaSeq 6000 (300×/100× WES) | GRCh38 | exome_v6_UTR_hg38 (Full WES) |
${DATA_DIR:-scratch/g4}/seqc2/HCC1395.bam |
| GIAB HG008 | NCBI GIAB Somatic (Liss Lab) | Pancreatic Ductal Carcinoma | NovaSeq 6000 (195×/169× WGS) | GRCh38 | HG008-T_benchmark_all.bed |
${DATA_DIR:-scratch/g4}/hg008/HG008-T.slice.bam |
| GIAB HG005 | NCBI GIAB Chinese Trio | NA24631 Son (B-lymphocyte) | HiSeq 2500 (300× WGS) | GRCh38 | chr3:40000000-40100000 |
${DATA_DIR:-scratch/g4}/multimodal/hg005_s4a.bam |
| GIAB NA24385 b37 | NCBI GIAB Ashkenazim Trio | NA24385 Son (B-lymphocyte) | HiSeq 2500 (300× WGS) | GRCh37/b37 | 20:36018823-36039513 |
VarDictJava/src/test/resources/com/astrazeneca/vardict/integrationtests/NA24385_chr_20_36018823_36039513.bam |
| Targeted Amplicon | AstraZeneca NGS Archive | Synthetic EGFR L861Q Panel | HiSeq 2000 (1000× Targeted) | hg19 | chr7:55241000-55260500 |
VarDictJava/src/test/resources/com/astrazeneca/vardict/integrationtests/L861Q.bam |
| RNA Splicing Suite | AstraZeneca NGS Archive | STAR Splice Junctions (chr8) | Illumina HiSeq (RNA-seq) | hg38 | chr8:90534611-90620070 |
VarDictJava/src/test/resources/com/astrazeneca/vardict/integrationtests/Tcov_zero_SV_DEL_candidate3.bam |
| COLO829 Melanoma | ENA PRJEB27698 (Hartwig / NYGC) | Malignant Melanoma / BL | HiSeqX (100×/40× Somatic WGS) | GRCh37/b37 | 1:10000000-10200000 |
${DATA_DIR:-scratch/g4}/multimodal/colo829_s1a_tumor.bam |
12.2 Zero-Virtualenv Architecture & Toolchain Segregation¶
VarDictRust deliberately avoids requiring a Python virtual environment (venv) or root pyproject.toml:
1. Engine Core (Rust): Managed strictly by cargo and Cargo.lock (deterministic reproducible compilation).
2. Test & Metrology Harness (Python): All Python scripts in harness/ and harness/tests/ depend exclusively on the Python 3.8+ Standard Library (argparse, json, gzip, math, subprocess, unittest). Contributors execute tests immediately with system python3 without creating virtualenvs or running pip install. This zero-PyPI contract is verified by harness/tests/test_stdlib_purity.py.
3. Genomics Reference Oracle & Benchmarks (Bioconda): Native non-Python binaries (vardict-java=1.8.3, rtg-tools, samtools, bcftools, bwa) are managed via isolated Conda environments (benchmarks/env/vardict-oracle.yml and harness/env/g4-tools.yml).
4. Ephemeral Developer Tools: Single-command developer tools (cffconvert, pre-commit) run ephemerally via Astral's uvx without polluting the workspace.
12.3 Push-Button Level Reproduction Runbook¶
# 1. Pre-Commit: Install Local Pre-Commit Hooks (<1s)
bash harness/setup_hooks.sh
# 2. Level 1: Execute Unit & Component Test Matrix (<2s)
cargo test --workspace -- --test-threads=8
# 3. Level 2: Reproduce Upstream Integration Regression Corpus (<8s)
bash harness/run_integration.sh
# Expected: PASS: 91 XFAIL: 1 FAIL: 0 SKIP: 0 XPASS: 0 (asserting 100% live oracle parity)
# 4. Level 3: Reproduce Extended Modality Parity (17 Modes, <30s)
bash harness/run_extended_coverage.sh
# Expected: 17/17 MATCH (RNA splicing -i, CRISPR -J, <INV>, <DUP>, CLI flags)
# 5. Level 3: Reproduce Multi-Modal Cohort Slices (18 Slices across 6 Cohorts, <35s)
bash harness/run_multimodal_slices.sh
# Expected: 18/18 MATCH (0 diffs across 1,129 biological variants)
# 6. Level 4: Reproduce Ground Truth Concordance Benchmarking (<15s)
bash harness/concordance_multimodal.sh
# Expected: HG005 (F1=0.9667) and NA24385 b37 (F1=1.0000) both EQUAL (0 site diffs)
# 7. Level 5: Reproduce Continuous Performance Budgets (<1s)
python3 harness/perf_budget.py hg008-tier2 seqc2-exome-tier2 hg002-tier2 amplicon-tier2 hg008-cram-twin
# Expected: PASS across HG008, SEQC2, HG002, Amplicon, and HG008 CRAM twin targets
# 8. Level 6: Reproduce Diagnostic Self-Tests (<10s)
bash harness/run_self_tests.sh
# Expected: ALL 37 HARNESS DIAGNOSTIC TESTS PASSED SUCCESSFULLY
# 9. Level 7: Reproduce Pre-PR Compound Regression Suite (<35s)
bash harness/pr_check.sh
# Expected: 6/6 stages PASS (Hygiene, Robustness, Corpus, Micro, Perf, Secrets)
# 10. Level 7: Reproduce Release Acceptance Compound Gate (<1m)
bash harness/acceptance.sh
# Expected: 8/8 items PASS under certified release fingerprint 729cf0f46bd30c4b