Skip to content

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=vardictjava parity mode) and VarDictJava v1.8.3 concurrently on identical BAM/CRAM alignment inputs, feeding both outputs into harness/compare_vcf.py under strict IEEE 754 half-even float tolerance \(\varepsilon \le 10^{-6}\) (complemented by targeted --compat=off diff-confinement tests in engine_behavior.rs and robustness.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:

  1. Output Formatting & Tables (output/ — 88 tests):
  2. output::table (32 tests): verifies column schema counts (Simple 36/38, Amplicon 38/40, Somatic 36/55/61 *_append & *_into), TableModeStyle mode-specific float/precision quirk conservation (ar09_table_mode_style_preserves_all_four_vardictjava_quirks), COMPAT_OFF exact_binary_half_even binary tie rounding (±5e-{4,5,6,9}) and continuous_pstd_qstd sample SD rendering, raw float formatting vs banker's rounding, null-record row rendering for -p mode, and header generation.
  3. output::vcf (56 tests): verifies Perl falsy-row skipping (perl_row_skipped matching var2vcf_valid.pl:141 dropping empty or "0" REF cells), single-sample -f 0 Perl falsy 0.02 AF threshold fallback (test_var2vcf_valid_zero_af_threshold_falls_back_to_0_02) and verbatim af_threshold_raw -f filter 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_cnt balancing, and annotate header/filter suppression), SingleRecordStreamer / SingleVcfEvent (ClusterNbp, AmpBiasSnvClusterProbe, SvSplitreadFlush), COMPAT_OFF (##VarDictRustCompat=off, bijective AstraZeneca-NGS/VarDictJava#116 INFO/SAMPLE percent-encoding, mixed sex/mitochondrial contig preservation, UB-5 preserve_discordant_svs discordant-only <DUP>/<INV>/<DEL> retention with explicit --min-splitreads override, canonical_sv_vcf_anchoring ##ALT/signed SVLEN/single+amplicon+paired END;SVTYPE;SVLEN, paired_somatic_amplicon GDAMP;TLAMP;NCAMP;AMPFLAG + AMPBIAS + LikelyLOH/rescued-Germline normal concordance + pSTD suppression, nonnegative_subtracted_means QUAL >= 0, strict_vcf_ad_number_r Number=R FORMAT/AD, omit_nonsv_vcf_end non-SV INFO/END omission, canonical_vcf_gt 1/0 -> 0/1 & subclonal 0/0 -> 0/1 promotion, insertion_hicov_and_local_amp_dp msint == 1 LongMSI Clause 1, spliced_overhang_and_homopolymer_filter < 1% monomer 8 <= MSI <= 12 1-bp MSI12 filter with duplex_cnt >= 1 and paired LOH immunity, continuous_pstd_qstd sample SD formatting, and exact_binary_half_even tie rounding), IEEE 754 half-even banker's rounding (round_half_even), VCFv4.2 header generation and upfront .fai/-G/-N hygiene validation, SV END= tag computation, and INFO/FORMAT tag serialization.
  4. CIGAR Parsing & Indel Realignment (cigar/ & realign/ — 128 tests):
  5. cigar::modify, cigar::parse & cigar::tests (73 tests: 16 in cigar::modify, 55 in cigar::parse, 2 in cigar::tests): verifies CIGAR string parsing, single-M and >= 10S/>= 12S pure-S/M modify_cigar fast-path endpoint mismatch clipping, hostile/corrupt CIGAR operator guards and COMPAT_OFF cigar_homopolymer_merge multi-indel rescue (AstraZeneca-NGS/VarDictJava#402), COMPAT_OFF cigar_strip_outer_hard_clips outer <N>[HP] stripping and interior Pad handling (AstraZeneca-NGS/VarDictJava#341, AstraZeneca-NGS/VarDictJava#103), COMPAT_OFF eqx_cigar_read_length SAM =/X coalescing and read-length accounting, COMPAT_OFF consensus_bam_compat (Switch 42) aligned-'N' NM neutralization, terminal-'N' modify_cigar exemption, and ReadOrientation (F1R2/F2R1/DuplexBalanced) tracking, COMPAT_OFF spliced_overhang_and_homopolymer_filter (Switch 46) bilateral un-anchored N splice tp clamping (<= 10 bp, deduplicating consecutive N ops and outer -k 0 deletions) and anchored-exon preservation, --preset hifi|ont MAX_LONG_READ_SCLIP_BASES = 2,048 cap and (10..=99)S bypass, COMPAT_OFF mate_overlap_both_strands molecule-keyed -u FR overlap strand rebalancing, COMPAT_OFF reconcile_strand_and_hq_sums Variation::reset_counts_compat, --amplicon-single-primer (-sp) primed-edge filtering, loaded-window ± 5_000 bp deletion coverage clipping and coordinate-compressed i64 sweep (finish_ref_coverage), pre-region Match \(O(1)\) skip and single-base Match pileup fast-paths, indel/soft-clip rewriting (modify_cigar), mismatch gate filtering, cached &LoadedRegion \(O(1)\) reference indexing, supplementary-read max_read_length updates, M-after-I reference N mismatch counting, signed element_len \(3'\) soft-clip rescue, secondary LoadedRegion lookup during structural-variant partial_pipeline re-parsing (parse_cigar_selects_secondary_loaded_region_for_partial_pipeline), chimeric \(3'\) soft-clip seed checks with/without SA tags, VCF-delimiter base neutralization while preserving SAM =, u64 COMPAT_OFF live_duprate accounting, and CRISPR cut-site filtering.
  6. realign (55 tests): verifies SWAR \(3'\)-to-\(5'\) overhang matching (find_35_match, COMPAT_OFF exact_35_overlap rem5 < rem3 assembly rescue, and pre-sentinel actual_mismatch), zero-allocation is_match / find_mm5 / find_mm3 helpers, COMPAT_OFF no_passing_reads --eqx (=/X) spanning-read counting, exact_cigar_dlen_match exact CIGAR <dlen>D operator matching, adj_snv_full_sclip_match full-flank soft-clip SNV rescue, mnp_exact_right_fold & mnp_cis_haplotype_phasing (Switch 44) spanning-read DP conservation, cis/trans haplotype separation, up_cov_mask spliced N intron tracking, and multi-offset orphan cis prefix pruning, strict_unspanned_lgins_stitch & complex_indel_and_lgins_concordance (Switch 45) TruSeq chimera / unilateral bi == 0 rejection (gating before partial_pipeline), \^\d+ deletion-length stripping, and +ins \(\to\) +ins&X shift_remove consolidation, add_var_factor & rm_cnt Welford (p_m2, q_m2) and proportional meth_prob_sum/meth_cnt propagation, reconcile_strand_and_hq_sums realigndel extracnt clearing, adaptor_all_consensus_dirs all-direction --adaptor soft-clip screening, sv_respect_min_len sub-100 bp <inv-N> and sub-50 bp <dup-N> soft-clip recruitment, and canonical_sv_vcf_anchoring pre_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|ont find_bp_with_mode parity), and soft-clip SV field merging.
  7. Postprocessing & Variant Classification (postprocess/ — 92 tests):
  8. postprocess::simple (13 tests): verifies single-winner multi-allelic collapsing (UB-7), --vcf-all-alleles retention, COMPAT_OFF strict_region_bounds & canonical_sv_vcf_anchoring 1-bp upstream SV bounds, canonical_vcf_complex_left_align & indel_only_shift3, coordinate_sorted_vars ascending .var coordinate emission and deterministic VCF tie-breaking, pileup_preserve_shifted_ref -p multi-deletion shifted-reference emission (AstraZeneca-NGS/VarDictJava#330), sanitize_iupac_alt_alleles post-adj_complex REF == ALT filtering, recompute_vartype_after_adj_complex var_type refresh, UB-1 sentinel suppression, raw start grouping, and pileup null-record fallback branches.
  9. 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/METH somatic propagation and symbolic <INS> SVLEN allele-key discrimination, COMPAT_OFF somatic_continue_after_bad_var secondary-allele continuation, somatic_reconcile_split_alleles split Tumor/Normal allele reconciliation (including cross-class (presence_class, start_pos, ref, alt) orientation & duplex_cnt keying), somatic_loh_homozygous_alt & somatic_multiallelic_loh_rescue (Switch 47) trailing v2 multi-allelic rescue and FisherExact < 0.05 LikelyLOH classification, paired_somatic_amplicon concordance propagation, nonnegative_subtracted_means subtracted-mean clamping, reconcile_strand_and_hq_sums & reconcile_rd_vd_dp depth/strand reconciliation, sanitize_iupac_alt_alleles & recompute_vartype_after_adj_complex, strict_region_bounds + unextended region.start - 1 <dupN> retention, max_read_length and splice propagation across combine_analysis windows, in-place v2nt.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).
  10. 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> SVLEN concordance keying, active-interval streaming sweeps, bounded suffix-minimum horizon deduplication and immediate emit error propagation, --vcf-all-alleles retention, COMPAT_OFF strict_region_bounds, canonical_vcf_complex_left_align, indel_only_shift3, sanitize_iupac_alt_alleles, recompute_vartype_after_adj_complex, & UB-2 sentinel suppression, null-row tlamp/ncamp formatting, good_variants persistence across amplicons, GoodVarCount/TotalVarCount ratios, and AMPBIAS assignment.
  11. Statistical Analysis, Polymer-Stutter Noise & Epigenetic Models (stats/, noise, methylation — 44 tests):
  12. 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 hoisted p3 binomial invariants, streaming hypergeometric summations, and odds ratios against R (fishers_exact) and Java (test_java_fisher_ultradeep_parity) oracles.
  13. stats::f80 (6 tests): verifies 80-bit extended precision emulation for hypergeometric summations.
  14. stats::hypergeom (6 tests): verifies cleanroom MIT saddlepoint binomial and hypergeometric routines (stirling_error, binomial_deviance, binomial_pmf, log_binomial_pmf, hypergeom_pmf, hypergeom_cdf).
  15. stats::zeroin (4 tests): verifies Brent's zero-finding root solver (UnirootZeroIn) for odds ratio confidence intervals.
  16. 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.0 immunity on SNVs/MNVs/SVs and non-repeat EGFR / BRCA1/2 indels, modality VAF ceilings, unreconciled vd2 > dp2 clamping, and duplex_cnt >= 1 / is_hotspot exemptions.
  17. methylation (2 tests): verifies SAM MM:Z (. and ? modes across +/- strands, trailing-comma rejection, and mixed ?/. series isolation) and ML:B:C cis-CpG (±200 bp) 5mC+5hmC extraction (ReadCisCpGIndex).
  18. Structural Variants & Variation Models (sv/ & variations/ — 74 tests):
  19. sv (34 tests): verifies discordant mate-pair clustering (is_overlap, check_cluster), SA:Z supplementary split-read SV chaining and normal somatic veto (svlen <INS> discrimination & min_reads depth reconciliation), COMPAT_OFF UB-6 mark_dup_sv_inclusive_end pre-decrement boundary marking, sv_respect_min_len -L (--min-sv-len) discordant suppression and bounded MAX_EXPLICIT_SV_SEQ_BP (32,768 bp) explicit sequence materialization (AstraZeneca-NGS/VarDictJava#328), reconcile_strand_and_hq_sums SV accumulator clearing, adaptor_all_consensus_dirs dir = 5/3 soft-clip screening, canonical_sv_vcf_anchoring pre_anchored_dup tagging, sv_lazy_mate_pileup seeded bam_piled_spans / Side::Three merge_planted lazy mate-window pileups, and merge_variation_entry / ref-subtraction Welford (p_m2, q_m2) conservation, -r (min_reads) u32/i32 overflow hardening, single-BAM colon-path preservation in find_all_sv_paths, inversion anchor clustering (find_inv_sub), \(5'\)/\(3'\) inversion vref.cnt preservation, \(5'\) candidate deletion post-decrement coverage lookup (test_find_sv_5prime_deletion_uses_post_decrement_p5_plus_1_ref_coverage), upfront SOFTP2SV SclipSlot live .used mutation visibility and safe BTreeMap range helpers (test_softp2sv_slot_map_live_used_mutation_and_max_rl_zero_ranges), soft-clip unused state preservation (sync_sclip_after_conseq in test_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 deletion SEED_2 retries.
  20. variations (40 tests: 10 in variations::tests, 14 in variations::debug_tests, 16 in variations::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), commutative PhaseSetCounts top-3 coalescing & Misra–Gries majority retention, ReadOrientation (F1R2/F2R1/duplex_cnt) accumulation and rebalancing, Variant::canonical_left_align (Tan et al. 2015 Algorithm 1), sclip_majority_count_first count-first consensus tie-breaking, approx_heap_bytes accounting, debug_variants_content round_half_even formatting, low-complexity sequence masking, strand bias counters, COMPAT_OFF exact_35_overlap overhang assembly rescue, and lockstep soft-clip consensus sequence finding.
  21. Coordinates, Tiling & Reference (types, regions, reference — 47 tests):
  22. types (11 tests): verifies strict 0-based (Pos0) to 1-based (Pos1) coordinate translations and stack-buffered banker's rounding (round_half_even and COMPAT_OFF round_half_even_compat exact binary ties) edge cases.
  23. regions (21 tests): verifies BED parsing (read_bed_lines .gz/.bgz/BOM/\r\r\n, MAX_BED_BYTES cap, control-character/NUL rejection, single-pass detect_amplicon_bed_from_lines & parse_bed_from_lines), resolve_preset_col_gene (--preset wgs|wes|amplicon|ctdna|hifi|ont), rightmost-colon -R GRCh38 HLA-A*01:01:01:01 contig 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).
  24. reference (15 tests): verifies uncompressed and BGZF-compressed (.fa.gz + .fai + .gzi) FASTA subsequence fetching (test_fetch_subsequence_and_get_reference, companion .fai/.gzi resolution, read_validated_fai_index & hostile .gzi validation, and process-wide OnceLock SharedFastaMeta multi-thread coalescing + FastaFileStamp rewrite invalidation), quantized >= 64 KiB interval-subtracted ONT-UL overhang FASTA loading and cross-seam stitching (ensure_overhang_reference_loaded / contiguous_or_stitched_slice), colon-containing contig resolution, site_end \(17\text{-bp}\) SEED_1 lookahead 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_12 extraction, AstraZeneca-NGS/VarDictJava#393 missing .fai contig and past-end coordinate bounds rejection (fetch_subsequence_past_end_is_err), and k-mer seedmap indexing (seedmap).
  25. Utilities (util/ — 16 tests):
  26. Verifies safe slice extraction, bounds-checked negative-index character lookup, itoa integer formatting helpers (push_i32), reverse complementation, and arithmetic overflow protection.
  27. Streaming Execution & Concurrency (runner, bam — 65 tests):
  28. runner (12 tests): verifies worker thread panic catching without process hang, 16 MiB WORKER_THREAD_STACK_FLOOR_BYTES floor (and automatic 64 MiB stack sizing on .cram inputs) respecting RUST_MIN_STACK, unweighted 4 * num_threads dispatch-window bounding alongside non-starving FlowState byte-weighted pending-output throttling (MAX_PENDING_BYTES = 64 MiB, MAX_PENDING_BATCHES = 262,144), batched tile execution, and deterministic sorted output.
  29. bam (53 tests): verifies SAM/BAM/CRAM decoding, SA:Z/HP:i/PS:i/MM:Z/ML:B:C auxiliary tag extraction, Switch 42 (consensus_bam_compat) cD/aD/bD/MI consensus tag decoding across BAM/CRAM/SAM (including CRAM duplicate-tag last-seen-wins parity) and MI-keyed -t DupKey preservation, Picard <stem>.bai/<stem>.csi/<stem>.crai and canonical symlink index resolution, pre-validated .bai/.csi header and count bounds (MAX_BAI_BYTES / MAX_CSI_BYTES), colon-containing contig BAM queries, bounded 512 MiB ContigSlot CRAM reference cache with tile-scoped CramContigPinGuard (pin_cram_contig_for_spec) and IndexedCrai slice seek, CRAM container/slice header bounds & windowed buffered landmark validation, 16 MiB MAX_CACHED_CRAM_CONTAINER_BYTES per-container decoded-record heap cap across 4 × 4 slots (4 shards × 40 MiB = <= 160 MiB via MAX_SHARD_CACHED_CRAM_BYTES) with per-key singleflight container decode coalescing (cram_container_cache_coalesces_concurrent_decodes), epoch-guarded 2-slot thread-local BamMeta/CramMeta caching and clear_bam_caches() dual-Release invalidation, <= 4096 B reusable BamFeedInner stashes, multi-BAM per-file duplicate-set reset (reset_for_next_bam), (u32, i32, u32) -t duplicate tuple keys and COMPAT_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 CRAM NM reconstruction (compute_cram_nm_reconstructs_edit_distance_when_omitted_by_cram), 32-shard CachedBgzfReader block caching, CIGAR query-consumption validation against SEQ length, non-advancing text SAM CIGAR Err loop termination, and corrupt record rejection.
  30. 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):
  31. javamap (29 tests): verifies JavaHashMap OpenJDK 8+ hash bucket spread, compact JavaHashMap<i32, Vars> layout and into_entries move extraction, Iter ExactSizeIterator and cloning without K: Clone, V: Clone, java_hashmap_key_order delegation, arena node free-list reuse, binning, and TreeNode Red-Black bin treeification, balancing, moveRootToFront, removeTreeNode pointer-topology untreeification, and split (UNTREEIFY_THRESHOLD = 6) against real Java oracle traces.
  32. 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 49 COMPAT_OFF switches, only_switch, without_switch, from_mask), af_threshold_raw sanitization, and VcfThreshold validation.
  33. counters (2 tests): verifies thread-local diagnostic counter accumulation and zero-overhead non-debug builds.
  34. tovars (37 tests): verifies candidate variant finalization, F1R2/F2R1/duplex_cnt variant finalization (including u128 overflow-safe clamp_orientation_pair_u64), drain_vars_into exact single-allele capacity reservation, doomed sub-min_reads Phase-2 build_aligned_variants_pruned reference pruning while conserving aligned_variants keys, single-position build_vars_at_position_with_ref_mode, sparse copy-on-write overlay parity, and COMPAT_OFF AstraZeneca-NGS/VarDictJava#342 <DUP> + AstraZeneca-NGS/VarDictJava#292 -3 3'-shifted allele normalization + canonical_sv_vcf_anchoring 1-bp upstream SV anchoring (including isolated <dup-N> normalization) + sv_respect_min_len -L explicit <DUP>/<INV> sequence materialization (AstraZeneca-NGS/VarDictJava#328) + indel_only_shift3 equal-length substitution SHIFT3=0 clamping + insertion_hicov_and_local_amp_dp (Switch 43) insertion_variations hicov & local position + 1 &-DP + continuous_pstd_qstd (Switch 48) Welford pstd_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_even 5e-5 tie 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).
  35. Root library tests (44 tests): verifies splice-tile and mate-window ownership, unsorted -t ext_feed halo deduplication, generic SplitVarDeduper<P> (200 kbp cross-tile .var and --vcf-all-alleles boundary retention and flush_before_unsplit_tile), flattened single-pool 250 kbp band max_read_length pre-scan (COMPAT_OFF --eqx =/X and cigar_strip_outer_hard_clips <N>[HP] aware) + u64 live_duprate parent counts and lazy 2-bit ACGT + 'N' side-map 12-mer indexing (test_multi_band_prescan_and_lazy_seed12_index_parity & BoundedParentRefScanner 65,536 bp long-read overhang loading), SpillableVcfAccumulator (8 MiB disk-backed whole-stream VCF spill bound, associative multi-allele and single-allele multi_sv_buckets disk spill/merge, --output-parent spill directory placement with std::env::temp_dir() fallback, 0700/0600 private spill tempfiles, SingleVcfEvent spill round-trip & corrupt tag/span rejection, and forced-1B-spill SingleRecordStreamer / PairedRecordStreamer cross-tile ClusterNbp conservation), DirectTempStaged / O_NOFOLLOW 0555 read-only-parent output staging, Tabix and CSI (Indexer::<LinearIndex>::new(14, 6) -> Index<BinnedIndex> clintval/vartovcf#161 + acrocentric leading-zero window backfill) SV END= indexing and input-collision/BGZF-residue/FD-alias/corrupt-END guards, paired somatic amplicon run_somatic_amplicon (COMPAT_OFF paired_somatic_amplicon), somatic BAM1-to-BAM2 splice set 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).
  36. 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 via vardictrust_core.
  37. tests/engine_behavior.rs (65 tests): verifies CRAM soft-masked base normalization and NM reconstruction (cram), somatic Fisher 61-column output (fisher), -f 0 vs -f 0.0 / -f 0.050 / -f 1e-5 / -f .01 VCF threshold filtering (vcf_filters), <DUP>, \(5'\) deletion, and <INV> structural variants (structural_variants), pileup and filtering modes (filtering_and_pileup), AstraZeneca-NGS/VarDictJava#378 paired-BAM + -a default SomaticMode vs --compat=off paired amplicon dispatch contract, hostile input resilience including AstraZeneca-NGS/VarDictJava#402 malformed CIGARs, missing .bai indices, AstraZeneca-NGS/VarDictJava#393 .fai bounds, and AstraZeneca-NGS/VarDict#172 3'_UTR BED annotations (hostile_inputs), multi-thread tiled-vs-untiled conservation across .var, .vcf, SV, and -i splice 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|ont BED/region/paired-Q20 guards, --orientation-bias[=annotate] on SEQC2 24h FFPE & fgumi duplex, long-read HG002 HiFi/ONT-UL & HG008-T ONT scaling, SA:Z <DEL>/<DUP>/<INV>/<INS> chaining + split-tile seam lookback + foldback-hairpin rejection + normal veto, HP:i/PS:i HapBias, --methylation cis-CpG ASM/DMR, --noise-model[=MAX_ERRP|annotate|off] PolymerNoise, and all 49 COMPAT_OFF switches including the exhaustive (only_i, loo_i) 4-law isolation matrix, split-tile seam/spill parity, portable BAM == CRAM twin parity, acrocentric --csi backfill (vcf_all_alleles_and_compat_off), Wave-7 committed-BAM confinement (compat_wave7_switches_39_to_41_committed_bams_real_data_confinement), Wave-8 Switch 46 end-to-end MSI12/paired-LOH preservation, and Switch 49 bcftools concat/norm SV/BND interop.
  38. tests/amplicon_stream_mem.rs (2 tests): verifies bounded memory on huge amplicon intervals across standard -a and -a -p pileup modes.
  39. tests/cram_stack.rs (3 tests): verifies 64 MiB Rayon worker stack sizing for noodles-cram rANS decoding, single-thread run_with_worker_stack survival 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 contig test was 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 test2 was generated years ago using a FASTA generator that used a first-chunk-wins reconstruction.
  • The sibling fixture test1 was generated using a last-chunk-wins reconstruction.
  • Today's upstream script convert_fastas.py in VarDictJava implements last-chunk-wins.
  • Consequently, VarDictJava v1.8.3 itself cannot reproduce its own static expected file today. When live VarDictJava v1.8.3 is run against hard_clip_case.fa, it fails against its own checked-in .txt fixture 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>
If any other fixture fails, or if the signature deviates from 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, same vardict-oracle env) runs beside each Level 3 arm as an advisory third arm (never gating; CPP_SKIP=1 escapes it).
  • Level 4 (Ground Truth Concordance Gate, Tier-3): Evaluates variant calling performance (\(F_1\), Precision, Recall) using rtg vcfeval against 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:

  1. Whole-Chromosome Scaling (harness/scale_bench.sh):
  2. 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).
  3. 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.94s vs 261.06s 3-run median, certified gate ≥ 2.40×)).
  4. 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 GiB vs 1.10 GiB 3-run median, certified gate ≤ 1.50×)).
  5. Five-Target Workload Budget (harness/perf_budget.py):
  6. 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, achieved 2.36×).
  7. 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}\):

