Skip to main content

max / audiofiles

Teach the tombstone seal the sibling test-module form The seal exempts `#[cfg(test)]` modules because they assert raw table state legitimately, and it found them by cutting each file at its first `#[cfg(test)]`. Moving store's and similarity's tests into `tests.rs` siblings put that same test code in files the seal read as production, so it reported nine raw `FROM samples` reads that were always exempt. Skip files named tests.rs, for the same reason the inline module is cut.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session
https://claude.ai/code/session_01EEmeiSJnmyL98QzA5Dwsvz
Author: Max Johnson <me@maxj.phd> · 2026-09-03 22:53 UTC
Signed with PGP, not checked
Commit: 3ee56a23e7b6fa8e0b4f15ea6b93f7cbd80ea898
Parent: c373597
1 file changed, +9 insertions, -1 deletion
@@ -17,7 +17,9 @@
17 17 //! - `DELETE FROM samples` (a write, not a read).
18 18 //! - The `CREATE VIEW live_samples` definition itself.
19 19 //! - `#[cfg(test)]` modules (they legitimately assert raw table state). This
20 - //! assumes the repo convention of test modules at file end.
20 + //! assumes the repo convention of test modules at file end, and covers both
21 + //! forms that convention takes: an inline module, and a `tests.rs` sibling
22 + //! declared by `#[cfg(test)] mod tests;`.
21 23
22 24 use std::fs;
23 25 use std::path::{Path, PathBuf};
@@ -55,6 +57,12 @@
55 57 if path.extension().and_then(|e| e.to_str()) != Some("rs") {
56 58 continue;
57 59 }
60 + // A module's tests may sit inline or in a `tests.rs` beside it. Both
61 + // read raw rows legitimately, so the sibling is skipped here for the
62 + // same reason the inline module is cut off below.
63 + if path.file_name().and_then(|n| n.to_str()) == Some("tests.rs") {
64 + continue;
65 + }
58 66 let text = fs::read_to_string(&path).unwrap();
59 67 let lines: Vec<&str> = text.lines().collect();
60 68 // Test modules (conventionally at file end) legitimately read raw rows.