Skip to content

VarDictRust Contributor Guide

Welcome to the VarDictRust developer and contributor guide! VarDictRust is an idiomatic, production-grade Rust rewrite of VarDictJava v1.8.3, built under the principles of the rewrites.bio manifesto.

This document serves as the authoritative, standalone manual for developing, testing, benchmarking, and submitting contributions to the VarDictRust codebase.


1. The rewrites.bio Parity Mission

VarDictRust is built with one central commitment: to produce output identical to VarDictJava v1.8.3 on valid inputs by default (--compat=vardictjava / --parity) while scaling gracefully to deep whole-genome sequencing (WGS), with opt-in --compat=off (CompatProfile) correctness fixes and consolidated VCF capabilities.

1.1 The Prime Directive (AGENTS.md §5)

All variant calling output on valid genomic inputs must match VarDictJava v1.8.3 by default (--compat=vardictjava / --parity): - Exact Variant Parity: The variant set (CHROM, POS, REF, ALT), every FILTER decision, INFO and FORMAT tags, genotypes (GT), variant TYPE, and somatic STATUS must match upstream VarDictJava. - Float Tolerance: P-values, odds ratios, and allele frequencies must match within \(\varepsilon = 10^{-6}\), adhering strictly to IEEE 754 half-even banker's rounding (round_half_even). - Intermediate Column Counts: Intermediate .var tables must strictly adhere to upstream column schemas: - Simple Mode: 36 columns (default) / 38 columns (--fisher). - Amplicon Mode: 38 columns (default) / 40 columns (--fisher). - Somatic Mode: 55 columns (default) / 61 columns (--fisher). - Bug Emulation & Compatibility Policy (--compat=vardictjava|off): If VarDictJava v1.8.3 has an output quirk (such as SV split-read requirements or <dup-N> symbolic tokens), replicate it faithfully under the default --compat=vardictjava profile (--parity). Output-changing corrections ship only behind opt-in --compat=off (CompatProfile in crates/vardictrust-core/src/config.rs, stamping ##VarDictRustCompat=off in VCF headers — never proliferated --fix <id> CLI flags) per ROADMAP.md, while multi-allelic VCF emission mirrors var2vcf_*.pl -A via explicit --vcf-all-alleles (--all-alleles). Where VarDictJava crashes (e.g. modifyCigar #341 or NPEs), VarDictRust must produce valid output or fail fast without panicking.

1.2 Integrity: Evidence Before Assertions (AGENTS.md §0 & §0b)

  • Never claim a task is done without verifiable evidence. Evidence consists of passing harness/compare.sh (MATCH), passing cargo test, or passing harness/acceptance.sh.
  • Never fake a pass. You must never relax --eps, narrow column ranges, hand-edit golden/expected files, or skip failing fixtures to force a match. If a check fails, the Rust port is wrong: fix the port, not the test.

2. Prerequisites & Repository Setup

2.1 Cloning the Repository with Submodules

VarDictRust relies on the upstream VarDictJava test suite as a git submodule:

# Clone with all submodules initialized:
git clone --recurse-submodules https://github.com/palakpsheth/VarDictRust.git
cd VarDictRust

# Or if cloned without --recurse-submodules:
git submodule update --init --recursive

2.2 Toolchain Requirements

  1. Rust Toolchain:
  2. Rust stable (rustc >= 1.91.0, cargo, rustfmt, clippy):
    rustup update stable
    rustup component add clippy rustfmt
    
  3. Oracle Environment (VarDictJava v1.8.3):
  4. The reference oracle runs VarDictJava v1.8.3 via bioconda on Linux x86_64 (where R uses x87 80-bit long double, .Machine$sizeof.longdouble == 16, required for exact Fisher MLE parity in teststrandbias.R and testsomatic.R):
    bash harness/setup_oracle.sh
    
  5. On macOS (Darwin/arm64) or Linux/aarch64 hosts, harness/run_oracle.sh and harness/compare.sh fail fast with ORACLE-PLATFORM unless ORACLE_CONTAINER=1 is set to execute the oracle inside a linux/amd64 container (docker run --rm --platform linux/amd64 ...).
  6. Bioinformatics & Security Utilities:
  7. Tools required for testing and secret scanning: samtools, bwa, rtg-tools, and gitleaks (gitleaks is installed separately via host package manager such as brew or distro package, or an upstream release binary, rather than the conda-forge/bioconda g4-tools.yml spec; see find_gitleaks in harness/lib/portable.sh):
    # If creating via conda:
    conda env create -f harness/env/g4-tools.yml
    conda activate g4-tools
    
  8. Conda Package Manager:
  9. If conda is not installed on your system, install Miniforge or Miniconda.
  10. Reference Genomes & Test Data Ingestion:
  11. Ingest the minimal reference assets required for differential testing:
    bash harness/fetch_data.sh refs
    

