VarDictRust Differential Testing & Benchmarking Harness¶
This directory contains the testing, benchmarking, oracle comparison, and verification harness for VarDictRust, built under the rewrites.bio manifesto (certified in v1.2.0 — see docs/release/v1.2.0-pr.md).
The primary mission of the harness is uncompromising fidelity verification: proving byte-for-byte variant equivalence and float concordance (\(\varepsilon = 10^{-6}\)) against VarDictJava v1.8.3 on valid inputs by default (--compat=vardictjava / --parity), enforcing targeted diff-confinement under opt-in --compat=off, and certifying execution speedup and bounded memory usage across deep sequencing datasets.
1. Architecture Overview¶
The harness operates in two distinct tiers:
- Intermediate Table Parity (Tier 1): Evaluates intermediate .var tables generated via --emit-intermediate using compare_var.py. Validates column count integrity (Simple 36/38, Amplicon 38/40, Somatic 55/61), strand bias counters, Fisher p-values, odds ratios, and variant classifications prior to VCF serialization.
- VCF Differential Parity (Tier 2): Evaluates final VCFv4.2 output against VarDictJava v1.8.3 running in an isolated reference oracle environment (vardict-oracle) using compare_vcf.py. Aligns records by CHROM/POS/REF/ALT, checks genotypes, filters, and info tags, enforcing banker's half-even rounding tolerances (\(\varepsilon = 10^{-6}\)).
2. Core Drivers & Comparators¶
| Script / Tool | Description & Usage |
|---|---|
compare.sh |
Core Differential Driver: Runs both VarDictJava and VarDictRust against a given reference FASTA, BAM, and BED, comparing final VCF outputs using compare_vcf.py. Supports both single BAM and somatic paired BAMs (tumor.bam\|normal.bam). |
compare_vcf.py |
VCF Differential Comparator: Python comparator that parses and aligns records by coordinate and allele, comparing FILTER, INFO, and FORMAT fields with exact float tolerances (\(\varepsilon = 10^{-6}\)) and validating VCF header metadata. Supports --strict-bytes. |
compare_var.py |
Table Differential Comparator: Compares raw intermediate .var output tables row-by-row, validating allele frequency ties and column alignment. |
golden_store.sh |
Golden Baseline Store CLI: Manages cached, hash-keyed oracle baseline outputs (scratch/golden-store/) across Java and C++ runs with atomic locking, verification, and telemetry. |
run_oracle.sh |
Oracle Execution Wrapper: Executes upstream VarDictJava v1.8.3 within the isolated vardict-oracle conda environment (OpenJDK 8 + Perl/R pipeline). Enforces the Linux/x86_64 80-bit long double (sizeof.longdouble == 16) R requirement; fails fast with ORACLE-PLATFORM on non-Linux/x86_64 hosts unless ORACLE_CONTAINER=1 is set to run the linux/amd64 oracle container. |
setup_oracle.sh |
Oracle Environment Setup: One-time configuration script provisioning the vardict-oracle conda environment. |
rgate.sh |
Rapid Developer Smoke Gate: Runs a fast \((<30\text{s})\) differential smoke-test against micro-fixtures, ideal for fast inner-loop development. |
slice.sh |
BAM Slicer Utility: Extracts local genomic intervals using samtools for rapid inner-loop fixture generation. |
trace_compare.sh |
Trace Debugger: Fine-grained differential runner producing record-level diff traces on mismatched outputs. |
3. Release Acceptance, CI Gates & Self-Test Suite¶
| Script | Purpose & Gate Coverage | Runtime |
|---|---|---|
acceptance.sh |
Master Acceptance Gate (Tier B Release Gate): Executes the 8 mandatory release criteria defined in AGENTS.md §15. Verifies workspace unit tests, 91/1 corpus parity, Tier-2 micro/macro parity, crash robustness, 5-target performance budget, truth concordance, hygiene (including crates/vardictrust-core/fuzz compile verification), and distribution equivalence. |
\(<1\text{m}\) |
recertify.sh |
Release Recertification Driver (Tier B Release Gate): One-command release recertifier that refreshes all 15 non-scale benchmarks/evidence/*.json files (reusing pinned VarDictJava/vardictcpp baselines and cached rtg vcfeval results), syncs documentation SHA-256/fingerprint tables via sync_evidence_docs.py, and runs acceptance.sh. |
\(\sim 8\text{m}\) |
sync_evidence_docs.py |
Evidence Documentation Synchronizer: Stdlib-only script updating FP, PERF_FP, scaling metrics, and the 16-row §13 SHA-256 table across README.md, omnibus-empirical-validation.md, DIVERGENCES.md, test-matrix-and-ci-audit.md, benchmarks/README.md, docs/ecosystem-survey.md, docs/release/vX.Y.Z-pr.md, and version-surface-map.md. |
\(<1\text{s}\) |
pr_check.sh |
Standard PR Regression Suite (Tier A Per-PR Gate): Enforces a 6-stage verification gate on all PRs: Hygiene (cargo fmt, lint_ratchet.sh --scan-only, 3-mode clippy -D warnings, crates/vardictrust-core/fuzz compile check, 934 workspace tests), Crash Robustness, 91/1 Corpus (8 workers), Tier-2 Parity (micro, s1a..s9, 17-modality --no-record, run_portable_invariants.sh, 18-slice --no-record), 5-Target Performance Budget, and Gitleaks secret scanning. |
\(<25\text{s}\) |
run_portable_invariants.sh |
Portable Zero-JVM CI Invariant Gate: Fast (\(<12\text{s}\)), POSIX-clean gate running strictly on git-tracked BAM/FASTA/BED/SAM fixtures in pr_check.sh and differential.yml Step 5. Verifies --compat=off --vcf-all-alleles --output out.vcf.gz --csi, --preset {wgs,wes,amplicon,ctdna,hifi,ont}, fgumi-free consensus-UMI (Switch 42 NM neutralization, duplex_cnt balancing, -t MI retention) & 24h FFPE --orientation-bias[=annotate], universal .var/.vcf schema & depth/ALD accounting, bcftools norm --check-ref e + tabix/bcftools view -r, multi-modal Tiled == Untiled conservation, live portable BAM == CRAM (samtools view -C -T), and --vcf-all-alleles vs var2vcf_{valid,paired}.pl -A. |
\(<12\text{s}\) |
run_self_tests.sh |
Diagnostic Self-Test Harness: Discovers and executes all 37 diagnostic test scripts (25 shell tests and 12 Python test suites in harness/tests/), reporting unified status and elapsed milliseconds. |
\(<10\text{s}\) |
setup_hooks.sh |
Git Hooks Configuration: Configures repository Git hook path to .githooks/ (git config core.hooksPath .githooks), activating fast local pre-commit hygiene and secret checks. |
\(<1\text{s}\) |
engine_fingerprint.sh |
Release Engine Fingerprinter: Computes a 16-character SHA-256 hash across engine source code (crates/*/src), comparator drivers, and locked dependencies (Cargo.lock). Guarantees evidence records are tied to an exact, unmutated engine commit. |
\(<1\text{s}\) |
bin_equiv.sh |
Binary Equivalence Gate: Validates that statically-compiled x86_64-unknown-linux-musl release binaries produce identical variant calls to glibc binaries. |
\(<30\text{s}\) |
check_release_consistency.py |
Release Consistency & Evidence Validator: Stdlib-only validator ensuring all 20 version-bearing files, 934 workspace test counts (with opt-in live --verify-cargo-list), engine fingerprints (FP & PERF_FP), and 16 benchmarks/evidence/*.json SHA-256 manifests match for --phase {pre-tag,post-tag,post-bioconda,post-nfcore} (with --require-head-fingerprint at release cut). |
\(<1\text{s}\) |
lint_ratchet.sh |
No-Panic & Zero-Allow Production Lint Ratchet: Enforces zero unwrap, expect, panic!, unreachable!, todo!, unimplemented!, dbg!, print*!, string-slice, and unchecked indexing calls plus unsafe_code discipline across crates/vardictrust-core/src/ and crates/vardictrust/src/ (AGENTS.md §9). |
\(<1\text{s}\) |
4. Benchmark Runners, Truth Evaluators & Asset Management¶
| Script / Asset | Description |
|---|---|
assets.tsv |
Asset Registry: Declarative 6-column manifest (group, name, url, md5, sha256, dest) tracking all external public genomic references and truth sets (SEQC2, GIAB HG008, GIAB HG002). |
fetch_data.sh |
Safe Asset Downloader: Reads assets.tsv, downloads external biological assets atomically via curl, enforces SHA-256 checksums (fail-closed unless --allow-legacy-md5 is passed for archival legacy-MD5 rows), and records provenance in benchmarks/MANIFEST. |
stage_g4.sh |
Turnkey Cohort Stager: Idempotent orchestrator (all, refs, amplicon, hg002, hg008, seqc2, multimodal) that unpacks reference FASTAs, builds .fai and RTG .sdf indices, aligns SEQC2 BAMs, derives engine/eval BEDs, and streams all benchmark slices. |
convert_fastas.py |
CI Reference Materializer: Reconstructs dense reference .fa and .fa.fai files from upstream VarDictJava/testdata/fastas/*.fa.csv in \(<10\) seconds using pure Python (zero external dependencies). |
run_integration.sh |
Corpus Runner: Executes all 92 upstream VarDictJava integration test cases (VarDictJava/testdata/integrationtestcases/). Auto-materializes FASTAs via convert_fastas.py if missing. Verifies actual output against pinned live-oracle SHA-256 for XFAIL fixtures. Asserts 91 PASS / 1 verified XFAIL (0 FAIL / 0 SKIP / 0 XPASS). |
integration_xfail.tsv |
Defect Registry: Declarative 6-column TSV tracking authorized upstream fixture defects (UB-4), rationale, and live-oracle SHA-256 signatures (expected_sha256) to prevent silent regressions. |
get_hg002_slice.sh |
HG002 HTTP BAM Slicer: Downloads the remote 20 Mbp euchromatic GIAB HG002 slice from public AWS S3 without fetching the 100+ GB whole-genome BAM. |
get_hg008_slice.sh |
HG008 HTTP BAM Slicer & CRAM Twin Builder: Streams paired Tumor (195×) and Normal (169×) GIAB HG008 slices over HTTPS, derives slices.bed/engine.bed/eval.bed, and encodes HG008-{T,N}.slice.cram twins. |
cram_twin.sh |
HG008 CRAM-vs-BAM Twin Driver: Runs paired Tumor/Normal CRAM vs BAM calling on GIAB HG008 and asserts 100% bitwise VCF identity and CRAM-to-BAM wall ratio \(\le 2.50\times\). |
run_hg002.sh |
HG002 Benchmark Driver: First-class automated runner executing HG002 Tier-2 dual-engine comparison and RTG vcfeval truth concordance. |
scale_bench.sh |
Scaling Benchmark Driver: Runs whole-chromosome 1 scaling benchmarks across thread allocations (1, 2, 4, 8 threads), measuring speedup and memory linearity. |
profile.sh |
Profiling Driver (issue #30): profile.sh {baseline,optimized} [--only <cell>] [--dry-run] runs the Rust engine only on 32 default cells across all README.md operational modalities (tiny, s1a, s1b, s8, s9, s3, s4, s5, s6, s7, amplicon, crispr, rna-i, hg005, seqc2-fisher, seqc2-slices, 12 ext-* CLI flag modes, hg002, hg008, hg008-cram, wgs-scale) plus 5 opt-in cells (hg002-sub, hg008-sub, hg008-cram-sub, seqc2-slices-sub, seqc2-exome) with the profile-cpu / profile-heap / profile-dhat builds, each through courtesy.sh (and a systemd-run MemoryMax=14G scope for dhat and the large cells; dhat never runs on full HG002/HG008/SEQC2/WGS), records /usr/bin/time -v, and writes scratch/profiles/<tag>/<cell>/ plus catalog.md. Refuses to write under benchmarks/evidence/. |
profile_catalog.py |
Profile Catalog Ranker: stdlib-only profile_catalog.py <cell-dir>... -o catalog.md [--min-pct 2]; ranks CPU self time, dhat bytes/blocks and jemalloc heap bytes by the innermost vardictrust_core:: frame, decodes the pprof heap.pb.gz with a hand-written protobuf reader, writes full-stack *-collapsed.txt files, renders dhat-*.svg when inferno-flamegraph is on PATH, and links every flamegraph SVG from the catalog. |
perf_budget.py |
Performance Budget Verifier: Evaluates execution time and peak memory against VarDictJava baselines across 5 targets (HG008, SEQC2, HG002, Amplicon, HG008 CRAM twin), asserting Rust \(\le\) Java wall time and RSS. |
run_multimodal_slices.sh |
Multi-Modal Multi-Slice Parity Suite: Executes dual-engine live oracle verification across 18 non-overlapping biological slices from 6 diverse public datasets spanning 9 distinct chromosomes. Asserts 18/18 MATCH and writes benchmarks/evidence/multimodal-slices-tier2.json. |
get_multimodal_slices.sh |
Multi-Modal Slice Streamer: Ingests and streams 18 non-overlapping slices across 6 public datasets (COLO829, Platinum NA12878, SEQC2, GIAB HG005, Amplicon, RNA-seq) consuming \(<150\text{ MB}\) disk space. |
run_extended_coverage.sh |
Extended Modality Parity Suite: Verifies dual-engine parity across 17 caller modalities including RNA splicing (-i), CRISPR cut sites (-J/-j), <INV>, <DUP>, and CLI flag permutations (-u -UN, --adaptor, -k 0, -U, -K, -t, -3, -O, -x, -s -e, -M, --deldupvar, --DP ERR). Asserts 17/17 MATCH. |
get_wave4_public_slices.sh |
Wave-4 Clinical Amplicon, ctDNA & SV Slice Stager: Idempotently stages SHA-256-verified public clinical cohorts (ENA SRP295113 QIAseq SPE, 0.5% ctDNA dilution, Illumina PE, and Ion Torrent SE panels aligned to GRCh38.d1.vd1.fa with Figshare 13511829/19128005 truth sets, PolinaBevad/VarDictJava BRCA2 adaptor_insertion.bam, MUC19 paralog somatic pair, and clintval/vartovcf SV fixtures) under $DATA_ROOT/scratch/g4/wave4/. |
get_v120_public_slices.sh |
v1.2.0 UMI, FFPE, HiFi, ONT/ONT-UL & RNA-Seq Slice Stager: Idempotently stages SHA-256-verified public slices across Modalities 13–17 (ENA PRJNA412416 SRR6109255/SRR6109262 fgumi 0.9.0 duplex TP53 & SRP295113 simplex QIAseq SPE, FDA SEQC2 24h FFPE HCC1395/HCC1395BL, NIST GIAB HG002/HG003 PacBio Revio HiFi & PromethION ONT-UL, HG002 CMRG complex-medically-relevant genes, NIST GIAB HG008-T\|N somatic HiFi & ONT R10.4.1 + V0.6 somatic SV windows, and NIST GIAB HG002 STAR mRNA-Seq GM24385 LCL & GM26105 iPSC) under $DATA_ROOT/scratch/g4/v120/. |
verify_public_data.py |
Single-Pass Public-Data Omnibus Verifier: Stdlib-only DAG runner (--suite {wave4,wave5,presets,wave6,v120,hifi,ont,rnaseq,ablation,tiling,all}) consolidating 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 verification (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 preventing VarDictJava#197/#384 whole-chromosome OOM). |
verify_wave4_public_data.sh |
Wave-4 Compatibility Shim (--suite wave4): POSIX-clean wrapper delegating the 7 Wave-4 clinical suites (raw -f Perl parity, vardictcpp v2..v4 CLI aliases, multi-allelic somatic continuation, TruSeq adapter chimera suppression, bcftools norm --check-ref e + tabix SV anchoring, QIAseq SPE -sp sensitivity, and paired somatic amplicon BAM/CRAM calling) to verify_public_data.py. |
verify_wave5_public_data.sh |
Wave-5 Compatibility Shim (--suite wave5): POSIX-clean wrapper delegating the 7 Wave-5 clinical and validator gates (multi-BGZF-block --csi spanning-SV tabix & bcftools view -r queries clintval/vartovcf#161, SEQ-matched hard-clip BAM twins, 100% .var/.vcf accounting & non-negative QUAL, IUPAC FASTA reduction & <...> bracket safety, bounded -L enforcement, -p homopolymer coordinate retention, and strict VCF schema + diploid rtg vcfeval) to verify_public_data.py. |
verify_presets_public_data.sh |
Presets Compatibility Shim (--suite presets): POSIX-clean wrapper delegating the --preset wgs\|wes\|amplicon\|ctdna\|hifi\|ont clinical and long-read workflow gates (BED3/BED4 3'_UTR/UCSC BED8 non-hijack, paired Illumina PE & QIAseq -sp, ~1,000x 0.5% VAF ctDNA titration, d100 override precedence, -R coordinate invariance, and negative CLI guards) to verify_public_data.py. |
verify_wave6_public_data.sh |
Wave-6 Compatibility Shim (--suite wave6): POSIX-clean wrapper delegating the 5 Wave-6 49-switch public truth-set and invariant gates (bcftools norm --check-ref e 5' left-alignment & distinct-END <DUP> preservation, indel-only SHIFT3, -u mate-overlap bidirectional ALD balance, zero paired somatic shadow collisions, and multi-cohort rtg vcfeval concordance) to verify_public_data.py. |
concordance_multimodal.sh |
Multi-Modal Truth Concordance Suite: Automated runner executing dual-engine calling and rtg vcfeval concordance for GIAB HG005 (GRCh38) and GIAB NA24385 (GRCh37/b37) against NIST v4.2.1 truth sets with offline caching in scratch/g4/truth_cache/. Asserts EQUAL (0 site diffs). |
concordance.sh |
Somatic Truth Evaluator: Executes Real Time Genomics rtg vcfeval with --squash-ploidy for somatic variant truth comparisons. |
concordance_germline.sh |
Germline Truth Evaluator: Assesses germline variants against NIST truth, reporting dual thresholds (unfiltered discovery baseline and optimal QUAL >= 128 operating point). |
concordance_pair.sh |
Dual-Engine Truth Concordance: Compares RTG truth concordance metrics between VarDictJava and VarDictRust, asserting 100% identical site lists. |
courtesy.sh |
Host Etiquette Wrapper: Cooperative multi-tenant cluster resource etiquette: limits concurrency to \(\le 8\) threads, runs at nice -n19 ionice -c3, ensures disk/memory headroom (MIN_FREE_GB=150, MIN_AVAIL_GB=12), and guards against execution during scheduled host maintenance windows. |
memwatch.sh |
Memory Watchdog: Background daemon monitoring process tree RSS to prevent system OOM conditions. |
5. Slices Catalogue¶
The slices.tsv index and slices/ directory define targeted genomic intervals extracted from deep sequencing datasets to exercise specific caller behaviors:
s1a,s1b: High-depth NA24385 exome intervals exercising single-nucleotide variant calling and HashMap iteration stability.s2: Complex indel intervals exercising local realignment and Smith-Waterman gap alignments.s3,s4: Paired tumor/normal exome intervals (Colo829) exercising SomaticMode classification and LOH detection.s5,s6: Targeted amplicon assay intervals exercising primer-trimming logic andAMPBIASfiltering.s7,s8,s9: Deep WGS high-depth regions exercising structural variant calling (<DUP>,<INV>, deletions).tiny: 4-variant micro interval for rapid inner-loop smoke testing.data/grch38_exclude_ig_hla.bed: Genomic mask excluding hypervariable immunoglobin and HLA loci on GRCh38.
6. Meta-Test Suite (harness/tests/)¶
The harness contains an internal self-test suite (37 test scripts: 25 shell tests and 12 Python unit test suites / 159 unit tests) verifying that the harness tools, comparators, and zero-dependency environment contracts function correctly:
The runner dynamically discovers and executes:
- 25 Shell Tests: test_bench_profile.sh, test_compare_sh.sh, test_concordance.sh, test_concordance_sv.sh, test_courtesy.sh, test_edge_cases.sh, test_env_pinned.sh, test_evidence.sh, test_fetch_data.sh, test_gate_command_parity.sh, test_gcp_paper_runner.sh, test_git_hooks.sh, test_golden_wiring.sh, test_no_gnu_isms.sh, test_oracle_platform.sh, test_oracle_r_canary.sh, test_perf_budget.sh, test_perf_pr.sh, test_portable_shell.sh, test_profile_sh.sh, test_release_deps.sh, test_run_cpp.sh, test_run_oracle.sh, test_scale_bench.sh, test_seqc2_align.sh.
- 12 Python Test Suites (159 unit tests): test_bioconda_recipe.py (24 tests), test_compare_vcf.py (18 tests), test_docs_ui.py (19 tests), test_evidence_inputs.py (10 tests), test_golden_store.py (42 tests), test_linkedin_carousel.py (2 tests), test_perf_budget.py (6 tests), test_profile_catalog.py (20 tests), test_release_workflows.py (10 tests), test_select_slice_regions.py (4 tests), test_stdlib_purity.py (1 test, AST zero-PyPI import guard), test_vcf_header.py (3 tests).
All 37 diagnostic test scripts pass 100% green.
7. Golden baseline store¶
The Golden Baseline Store (harness/golden_store.sh, implemented via harness/golden_store.py in pure Python stdlib) caches and replays pinned oracle baseline outputs across differential testing runs. Because VarDictJava v1.8.3 is archived and immutable (commit 0886261) and vardictcpp 3 is pinned to hc52dbad_0 in benchmarks/env/vardict-oracle.yml, an oracle invocation on identical biological inputs and CLI arguments produces identical output. Caching these baselines eliminates redundant oracle compute, reducing local test and re-certification cycles from hours to seconds while preserving byte-for-byte and strict float differential rigor.
7.1 Store Layout & Storage Mechanics¶
By default, the store resides at scratch/golden-store/ (configurable via GOLDEN_STORE_DIR). CI environments and fresh repository clones start with an empty store directory and therefore execute all oracle arms live:
scratch/golden-store/
├── cells/
│ └── <key>/
│ ├── manifest.json
│ ├── <n>/
│ │ ├── out[.gz]
│ │ ├── err
│ │ └── time[.gz]
│ └── .lock
├── stats.log
└── .shacache.json
cells/<key>/: Unique directory per execution signature key (a 16-character hex SHA-256 digest).manifest.json: Cell metadata log recording the key, schema version, oracle kind (javaorcpp), package pins, environment recipe SHA-256, wrapper script SHA-256, input file SHA-256 hashes, normalized argument list, environment variables, artifact metadata, host profile, UTC timestamp, and revision history.<n>/: Revision subdirectory (0,1, ...) containing run artifacts:outorout.gz: Captured stdout / output VCF or table (automatically compressed with gzip if raw size \(\ge 1\text{ MB}\)).err: Captured stderr diagnostic stream.timeortime.gz: Captured/usr/bin/time -vresource telemetry (wall clock time, peak RSS, exit code)..lock: Atomic, portablemkdir-based directory lock protecting concurrent access to the cell across worker processes. Stale locks older than 600 seconds (LOCK_STALE_S) are automatically reclaimed.stats.log: Append-only TSV event ledger tracking UTC timestamps,GOLDEN_RUN_ID, cache events (HIT,MISS,REGEN,CORRUPT,FAIL,REFUSED,UNSTABLE,PINFAIL,OFF), oracle kind, cell key, and invocation labels..shacache.json: Mtime/size-keyed SHA-256 cache preventing repeated hashing of large FASTA reference genomes and BAM files (bypassed whenGOLDEN_REHASH=1).
7.2 Key Derivation & Exclusions¶
The cell key is computed as a SHA-256 digest over everything that influences oracle execution:
1. Oracle kind (java or cpp).
2. Package pin (vardict-java=1.8.3 or vardictcpp=3) and benchmarks/env/vardict-oracle.yml SHA-256.
3. Wrapper script SHA-256 (harness/run_oracle.sh or harness/run_cpp.sh, or GOLDEN_ORACLE_CMD / GOLDEN_CPP_CMD overrides).
4. Content SHA-256 hashes of all input files (reference FASTA, FASTA .fai index, BAM/CRAM files, BED intervals).
5. Normalized command-line arguments: input file paths in argv are normalized to @IN0, @IN1, ... so different worktrees or checkouts on the same machine share identical cache cells.
- Literal arguments: The reference FASTA path argument (-G <ref>) is intentionally kept literal rather than normalized because VarDictJava embeds the reference path verbatim in the ##reference= VCF header line, and VCF header comparators validate exact match.
- Thread count: Thread arguments (-th <N>) remain in the key so that performance timing records (time -v) are never conflated across thread counts.
6. Execution environment variables: AF_THR, LC_ALL, LANG (and CPP_CHUNK for C++).
7.3 Operational Modes (GOLDEN_MODE)¶
The operating mode is configured via the GOLDEN_MODE environment variable:
- auto (default): Uses cached baseline cells when available; executes live and pins on miss.
- regen: Forces live execution of the oracle and appends a new revision <n>/ to the cell manifest, re-pinning the baseline.
- off: Bypasses the golden store entirely. GOLDEN_MODE=off is how to re-prove the oracle environment, forcing live execution of VarDictJava and vardictcpp against all test cases. In default mode, the pre-push micro compare replays pinned Java once the store is populated, and evidence time_ms for test suites (such as run_multimodal_slices.sh) measures VarDictRust execution plus replay time.
7.4 Pin Rejection Conditions¶
An oracle execution is pinned into the store on exit code 0 only if all validity invariants hold. If an invariant is violated, the run exits normally with its native return code, but the output is discarded from the store under a logged rejection event:
- FAIL: Non-zero exit code or missing target output file.
- REFUSED: Implausible output, such as empty output and empty stderr, or a Java VCF output lacking the mandatory #CHROM header line.
- UNSTABLE: An input file's size or timestamp changed while the oracle was running.
- PINFAIL: Filesystem write failure or permissions error during artifact storage.
7.5 Kill-Switch, Corruption Recovery & Verification¶
- Automatic Kill-Switch & Live Fallback: When a cached cell is read during replay,
golden_store.pyverifies the SHA-256 checksum of every artifact (out,err,time). If any artifact is corrupted or truncated, replay is aborted, aCORRUPTevent is logged, and the harness immediately falls back to a live oracle execution, storing a clean new revision<n+1>/. - Integrity Verification:
Scans all manifests across
scratch/golden-store/cells/and verifies every artifact against its recorded SHA-256 hash. Exits 1 if any cell is corrupt. Becauseverifyre-hashes every artifact in the store, runtime grows with total store size. - Remedy for Obsolete or Corrupted Cells:
To safely retire a cell without corrupting the append-only history or racing active workers:
Tombstoning appends
# 1. Locate the cell key bash harness/golden_store.sh list # 2. Tombstone the obsolete key with a documented rationale bash harness/golden_store.sh tombstone <key> "corrupt artifact recovered live"{"tombstone": true, "reason": "..."}tomanifest.json. Subsequent invocations treat the cell as absent, executing live and re-pinning a fresh entry.
7.6 Host-Bound Performance Telemetry & Platform Isolation¶
Replay of /usr/bin/time -v resource metrics (time or time.gz) is strictly restricted to the same host where measurements were taken. golden_store.py records host hardware and platform attributes (cpu model name, nproc core count, os, machine, and R's .Machine$sizeof.longdouble as r_sizeof_longdouble) in manifest.json. Because R's fisher.test() MLE (uniroot + dnhyper) in teststrandbias.R and testsomatic.R relies on x87 80-bit extended precision (sizeof(long double) == 16 on Linux/x86_64), running the oracle natively on Darwin/arm64 (sizeof(long double) == 8) or Linux/aarch64 diverges on boundary odds ratios (e.g. c(9,6,5,1) rounding to 0.31604 instead of 0.31603). Therefore:
- run_oracle.sh and compare.sh fail fast (exit code 2, ORACLE-PLATFORM) on non-Linux/x86_64 hosts unless ORACLE_CONTAINER=1 is set to dispatch the oracle inside a linux/amd64 container (docker run --rm --platform linux/amd64 ...).
- golden_store.py preserves exact 16-hex SHA-256 cell IDs on Linux-x86_64 while appending "platform": "<os>-<machine>" to the cell key payload on non-Linux-x86_64 hosts so non-Linux-x86_64 runs never collide with or poison Linux-x86_64 golden cells.
- If a cell is accessed on a different machine, output artifacts (out and err) are replayed, but the time sidecar is omitted and timing falls back to live measurement. This preserves the invariant of AGENTS.md §14: deterministic variant calling outputs gate globally, but host-dependent runtime and memory metrics are never conflated across hardware architectures.
7.7 Telemetry, Stamping & Evidence Blocks¶
- Setting
GOLDEN_RUN_ID=<uuid>groups all operations from a test run instats.log. - Benchmark runners query store statistics to embed cache provenance into committed evidence files:
This emits a structured JSON block (
hit,live,events) stored directly underextra.goldeninbenchmarks/evidence/*.json. - Gate scripts verify cache hit rates using the
--min-hitassertion:
7.8 No-Waiver Gates & Scale Carry Rules¶
- Zero Acceptance Waivers: Every acceptance gate in
harness/acceptance.shis strictly PASS or FAIL. The acceptance gate enforces zero waivers; every gate must pass cleanly or fail loudly. - Scale Carry Rule: Whole Chromosome 1 scale benchmarks (
benchmarks/evidence/scale.json, Item 5) require substantial host compute time (\(\approx 7\text{ hours}\) across 3 median runs). Benchmark evidence is carried forward between releases only while performance-relevant engine code remains unchanged, as validated by: Ifextra.perf_fingerprintinscale.jsondiffers from the current engine perf fingerprint, Item 5 fails and requires recertification. - Certifying Scale Invocation: To generate certified scale benchmark evidence on qualifying hardware:
- Requires courtesy scheduling wrapper (
COURTESY_ACTIVE=1,nice -n 19, disk headroom \(\ge 150\text{ GB}\), memory \(\ge 12\text{ GB}\)). - Scheduled run start must fall between 05:15 and ~20:30 to avoid the nightly 03:40–05:15 host maintenance window.
- Requires default core pin
SCALE_CPUS=0-7with \(P \ge 4\) distinct physical cores to satisfy the pre-registered speedup bar \(\text{bar}(P) = 0.6 \cdot \min(8, P) = 2.4\times\). - C++ Region Arm Notice: In
scale_bench.sh, the C++ region scaling arm is executed as a BED run throughrun_cpp.sh(converting-R chr:start-endinto an equivalent 0-based BED interval). Consequently,cpp_*numbers inscale.jsonare not directly comparable to pre-#31 measurements.
8. Reproducible Engine Profiling (harness/profile.sh & harness/profile_catalog.py)¶
harness/profile.sh and harness/profile_catalog.py drive reproducible multi-modality profiling (profile-cpu 499 Hz pprof, profile-heap tikv-jemalloc-ctl live heap, and profile-dhat dhat allocation-site profiler) across all benchmark modalities without contaminating production release builds (harness/tests/test_release_deps.sh enforces zero profiler crates in cargo tree -p vardictrust --no-default-features).
# 1. Multi-threaded (-th 8) full baseline / optimized profile (writes scratch/profiles/<tag>/ + catalog.md + SVGs):
bash harness/profile.sh baseline
bash harness/profile.sh optimized
# 2. Single-threaded (-th 1) baseline / optimized profile (separates algorithmic cost/RSS from 8-thread contention):
PROFILE_OUT=scratch/profiles-th1 PROFILE_THREADS=1 bash harness/profile.sh baseline
PROFILE_OUT=scratch/profiles-th1 PROFILE_THREADS=1 bash harness/profile.sh optimized
# 3. 100-iteration merged CPU profile for sub-second slice cells (<150 ms single-run duration):
for c in tiny s8 s9 s3 rna-i; do
PROFILE_LOOPS=100 bash harness/profile.sh baseline --only "$c"
done
# 4. Bounded sub-window dhat allocation-site profiles on HG002 (594.5 kb) and HG008 somatic (774.7 kb):
bash harness/profile.sh baseline --only hg002-sub
bash harness/profile.sh baseline --only hg008-sub
# 5. Re-build markdown catalog + SVG flamegraphs across all profiled cell directories:
python3 harness/profile_catalog.py scratch/profiles/baseline/*/ -o scratch/profiles/baseline/catalog.md
For detailed workflow guides on using the harness for profiling, pull request verification, issue triage, and multi-channel releases, see the repository Agent Skills in ../.agents/skills/:
- vardictrust-profiling (Rust API & MALLOC_CONF reference)
- vardictrust-pr
- vardictrust-issue
- vardictrust-release (20-surface map)