Skip to content

Commit 5fc6674

Browse files
authored
Merge pull request #93 from logannye/agent/fix-v0.4-ci
fix(ci): restore v0.4 release gates
2 parents c30246f + 156a627 commit 5fc6674

9 files changed

Lines changed: 41 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
--reference examples/data/illumina_toy/reference.fa \
145145
--reads examples/data/illumina_toy/reads_R1.fastq \
146146
--format bam \
147+
--force \
147148
--output examples/data/illumina_toy/alignments.bam
148149
- name: Call variants
149150
run: |
@@ -323,6 +324,13 @@ jobs:
323324
run: scripts/build-wasm-verifier.sh
324325
- name: Generated assets are reproducible
325326
run: git diff --exit-code -- web/verify/pkg crates/receipt-wasm/Cargo.lock
327+
- name: Upload generated assets on mismatch
328+
if: failure()
329+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
330+
with:
331+
name: receipt-studio-generated-${{ github.run_id }}
332+
path: web/verify/pkg
333+
if-no-files-found: error
326334
- name: WASM unit tests
327335
run: cargo test --manifest-path crates/receipt-wasm/Cargo.toml
328336

crates/receipt-wasm/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ crate-type = ["cdylib", "rlib"]
1818
rosalind-receipt = { path = "../receipt" }
1919
wasm-bindgen = "0.2"
2020
blake3 = "=1.8.2"
21+
22+
# wasm-opt adds a second architecture-dependent transformation. Keep the
23+
# canonical Linux/amd64 Rust/wasm-bindgen bundle directly reproducible in CI.
24+
[package.metadata.wasm-pack.profile.release]
25+
wasm-opt = false

scripts/build-wasm-verifier.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,29 @@
44
# Requires:
55
# rustup target add wasm32-unknown-unknown
66
# cargo install wasm-pack --version 0.14.0
7-
# CI sets RUSTUP_TOOLCHAIN=1.83.0 so committed output is reproducible at the MSRV.
7+
# CI sets RUSTUP_TOOLCHAIN=1.83.0. The committed bytes are canonical on the
8+
# Linux/amd64 release platform; other host architectures may emit valid but
9+
# byte-different optimized Wasm.
810
#
9-
# NOTE: RUSTFLAGS is cleared on purpose. A global `target-cpu` (e.g. the common
11+
# NOTE: RUSTFLAGS is replaced on purpose. A global `target-cpu` (e.g. the common
1012
# `~/.cargo/config.toml` with rustflags = ["-C","target-cpu=native"]) resolves to a
11-
# host CPU that is invalid for wasm32 and makes the wasm-bindgen step fail with
12-
# "failed to find intrinsics to enable `clone_ref`". Clearing it avoids that.
13+
# host CPU that is invalid for wasm32. Remapping the checkout and Cargo registry
14+
# also prevents macOS/Linux absolute paths from leaking into the committed Wasm.
1315
set -eu
1416
cd "$(dirname "$0")/.."
15-
RUSTFLAGS="" wasm-pack build crates/receipt-wasm \
17+
repo_root=$(pwd)
18+
cargo_home=${CARGO_HOME:-"$HOME/.cargo"}
19+
# Populate the registry source directory before deriving canonical remaps. This
20+
# matters in a fresh CI home where the loop below would otherwise see no crates.
21+
RUSTFLAGS="" cargo fetch --manifest-path crates/receipt-wasm/Cargo.toml --locked
22+
separator=$(printf '\037')
23+
encoded_flags="--remap-path-prefix=$repo_root=/workspace${separator}--remap-path-prefix=$cargo_home=/cargo"
24+
for registry_source in "$cargo_home"/registry/src/*; do
25+
[ -d "$registry_source" ] || continue
26+
encoded_flags="${encoded_flags}${separator}--remap-path-prefix=$registry_source=/cargo/registry/src/index"
27+
done
28+
RUSTFLAGS="" CARGO_ENCODED_RUSTFLAGS="$encoded_flags" \
29+
wasm-pack build crates/receipt-wasm \
1630
--target web \
1731
--out-dir ../../web/verify/pkg \
1832
--out-name rosalind_verify

src/call/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub enum Filter {
2323
}
2424

2525
/// ACGT index (0..=3) → uppercase ASCII base. Shared by the calling functions.
26-
pub(crate) const ACGT: [u8; 4] = [b'A', b'C', b'G', b'T'];
26+
pub(crate) const ACGT: [u8; 4] = *b"ACGT";
2727

2828
/// Tunable thresholds for germline genotyping and honest filtering.
2929
#[derive(Debug, Clone)]

src/contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ fn effective_cgroup_v2_limit_bytes() -> Option<u64> {
834834
.join("memory.max");
835835
let value = std::fs::read_to_string(path).ok()?;
836836
let value = value.trim();
837-
return (value != "max").then(|| value.parse().ok()).flatten();
837+
(value != "max").then(|| value.parse().ok()).flatten()
838838
}
839839
#[cfg(not(target_os = "linux"))]
840840
{

tests/germline_accuracy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use rosalind::{
2727
call_germline_whole_genome, GermlineCall, GermlineParams, PileupParams, StreamingBamSource,
2828
};
2929

30-
const NUCS: [u8; 4] = [b'A', b'C', b'G', b'T'];
30+
const NUCS: [u8; 4] = *b"ACGT";
3131
const N: usize = 20_000;
3232
const READ_LEN: usize = 100;
3333

tests/plan_enforce.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ fn estimator_upper_bounds_the_realized_working_set() {
439439
// contig so the reference-decode step is the RSS high-water — exactly where the
440440
// `Arc::from(Vec)` reallocation transient lives.
441441
fn pseudo_ref(n: usize) -> Vec<u8> {
442-
const BASES: [u8; 4] = [b'A', b'C', b'G', b'T'];
442+
const BASES: [u8; 4] = *b"ACGT";
443443
let mut state: u64 = 0x9E37_79B9_7F4A_7C15;
444444
(0..n)
445445
.map(|_| {

web/verify/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ cargo install wasm-pack --version 0.14.0
2222
RUSTUP_TOOLCHAIN=1.83.0 ./scripts/build-wasm-verifier.sh
2323
```
2424

25+
The committed package is generated and checked byte-for-byte on the Linux/amd64
26+
release platform. Rust's optimized Wasm code generation may differ on other host
27+
architectures even with the same target and tool versions; local builds remain
28+
valid but are not the canonical release artifact.
29+
2530
## Run locally
2631

2732
ES modules and the WASM fetch require HTTP rather than `file://`:
43.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)