2.3 The Three-Tier Environment Model (Zero-Virtualenv Architecture)

VarDictRust enforces a clear separation of toolchains across three distinct environments:

Tier Environment Scope Managed By Specification & Lockfile
Tier 1 Rust Engine Core (Compilation, benchmarks, unit tests) rustup, cargo Cargo.lock (cryptographically locked)
Tier 2 Test & Metrology Harness (VCF comparators, self-tests) System python3 (3.8+) 100% Python Standard Library (Zero PyPI / Zero Venv)
Tier 3 Genomics Oracle & Benchmarks (vardict-java, rtg-tools, samtools) Bioconda / Conda-Forge benchmarks/env/vardict-oracle.yml, harness/env/g4-tools.yml
(Ephemeral) Ad-Hoc Developer Tools (cffconvert, pre-commit) Astral uvx (Zero-install) Ephemeral user cache (no permanent virtualenv)

[!NOTE] Toolchain Tiers vs Test Verification Tiers: The Tiers in the table above classify environment isolation and package management. They are distinct from the Seven-Level Test Architecture and Differential Testing Tiers (Tier-1 .var table parity vs Tier-2 VCF parity vs Tier-3 truth concordance) described in docs/testing/test-matrix-and-ci-audit.md and harness/README.md.

No Python Virtual Environment Required: All scripts in harness/ and harness/tests/ depend exclusively on the Python standard library (argparse, json, gzip, math, subprocess, unittest). Contributors do not need to create a venv or run pip install to execute the regression harness. This zero-PyPI contract is enforced continuously by harness/tests/test_stdlib_purity.py.

2.4 Building VarDictRust

VarDictRust is built using standard Cargo workflows:

# Build debug binary (faster compile, includes debug symbols):
cargo build

# Build optimized release binary (recommended for benchmarking and production):
cargo build --release

# Inspect the compiled binary and CLI options:
./target/release/vardictrust --help
./target/release/vardictrust --version

3. Automated Pre-Commit Hook Framework

To catch formatting issues, lint warnings, and accidentally staged secrets before commits enter git history, VarDictRust supports automated pre-commit hooks.

VarDictRust includes a native bash pre-commit hook that requires no Python or pip dependencies:

bash harness/setup_hooks.sh
This configures Git to use repository-managed hooks in .githooks/ (git config core.hooksPath .githooks).

What it checks in \(<3\) seconds: 1. Staged File Filtering: If no Rust or Cargo files are staged (e.g. documentation, markdown, or shell script commits), cargo fmt and cargo clippy are skipped, completing in \(<0.3\) seconds. 2. Code Formatting: Runs cargo fmt --all -- --check. 3. Clippy Lints: Runs cargo clippy --all-targets --all-features -- -D warnings. 4. Secret Scanning: Runs gitleaks protect --staged -v using any available gitleaks installation.

Track B: Standard Python Pre-Commit (Optional)

Contributors who prefer the standard Python pre-commit framework can use .pre-commit-config.yaml:

# First unset core.hooksPath if Track A was previously active:
git config --unset core.hooksPath

# Install and activate python pre-commit:
pip install pre-commit
pre-commit install

[!NOTE] Track A and Track B are mutually exclusive. To switch back to Track A at any time, run bash harness/setup_hooks.sh. To disable all hooks, run git config --unset core.hooksPath.

