forge
Explore
Log in

Don't you dare go Hollow

Pin streams to the durable fixtures dir, not a reaped scratchpad

Browse files at this commit

ae78393a3a0633716eb51ba7ba27f382e2d784ecAhmet Kaan GümüşParent: 0a532b3
  • fix
    • pin streams to the durable fixtures dir, not a reaped scratchpad
Show full message
fix(av1): pin streams to the durable fixtures dir, not a reaped scratchpad

Three sites addressed a session scratchpad that tmpfs has since reclaimed.
Two pinned-mismatch tests could only fail on the read, so pinned_golden4 --
whose bytes do still exist under fixtures/ -- had been dead rather than
passing, and it decodes pixel-exact now that it can find them. golden3's bytes
are genuinely gone; it now skips by name and says how to re-capture.

Worse, the cdf-forwarding gate's unconditional mismatch pin wrote to that same
dead path with .expect(), so a real mismatch would have aborted on the write
instead of reporting itself. It now writes to fixtures/ and warns rather than
panicking, leaving the pixel assert to be the thing that fails.

Same class as the reaped-oracle failure that silently voided 20 gates: an
instrument parked in a session-scoped directory stops being an instrument.
crates/ec-av1/src/stream.rsmodified+51 -19
@@ -1140,6 +1140,20 @@ mod tests {
11401140 /// checkout without the oracle should still run the rest of the suite),
11411141 /// but `EC_AV1_REQUIRE_AOMENC=1` turns it into a hard failure so a batch
11421142 /// run cannot report green off 20 skipped gates.
1143+ /// Where a pinned stream lives. `fixtures/` is a symlink to a durable
1144+ /// directory outside the repo, so a pin captured in one session is still
1145+ /// there in the next; a session scratchpad is not (tmpfs reaps it, and
1146+ /// four pins were silently dead because of that).
1147+ fn pin_dir() -> std::path::PathBuf {
1148+ if let Some(p) = std::env::var_os("EC_AV1_PIN_DIR") {
1149+ return std::path::PathBuf::from(p);
1150+ }
1151+ std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
1152+ .join("../../fixtures")
1153+ .canonicalize()
1154+ .unwrap_or_else(|_| std::path::PathBuf::from("fixtures"))
1155+ }
1156+
11431157 fn have_aomenc() -> bool {
11441158 let present = aomenc_path().is_file();
11451159 assert!(
@@ -2071,14 +2085,22 @@ mod tests {
20712085 // clean rerun -> subprocess instability; reference bytes
20722086 // differ -> ffmpeg instability; both stable -> real decode
20732087 // defect) without relying on the env var being set.
2074- let sp = "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\
2075- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad";
2076- std::fs::write(format!("{sp}/cdfflake-stream-seed{seed}.bin"), &stream)
2077- .expect("writing pinned stream");
2078- std::fs::write(format!("{sp}/cdfflake-ffmpeg-raw-seed{seed}.bin"), &ffmpeg_raw)
2079- .expect("writing pinned ffmpeg reference");
2088+ // The pin goes to `fixtures/`, which outlives the session: an
2089+ // earlier version wrote to a session scratchpad, so once tmpfs
2090+ // reaped it a real mismatch aborted on the write instead of
2091+ // reporting itself. A failed write must not mask the assert
2092+ // below either, so it warns rather than panicking.
2093+ let sp = pin_dir();
2094+ let stream_pin = sp.join(format!("cdfflake-stream-seed{seed}.bin"));
2095+ let ref_pin = sp.join(format!("cdfflake-ffmpeg-raw-seed{seed}.bin"));
2096+ for (path, bytes) in [(&stream_pin, &stream), (&ref_pin, &ffmpeg_raw)] {
2097+ if let Err(e) = std::fs::write(path, bytes) {
2098+ eprintln!("cdfflake: could not pin to {}: {e}", path.display());
2099+ }
2100+ }
20802101 eprintln!(
2081- "cdfflake MISMATCH seed={seed}: pinned stream + ffmpeg reference to {sp}"
2102+ "cdfflake MISMATCH seed={seed}: pinned stream + ffmpeg reference to {}",
2103+ sp.display()
20822104 );
20832105 }
20842106 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
@@ -2105,12 +2127,17 @@ mod tests {
21052127 #[test]
21062128 #[ignore = "reads a pinned fixture path outside the repo; run manually"]
21072129 fn pinned_golden3_stream_decodes_pixel_exact() {
2108- let path = std::env::var("EC_AV1_GATE_DUMP_PIN").unwrap_or_else(|_| {
2109- "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\
2110- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad/golden3-pin.obu"
2111- .to_string()
2112- });
2113- let stream = std::fs::read(&path).expect("reading pinned stream");
2130+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2131+ .map(std::path::PathBuf::from)
2132+ .unwrap_or_else(|_| pin_dir().join("golden3-pin.obu"));
2133+ let Ok(stream) = std::fs::read(&path) else {
2134+ eprintln!(
2135+ "SKIP pinned_golden3_stream_decodes_pixel_exact: no pinned bytes at {} \
2136+ -- re-capture with EC_AV1_GATE_DUMP off the cdf-forwarding gate",
2137+ path.display()
2138+ );
2139+ return;
2140+ };
21142141 if !have_ffmpeg() {
21152142 eprintln!("SKIP pinned_golden3_stream_decodes_pixel_exact: no ffmpeg");
21162143 return;
@@ -2133,12 +2160,17 @@ mod tests {
21332160 #[ignore = "reads a pinned fixture path outside the repo; run manually"]
21342161 fn pinned_golden4_stream_decodes_pixel_exact() {
21352162 use crate::decode::non_last_ref_hits;
2136- let path = std::env::var("EC_AV1_GATE_DUMP_PIN").unwrap_or_else(|_| {
2137- "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\
2138- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad/golden4-pin.obu"
2139- .to_string()
2140- });
2141- let stream = std::fs::read(&path).expect("reading pinned stream");
2163+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2164+ .map(std::path::PathBuf::from)
2165+ .unwrap_or_else(|_| pin_dir().join("golden4-pin.obu"));
2166+ let Ok(stream) = std::fs::read(&path) else {
2167+ eprintln!(
2168+ "SKIP pinned_golden4_stream_decodes_pixel_exact: no pinned bytes at {} \
2169+ -- re-capture with EC_AV1_GATE_DUMP off the cdf-forwarding gate",
2170+ path.display()
2171+ );
2172+ return;
2173+ };
21422174 if !have_ffmpeg() {
21432175 eprintln!("SKIP pinned_golden4_stream_decodes_pixel_exact: no ffmpeg");
21442176 return;