# Execute the full automated diagnostic test suite
bash harness/run_self_tests.sh

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:

  1. 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.
  2. Tier A — Pre-PR Regression Gate (harness/pr_check.sh): Mandatory 6-stage per-PR gate running Hygiene (934 workspace tests) plus the crates/vardictrust-core/fuzz compile 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 gate harness/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, and cargo audit) (<25s) without rewriting committed benchmarks/evidence/*.json files.
  3. 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.sh refreshes all 15 non-scale benchmarks/evidence/*.json files (reusing pinned VarDictJava/vardictcpp baselines and cached rtg vcfeval results), updates documentation SHA-256/fingerprint tables (harness/sync_evidence_docs.py), and runs acceptance.sh across all 8 release items (including crates/vardictrust-core/fuzz compile hygiene in Item 7). Every item is strictly PASS or FAIL — there is no waiver mechanism.
  4. 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 shims verify_{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 .sdf indices (0 rtg format builds), universal .var/.vcf/VCFv4.2/bcftools norm/tabix/bcftools view -r auditing, 49-switch only_1..49 & loo_1..49 CompatProfile ablation across 12 real-BAM cases, Spill == Unspilled, and Tiled == Untiled conservation (including tracked bounded-horizon checks for >500 bp cross-seam <DUP>/<INV> discordant clusters and the ~100 kbp per-tile Reference.seed 17-mer horizon that prevents VarDictJava#197/#384 whole-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) with Swatinem/rust-cache@v2 and zero external apt/conda dependencies (noodles pure-Rust BAM/CRAM builders).
  • 9 Numbered Pipeline Steps (build-and-test):
  • 1. Format & Lint Gate (rustfmt & clippy) (id: fmt-lint): runs cargo 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, and cargo 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 via cargo 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 (680 core lib + 38 CLI bin; --lib --bins -- --test-threads=2).
  • 4. Integration & Hostile-Input Tests (Modes, Filters, CRAM & Bounded Memory) (id: integration-tests): runs engine_behavior (65 tests), amplicon_stream_mem (2), cram_stack (3), robustness (32), profile_smoke (3), and version (1) (106 tests total).
  • 5. Corpus & Modality Parity Tests (110 Golden & Modality Cases) (id: parity-tests): runs corpus_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): runs check_release_consistency.py --phase pre-tag (with --require-head-fingerprint on release/* 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) with fetch-depth: 0 across full git commit history.
  • Supply Chain Advisories, Licenses, Bans & Sources: runs cargo deny --all-features check advisories licenses bans sources (configured via deny.toml) via taiki-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.0 with a pre-build Tier B Release Certification Guard (check_release_consistency.py --phase pre-tag --require-head-fingerprint + perf_budget.py on 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-core and vardictrust to crates.io.

10.4 Differential Parity vs Live Oracle (.github/workflows/differential.yml)

  • Triggers & Caching: push to main, PRs touching engine/harness/workflow paths, and workflow_dispatch (timeout-minutes: 15), with step-security/harden-runner, Swatinem/rust-cache, and actions/cache persisting scratch/golden-store across runs (golden_store.sh verify on 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: runs harness/run_portable_invariants.sh plus the 7 oracle-backed scripts test_vcf_header.py, test_run_oracle.sh, test_run_cpp.sh, test_compare_sh.sh, test_edge_cases.sh, test_concordance.sh, and test_oracle_r_canary.sh), and Step 6 (Publish Differential Telemetry Summary to $GITHUB_STEP_SUMMARY).

10.5 Wiki Sync (.github/workflows/wiki.yml)

  • Triggers: push to main touching wiki/** (plus workflow_dispatch); never runs on PRs, so fork tokens stay read-only.
  • Action: pushes wiki/ into the separate <owner>/<repo>.wiki.git repo (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 main and every PR.
  • Action: stages all repository markdown files via python3 harness/prepare_docs_site.py, builds the Zensical documentation site under zensical build --clean --strict, runs python3 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


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