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>
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
//! Which file names are audit log files. `brokerd` and `bxctl audit verify` both use this one rule,
|
||
//! so they always read the same set of files.
|
||
|
||
use bxcore::is_audit_log_name;
|
||
|
||
#[test]
|
||
fn a_date_and_jsonl_is_a_log_file() {
|
||
for name in ["2026-09-17.jsonl", "0000-01-01.jsonl", "9999-12-31.jsonl"] {
|
||
assert!(is_audit_log_name(name), "{name}");
|
||
}
|
||
}
|
||
|
||
#[test]
|
||
fn every_other_name_is_not() {
|
||
for name in [
|
||
"",
|
||
".lock",
|
||
"2026-0x-17.jsonl", // the second month digit
|
||
"2026-x9-17.jsonl",
|
||
"2026-09-1x.jsonl",
|
||
"x026-09-17.jsonl",
|
||
"2026_09-17.jsonl",
|
||
"2026-09_17.jsonl",
|
||
"2026-09-17.json",
|
||
"2026-09-17.jsonl.bak",
|
||
"2026-9-17.jsonl",
|
||
"12026-09-17.jsonl",
|
||
"2026-09-17.JSONL",
|
||
"2026-09-17.jsonl", // a full-width digit is not an ASCII digit
|
||
"2026-00-17.jsonl", // no month 0
|
||
"2026-13-17.jsonl",
|
||
"2026-09-00.jsonl", // no day 0
|
||
"2026-09-32.jsonl",
|
||
"2026-99-99.jsonl",
|
||
] {
|
||
assert!(!is_audit_log_name(name), "{name}");
|
||
}
|
||
}
|