Files
boxmaker/crates/bxctl/tests/verify_skipped.rs
T
kyleandClaude Opus 5.5 2b3ae080b4 proto becomes bxcore, the one shared crate (M5b task 00)
Done the way the owner asked and the spike mapped: the crate and the
manifests renamed, then what the build reported fixed. Layers: 138
"proto unresolved" errors across 169 files; cargo fmt reordering
imports; six fixture paths built as strings in brokerd's and bxctl's
tests, which the compiler cannot see, and comments naming
crates/proto/; the crate-dependency check and its self-test. One more
the spike did not reach: a `\nproto =` key inside a printf format in
the self-test, which a word-boundary replacement skips because `n` and
`p` are both word characters.

make gate: gate: ok, 944 tests; no new entry in /tmp.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 01:48:38 -07:00

40 lines
1.4 KiB
Rust

//! `bxctl audit verify` says which files in `audit/` it did not read: a file that looks like a
//! log but is not named as one is ignored by `brokerd` too, and "ok" must not seem to cover it.
#[path = "support/temp.rs"]
mod temp;
use std::path::PathBuf;
fn home(tag: &str) -> temp::TempDir {
let dir = temp::TempDir::new(&format!("bx-verify-skip-{tag}"));
std::fs::create_dir_all(dir.join("audit")).unwrap();
let fixture =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../bxcore/tests/fixtures/audit/good");
for entry in std::fs::read_dir(fixture).unwrap() {
let entry = entry.unwrap();
std::fs::copy(entry.path(), dir.join("audit").join(entry.file_name())).unwrap();
}
dir
}
#[test]
fn a_stray_jsonl_file_is_named_and_the_log_still_verifies() {
let dir = home("stray");
std::fs::write(dir.join("audit/2026-0x-19.jsonl"), "x\n").unwrap();
std::fs::write(dir.join("audit/notes.txt"), "not a log\n").unwrap();
let mut out = Vec::new();
let ok = bxctl::verify::run(&dir, &mut out).unwrap();
let text = String::from_utf8(out).unwrap();
assert!(ok, "{text}");
assert!(text.starts_with("audit: ok, 10 records"), "{text}");
assert!(
text.contains("not an audit log file, not checked: 2026-0x-19.jsonl"),
"{text}"
);
assert!(
!text.contains("notes.txt"),
"only files that look like logs: {text}"
);
let _ = std::fs::remove_dir_all(&dir);
}