brokerd: recover a torn line in place, real dates only, bounded ttl, EMFILE

From the independent review of task 23. A torn last line followed by an empty
later file had its recovery written into the later file, which broke the
chain for good; the line is now ended in its own file. The log-name rule
takes months 01 to 12 and days 01 to 31 only. [approvals] ttl_ms is limited
to a day, the longest loopd waits after a pending frame. Running out of file
descriptors or memory pauses the listener instead of stopping brokerd (the
errors the previous fix skipped do not occur on Linux). args.rs's doc fixed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-22 21:48:24 -07:00
co-authored by Claude Opus 5.5
parent ba369f82ba
commit e08deb39a6
9 changed files with 157 additions and 42 deletions
+6 -1
View File
@@ -5,7 +5,7 @@ use proto::is_audit_log_name;
#[test]
fn a_date_and_jsonl_is_a_log_file() {
for name in ["2026-09-17.jsonl", "0000-00-00.jsonl", "9999-12-31.jsonl"] {
for name in ["2026-09-17.jsonl", "0000-01-01.jsonl", "9999-12-31.jsonl"] {
assert!(is_audit_log_name(name), "{name}");
}
}
@@ -27,6 +27,11 @@ fn every_other_name_is_not() {
"12026-09-17.jsonl",
"2026-09-17.JSONL",
"026-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}");
}