3.4 Repository-Specific Agent Skills (.agents/skills/)

VarDictRust ships four repository-specific Agent Skills under .agents/skills/ that encode the repository's verification gates, profiling workflows, and release runbooks for both human contributors and AI coding agents:

Skill Path When to Use & Bundled Tools
vardictrust-issue .agents/skills/vardictrust-issue/SKILL.md Filing, triaging, or reproducing GitHub issues (default --compat=vardictjava parity/crash bugs vs v1.1+ --compat=off CompatProfile proposals) with harness/slice.sh and harness/compare.sh.
vardictrust-pr .agents/skills/vardictrust-pr/SKILL.md Opening, recertifying (harness/recertify.sh), reviewing, or squash-merging PRs, completing .github/pull_request_template.md, and replying inline to review threads.
vardictrust-profiling .agents/skills/vardictrust-profiling/SKILL.md Running profile-cpu, profile-heap, or profile-dhat via harness/profile.sh and harness/profile_catalog.py (API reference).
vardictrust-release .agents/skills/vardictrust-release/SKILL.md Cutting a release across GitHub Releases, Crates.io, Bioconda, Nextflow nf-core/modules, and ReadTheDocs (consistency validator & 20-file surface map).

Discovery across AI tools: .agents/skills/ is committed in-tree and discovered automatically by Gemini CLI, OpenAI Codex, GitHub Copilot, Cursor, and OpenCode. Contributors can also run the bundled release consistency validator directly:

python3 .agents/skills/vardictrust-release/scripts/check_release_consistency.py --version 1.2.0 --phase pre-tag --verify-cargo-list


4. Architectural Invariants & Safety

All contributions to crates/vardictrust-core/ and crates/vardictrust/ must adhere strictly to the following architectural rules:

