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 {
1140 /// checkout without the oracle should still run the rest of the suite),1140 /// checkout without the oracle should still run the rest of the suite),
1141 /// but `EC_AV1_REQUIRE_AOMENC=1` turns it into a hard failure so a batch1141 /// but `EC_AV1_REQUIRE_AOMENC=1` turns it into a hard failure so a batch
1142 /// run cannot report green off 20 skipped gates.1142 /// 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+
1143 fn have_aomenc() -> bool {1157 fn have_aomenc() -> bool {
1144 let present = aomenc_path().is_file();1158 let present = aomenc_path().is_file();
1145 assert!(1159 assert!(
@@ -2071,14 +2085,22 @@ mod tests {
2071 // clean rerun -> subprocess instability; reference bytes2085 // clean rerun -> subprocess instability; reference bytes
2072 // differ -> ffmpeg instability; both stable -> real decode2086 // differ -> ffmpeg instability; both stable -> real decode
2073 // defect) without relying on the env var being set.2087 // defect) without relying on the env var being set.
2074- let sp = "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\2088+ // The pin goes to `fixtures/`, which outlives the session: an
2075- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad";2089+ // earlier version wrote to a session scratchpad, so once tmpfs
2076- std::fs::write(format!("{sp}/cdfflake-stream-seed{seed}.bin"), &stream)2090+ // reaped it a real mismatch aborted on the write instead of
2077- .expect("writing pinned stream");2091+ // reporting itself. A failed write must not mask the assert
2078- std::fs::write(format!("{sp}/cdfflake-ffmpeg-raw-seed{seed}.bin"), &ffmpeg_raw)2092+ // below either, so it warns rather than panicking.
2079- .expect("writing pinned ffmpeg reference");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+ }
2080 eprintln!(2101 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()
2082 );2104 );
2083 }2105 }
2084 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {2106 for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
@@ -2105,12 +2127,17 @@ mod tests {
2105 #[test]2127 #[test]
2106 #[ignore = "reads a pinned fixture path outside the repo; run manually"]2128 #[ignore = "reads a pinned fixture path outside the repo; run manually"]
2107 fn pinned_golden3_stream_decodes_pixel_exact() {2129 fn pinned_golden3_stream_decodes_pixel_exact() {
2108- let path = std::env::var("EC_AV1_GATE_DUMP_PIN").unwrap_or_else(|_| {2130+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2109- "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\2131+ .map(std::path::PathBuf::from)
2110- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad/golden3-pin.obu"2132+ .unwrap_or_else(|_| pin_dir().join("golden3-pin.obu"));
2111- .to_string()2133+ let Ok(stream) = std::fs::read(&path) else {
2112- });2134+ eprintln!(
2113- let stream = std::fs::read(&path).expect("reading pinned stream");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+ };
2114 if !have_ffmpeg() {2141 if !have_ffmpeg() {
2115 eprintln!("SKIP pinned_golden3_stream_decodes_pixel_exact: no ffmpeg");2142 eprintln!("SKIP pinned_golden3_stream_decodes_pixel_exact: no ffmpeg");
2116 return;2143 return;
@@ -2133,12 +2160,17 @@ mod tests {
2133 #[ignore = "reads a pinned fixture path outside the repo; run manually"]2160 #[ignore = "reads a pinned fixture path outside the repo; run manually"]
2134 fn pinned_golden4_stream_decodes_pixel_exact() {2161 fn pinned_golden4_stream_decodes_pixel_exact() {
2135 use crate::decode::non_last_ref_hits;2162 use crate::decode::non_last_ref_hits;
2136- let path = std::env::var("EC_AV1_GATE_DUMP_PIN").unwrap_or_else(|_| {2163+ let path = std::env::var("EC_AV1_GATE_DUMP_PIN")
2137- "/tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/\2164+ .map(std::path::PathBuf::from)
2138- 51b5f611-f998-43a8-b975-e64cb643a3e1/scratchpad/golden4-pin.obu"2165+ .unwrap_or_else(|_| pin_dir().join("golden4-pin.obu"));
2139- .to_string()2166+ let Ok(stream) = std::fs::read(&path) else {
2140- });2167+ eprintln!(
2141- let stream = std::fs::read(&path).expect("reading pinned stream");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+ };
2142 if !have_ffmpeg() {2174 if !have_ffmpeg() {
2143 eprintln!("SKIP pinned_golden4_stream_decodes_pixel_exact: no ffmpeg");2175 eprintln!("SKIP pinned_golden4_stream_decodes_pixel_exact: no ffmpeg");
2144 return;2176 return;