4.1 Memory Safety & The No-Panic Rule

  • #![forbid(unsafe_code)]: The core engine crate strictly forbids unsafe code.
  • Zero Panics in Library Code: In crates/vardictrust-core/src/** (outside #[cfg(test)]), you must never use unwrap(), expect(), panic!(), unreachable!(), bare slice indexing x[i] without prior bounds checks, or arithmetic that can overflow on user input.
  • Actionable Error Propagation: Return Result<T, VardictError> with the ? operator.

4.2 Coordinate Indexing (AGENTS.md §6)

  • 0-based Coordinates (Pos0): Coordinates from BAM/SAM alignments (via noodles) are 0-based, half-open [start, end).
  • 1-based Coordinates (Pos1): VCF output and internal VarDict logic are 1-based inclusive [start, end].
  • Strict Conversions: Always convert via .to_one_based() and .to_zero_based(). Never add a raw integer to a coordinate.

4.3 Determinism & Fidelity Hazards (AGENTS.md §8)

  • Banker's Rounding: Every floating-point metric written to table or VCF output must use IEEE 754 half-even rounding via round_half_even (default --compat=vardictjava OpenJDK DecimalFormat underflow-tie parity) or round_half_even_compat (exact binary IEEE 754 ties under --compat=off). Never use Rust's default formatter rounding.
  • Java HashMap Iteration Parity: Java's HashMap iteration order is emulated using deterministic JavaHashMap, which reproduces OpenJDK 8+ hash bucket spread, binning, and iteration semantics. Never replace it with std::collections::HashMap in output or realignment paths.
  • Sequences as Bytes: Biological sequences are byte slices (&[u8] or Vec<u8>), never String.
  • Phred Quality Scores: Encoded as Phred+33: Phred(byte.saturating_sub(33)).

4.4 Bounded Memory & Scale (AGENTS.md §10)

  • Tile-and-Halo Traversal: Regions <= 1 Mbp run untiled by default (DEFAULT_UNTILED_SPAN_MAX = 1_000_000); intervals > 1 Mbp are partitioned into discrete 100 kbp tiles (DEFAULT_TILE_SIZE = 100_000, overridable via --tile-size) with overlapping read/SV halo windows, SplitVarDeduper (200 kbp cross-tile .var boundary retention), and SpillableVcfAccumulator (8 MiB whole-stream spill threshold). State is streamed through the per-tile pipeline and dropped promptly via RAII.
  • Zero Whole-Chromosome Buffering: Never load or buffer entire chromosomes in memory.

5. Testing Hierarchy & Developer Inner Loop

VarDictRust enforces a multi-tiered testing hierarchy designed for fast local iteration and exhaustive verification.

flowchart LR
    Smoke["1. Inner Loop\nharness/rgate.sh\n(<30s)"] --> Diff["2. Differential Test\nharness/compare.sh\n(Live Oracle)"]
    Diff --> PRGate["3. PR Gate\nharness/pr_check.sh\n(6 Stages)"]
    PRGate --> AccGate["4. Acceptance Gate\nharness/acceptance.sh\n(8 Items)"]

5.1 The Port Loop (AGENTS.md §7)

When porting or modifying variant calling logic, follow the rewrites.bio port loop: 1. Read the upstream VarDictJava implementation and cite it (e.g. /// ports CigarModifier.java:61-71). 2. Write the Rust code and its corresponding unit test. 3. Verify against the live oracle using harness/compare.sh. 4. Commit when differential comparison yields MATCH.

5.2 Inner Developer Loop (rgate.sh & Cargo)

For fast local iteration while coding:

# Automated compound inner loop (<30s):
bash harness/rgate.sh

# Or execute specific Cargo steps directly:
cargo test --workspace                                     # Run all workspace unit tests
cargo test -p vardictrust-core cigar                       # Run tests in a specific module
cargo clippy --all-targets --all-features -- -D warnings    # Zero-warning linter
cargo fmt --all -- --check                                 # Check code formatting
Runs code formatting checks, Clippy lints, workspace unit tests, and a quick differential smoke test against the live oracle.

5.3 Differential Testing (compare.sh)

Compare VarDictRust output against the live VarDictJava oracle:

# Simple / Germline Mode:
bash harness/compare.sh <ref.fa> <sample.bam> <regions.bed> [sample_name]

# Somatic Paired Mode (tumor|normal syntax):
bash harness/compare.sh <ref.fa> "tumor.bam|normal.bam" <regions.bed> [sample_name]

5.4 Comprehensive PR Verification (pr_check.sh — Tier A Per-PR Gate)

Before submitting any pull request, run the 6-stage PR validation suite defined in harness/pr_check.sh:

bash harness/pr_check.sh
This suite completes in <25s using the pinned golden baseline store and automatically verifies: 1. Stage 1 (Hygiene & Unit Tests): Formatting, Clippy lints, and all 934 workspace unit and integration tests (Level 1). 2. Stage 2 (Crash Robustness): PR #402, missing index #187, and Issue #341 family fixtures (executed within the workspace test run). 3. Stage 3 (Upstream Integration Corpus): 92 fixtures (Level 2) across 8 parallel workers, asserting 91 PASS / 1 XFAIL (UB-4 upstream fixture defect). 4. Stage 4 (Dual-Engine Differential Parity): Micro differential fixture, all 10 standard slices (s1a..s9), 17-modality extended coverage (--no-record), and 18-slice multimodal suite (--no-record) against the VarDictJava oracle (Level 3). 5. Stage 5 (Performance & Memory Budgets): 5-target regression budget via harness/perf_budget.py (Level 5). 6. Stage 6 (Security Hygiene): Staged and repository secret scanning with gitleaks.

5.5 Master Release Recertification & Acceptance Gate (recertify.sh & acceptance.sh — Tier B Release Gate)

When cutting a release (release/vX.Y.Z) or certifying a milestone baseline against committed benchmark evidence, run the push-button recertification and 8-item acceptance gate:

bash harness/recertify.sh
bash harness/acceptance.sh
harness/recertify.sh refreshes all 15 non-scale evidence JSONs in benchmarks/evidence/*.json (reusing pinned VarDictJava/vardictcpp baselines and cached rtg vcfeval truth evaluations), synchronizes the 16-row SHA-256 and fingerprint tables across documentation via python3 harness/sync_evidence_docs.py, and executes bash harness/acceptance.sh to enforce the 8 acceptance criteria defined in AGENTS.md §15 and docs/testing/test-matrix-and-ci-audit.md §2. (harness/scale_bench.sh is required only when bash harness/engine_fingerprint.sh --perf changed since benchmarks/evidence/scale.json.)

Additionally, contributors can execute the diagnostic self-test suite (Level 6) at any time:

bash harness/run_self_tests.sh   # Executes all 37 diagnostic test scripts in <10s

For the complete seven-level testing architecture, push-button reproduction commands, and dataset provenance catalog, see the Master Reproducibility Runbook in docs/testing/test-matrix-and-ci-audit.md.


6. Pull Request Lifecycle & Requirements

6.1 Atomic Commits

  • Use descriptive conventional commits: fix(cigar): <short description> or feat(somatic): <short description>.
  • Do not combine unrelated refactorings or formatting changes with algorithmic edits.

6.2 The Pull Request Checklist

When opening a pull request (see the vardictrust-pr skill), complete all items in .github/pull_request_template.md: - [ ] Code compiles with zero warnings: cargo clippy --all-targets --all-features -- -D warnings. - [ ] Code formatting verified: cargo fmt --all -- --check. - [ ] All unit tests pass: cargo test --workspace. - [ ] PR validation suite passes: bash harness/pr_check.sh. - [ ] No regression against the 5-target performance budget (runtime regression \(\le 5\%\), peak RSS 0% increase across HG008, SEQC2, HG002, Amplicon, and HG008 CRAM twin \(\le 2.50\times\)). - [ ] No secrets or credentials in git history (gitleaks). - [ ] Multi-skill review completed and findings fixed through /ponytail-review, /rust-router, and /pragmatic-rust-guidelines. - [ ] Waited for copilot-pull-request-reviewer[bot] review to finish; every review comment refuted or fixed with an inline reply and every review thread resolved (resolveReviewThread).

6.3 Mandatory Multi-Skill & Automated PR Review Resolution Gate (AGENTS.md §15.8)

Before merging any pull request into main: 1. Multi-Skill Audit & Fix: Run /ponytail-review, /rust-router, and /pragmatic-rust-guidelines on the PR diff (git diff origin/main...HEAD) and fix all identified correctness, ownership/mutability, error-handling, performance, and idiomatic Rust issues via Red/Green TDD. 2. Wait for Copilot PR Review Completion: Never merge a PR solely because GitHub Actions CI checks are green while copilot-pull-request-reviewer[bot] is still pending in requested_reviewers or has not posted its review for the latest commit. Poll until the Copilot review is posted:

gh api --paginate repos/palakpsheth/VarDictRust/pulls/<PR>/reviews \
  --jq '.[] | {id: .id, user: .user.login, state: .state, commit_id: .commit_id}'
3. Refute or Fix, Reply Inline, and Resolve Every Thread: For every inline comment posted by copilot-pull-request-reviewer[bot] or any other automated/human reviewer: - Evaluate the finding technically; push a surgical fix commit (or prepare a technical refutation with code/oracle evidence if the suggestion is invalid) and re-run bash harness/pr_check.sh. - Reply inline to each comment (repos/palakpsheth/VarDictRust/pulls/<PR>/comments/<COMMENT_ID>/replies). - Resolve every review thread via the GitHub GraphQL resolveReviewThread mutation before running gh pr merge <PR> --squash --delete-branch.


7. Governance & Repository Policies

Contributors must adhere to the following governance policies:

7.1 Commit Trailer Hygiene Policy

  • Strictly Zero Co-Authored-By Trailers: Do not include Co-Authored-By trailers in commit messages.
  • Transparent AI Disclosures: Machine assistance and AI tool participation are documented transparently in README.md and CITATION.cff, not in commit metadata.

7.2 Concurrency & Resource Management

  • Parallel Testing on Constrained Systems: Running heavy multi-threaded test suites (e.g. cargo test --workspace) spawns threads proportional to available logical CPU cores. On systems with constrained memory, restrict test parallelism using standard Cargo flags or environment variables:
    RUST_TEST_THREADS=4 cargo test --workspace
    # or:
    cargo test --workspace -- --test-threads=4
    
  • Differential Runner Threads: Scripts accepting thread flags (such as compare.sh -th <N>) default to multi-threaded execution. Adjust <N> to match your hardware capacity.

8. Getting Help & Security

  • Reporting Issues: Search existing issues before creating a new report (see the vardictrust-issue skill). Include the exact BAM slice, reference region, and command line to reproduce.
  • Reporting Security Vulnerabilities: Please review our Security Policy to report vulnerabilities privately. Do not disclose security issues publicly in GitHub Issues.

9. Release Process & Packaging Runbook

Releases are executed through a disciplined three-phase workflow (Pre-Release PR → Annotated Tag & CI Release → Post-Tag Downstream Sync) governed by AGENTS.md §§0, 0b, 5, 15, 18 and automated by the vardictrust-release skill (check_release_consistency.py). Direct pushes to main are blocked by .githooks/pre-push.

9.1 Release Policy & SemVer Governance

  • v1.0.x Patch / Maintenance Releases: Preserve pure byte-for-byte and floating-point parity (\(\varepsilon = 10^{-6}\)) with VarDictJava v1.8.3 on valid inputs (AGENTS.md §5). Allowed changes include crash/robustness fixes, harness/reproducibility additions, packaging, and documentation updates.
  • v1.1.0+ Feature & --compat=off Releases: Default invocations remain 100% byte-identical to VarDictJava v1.8.3 (--compat=vardictjava, aliases vardictjava-1.8.3 / 1.8.3, or --parity). Output-changing corrections to upstream VarDictJava bugs ship only behind explicit opt-in --compat=off (CompatProfile, stamping ##VarDictRustCompat=off in VCF headers) with a strict diff-confinement gate, alongside explicit opt-in CLI features (--preset, --vcf-all-alleles / --all-alleles, --amplicon-single-primer / -sp, --output, --tbi/--csi, --stats-json, --completions, --manpage) per ROADMAP.md.

9.2 Phase 1 — Pre-Release Branch, Version Bump & Fingerprint Rule

  1. Branch off fresh origin/main:
    git fetch origin
    git checkout -b release/vX.Y.Z origin/main
    
  2. Update the 20 version-bearing surfaces (18 pre-tag files; keep packaging/bioconda/recipes/vardictrust/meta.yaml and packaging/nf-core/modules/vardictrust/ for Phase 3):
  3. Cargo.toml ([workspace.package] version = "X.Y.Z") and crates/vardictrust/Cargo.toml (vardictrust-core = { version = "X.Y.Z", path = "../vardictrust-core" }), followed by cargo update -w so Cargo.lock updates only the workspace packages.
  4. CHANGELOG.md: add ## [X.Y.Z] - YYYY-MM-DD (required by cargo-dist to populate GitHub Release notes) and preserve exact Bioconda subdir names (linux-64, linux-aarch64, osx-arm64, osx-64).
  5. CITATION.cff (version and date-released), README.md (install tags and BibTeX version), .github/ISSUE_TEMPLATE/bug_report.yml, .github/SECURITY.md (active X.Y.x Supported Versions row), packaging/bioconda/prepare_bioconda_pr.sh, and packaging/nf-core/prepare_nfcore_pr.sh (VERSION="${1:-X.Y.Z}").
  6. Release certification dossier docs/release/vX.Y.Z-pr.md and release metadata references in docs/testing/test-matrix-and-ci-audit.md, docs/validation/omnibus-empirical-validation.md, DIVERGENCES.md, benchmarks/README.md, harness/README.md, zensical.toml, and wiki/.
  7. Engine Fingerprint & Live Recertification Rule (AGENTS.md §0b):
  8. harness/engine_fingerprint.sh hashes the raw HEAD:<path> git blob OIDs of all GATE_FILES (including Cargo.toml, crates/vardictrust/Cargo.toml, and Cargo.lock), so bumping X.Y.Z in Step 2 advances FP and PERF_FP and requires running bash harness/recertify.sh on release/vX.Y.Z to certify all 16 evidence JSONs in benchmarks/evidence/.
  9. If any engine source (crates/*/src), external dependency (Cargo.lock), comparator, runner, or fixture in GATE_FILES changed since the last certification, you must run bash harness/recertify.sh to re-run the live dual-engine parity suites and stamp updated evidence JSONs honestly (never hand-edit benchmarks/evidence/*.json).

9.3 Phase 1 — Commit-First Verification Sequence & Crates.io Dry-Run

Because harness/engine_fingerprint.sh enforces git diff --quiet HEAD -- "${GATE_FILES[@]}" and hashes HEAD:<path>, commit the release edits on release/vX.Y.Z (with zero Co-Authored-By trailers per §7.1) before running the harness gates:

# 1. Verify formatting, zero-warning Clippy, workspace tests, and --version output
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
RUST_TEST_THREADS=4 cargo test --workspace
cargo build --release -p vardictrust
./target/release/vardictrust --version

# 2. Commit tracked release changes on release/vX.Y.Z (clean HEAD required by engine_fingerprint.sh)
git commit -m "chore(release): prepare vX.Y.Z release"

# 3. Verify engine fingerprint and run all 37 diagnostic self-tests
bash harness/engine_fingerprint.sh
bash harness/run_self_tests.sh

# 4. Stage and verify Zensical documentation site in strict mode (then clean build dirs)
python3 harness/prepare_docs_site.py
zensical build --clean --strict
rm -rf .docs_staged site .cache

# 5. Pre-tag crates.io packaging verification
#    Note: `cargo publish -p vardictrust --dry-run` queries crates.io for `vardictrust-core = "^X.Y.Z"`,
#    which is published first by release.yml during Phase 2. Validate binary packaging via `cargo package --list`.
cargo publish -p vardictrust-core --dry-run
cargo package --list -p vardictrust

# 6. Run Tier B Release Recertification (refreshes any stale evidence JSONs, syncs documentation SHA-256/fingerprint tables, and runs acceptance.sh 8/8) + 6-stage PR gate (--no-record, zero working-tree dirtiness)
bash harness/recertify.sh
bash harness/pr_check.sh
python3 .agents/skills/vardictrust-release/scripts/check_release_consistency.py --version X.Y.Z --phase pre-tag --require-head-fingerprint --verify-cargo-list

9.4 Phase 1 — Opening & Merging the Release PR

Push release/vX.Y.Z and open a pull request to main via gh pr create, completing every section of .github/pull_request_template.md and including the mandatory validation receipt (validated vs VarDictJava 1.8.3, dataset <name>, cmd <…> per AGENTS.md §15). Merge to main once all required GitHub Actions workflows (ci.yml, differential.yml, docs.yml, security.yml) are green.

9.5 Phase 2 — Tagging main, cargo-dist SLSA Level 3 & Crates.io Publish

  1. Sync main and push an annotated SemVer tag:
    git checkout main
    git pull --ff-only origin main
    grep -q '^version = "X.Y.Z"' Cargo.toml
    git tag -a vX.Y.Z -m "VarDictRust vX.Y.Z"
    git push origin vX.Y.Z
    
  2. Automated Release Pipeline (.github/workflows/release.yml): Pushing vX.Y.Z triggers cargo-dist 0.33.0, which executes:
  3. plan: parses CHANGELOG.md for ## [X.Y.Z] and computes the 5 build targets (x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, aarch64-apple-darwin, x86_64-apple-darwin).
  4. build-local-artifacts & build-global-artifacts: compiles release archives across all 5 target triples and generates the shell installer and SHA-256 checksums (musl vs gnu VCF byte equivalence on Linux x86_64 is certified pre-tag via harness/bin_equiv.sh inside harness/recertify.sh and verified by harness/acceptance.sh Item 8).
  5. host: creates the GitHub Release and generates SLSA v1.0 Level 3 build provenance attestations via actions/attest-build-provenance.
  6. publish-crates: publishes vardictrust-core to crates.io first, then polls up to 30 × 10s for index propagation before publishing vardictrust.
  7. announce: finalizes and publishes the GitHub Release.
  8. Verify Release Artifacts & SLSA Attestations:
    gh run watch
    gh release view vX.Y.Z
    gh attestation verify --owner palakpsheth vardictrust-x86_64-unknown-linux-musl.tar.xz
    

9.6 Phase 3 — Post-Tag Bioconda, Nextflow nf-core/modules & ReadTheDocs Sync

  1. Update and test the Bioconda recipe (packaging/bioconda/recipes/vardictrust/meta.yaml): packaging/bioconda/prepare_bioconda_pr.sh enforces Rule 0b by downloading https://github.com/palakpsheth/VarDictRust/archive/refs/tags/vX.Y.Z.tar.gz directly from GitHub (refusing local git archive fallbacks):
    bash packaging/bioconda/prepare_bioconda_pr.sh X.Y.Z
    bash harness/test_bioconda_recipe.sh
    python3 .agents/skills/vardictrust-release/scripts/check_release_consistency.py --version X.Y.Z --phase post-bioconda
    
    Open and merge a follow-up PR updating packaging/bioconda/recipes/vardictrust/meta.yaml on main, and submit the recipe update to bioconda/bioconda-recipes.
  2. Update the Nextflow nf-core/modules module (packaging/nf-core/prepare_nfcore_pr.sh): Once bioconda::vardictrust=X.Y.Z is indexed on anaconda.org for both linux-64 and linux-aarch64, update environment.yml, provision multi-arch Seqera Wave containers, and update nf-test snapshots (setting NFCORE_MODULES_DIR explicitly to a trusted local nf-core/modules checkout):
    NFCORE_MODULES_DIR=/path/to/nf-core-modules bash packaging/nf-core/prepare_nfcore_pr.sh X.Y.Z
    python3 .agents/skills/vardictrust-release/scripts/check_release_consistency.py --version X.Y.Z --phase post-nfcore
    
    Once the upstream nf-core/modules PR passes all CI checks (conda, docker, singularity, nf-core lint, pre-commit) and copilot-pull-request-reviewer[bot] review, do NOT mass-ping @nf-core/maintainers or request "team_reviewers":["maintainers"] on routine nf-core/modules version-bump PRs (per @famosab on nf-core/modules#13830). Instead: (1) apply the "Ready for Review" and "update module" labels (gh api repos/nf-core/modules/issues/<nfcore-pr>/labels -X POST --input - <<< '{"labels":["Ready for Review","update module"]}'), and (2) request review in the nf-core Slack #request-review channel (or request a specific prior module maintainer such as @nvnieuwk or @SPPearce individually only when appropriate, without @nf-core/maintainers), then enqueue into the merge queue once approved (gh api graphql -f query='mutation($id: ID!) { enqueuePullRequest(input: {pullRequestId: $id}) { mergeQueueEntry { id state position } } }' -f id="$(gh api repos/nf-core/modules/pulls/<nfcore-pr> --jq '.node_id')").
  3. Sync ReadTheDocs Tags & Trigger stable + latest Documentation Builds:
    bash harness/trigger_rtd.sh sync vardictrust vX.Y.Z
    bash harness/trigger_rtd.sh build vardictrust stable
    bash harness/trigger_rtd.sh build vardictrust latest
    bash harness/trigger_rtd.sh builds vardictrust
    

9.7 Rollback, Partial-Release Recovery & Hotfix Runbook

  • Transient CI Job Failure in release.yml: If a runner experiences a transient network or registry timeout during Phase 2, re-run failed jobs via gh run rerun <run-id> --failed. If vardictrust-core already published to crates.io before publish-crates failed on vardictrust, publish vardictrust manually with cargo publish -p vardictrust or cut vX.Y.(Z+1).
  • Never Force-Move or Delete Published Release Tags: Once crates.io crates or SLSA Level 3 attestations are emitted for vX.Y.Z, never delete or force-push the tag. If a critical regression is discovered post-release:
  • Yank affected crates on crates.io: cargo yank --version X.Y.Z vardictrust && cargo yank --version X.Y.Z vardictrust-core.
  • Mark the GitHub Release vX.Y.Z as pre-release/yanked with a notice linking to the replacement version.
  • Cut and certify vX.Y.(Z+1) off main following §§9.2–9.6.