P2: tests mutation found, three bugs fixed; plan P12 and P13

Mutation testing pauses until P12 (D-33, owner 2026-10-20), which reruns
the whole max-testing pass over everything since P1. Before the pause,
pass 1 on slices 3-6 and its triage gave tests in ledger-store,
ledger-package and ledger-mcp, and three real bugs, fixed:
- the command line took an admin answer longer than four MiB, or cut off
  before its newline, whenever the bytes that came still parsed;
- The CPA package put a twin's number on the last dot of the whole path,
  so in a folder with a dot the second file landed in another folder;
- a document or category named of dots alone ("..") could climb out of
  its folder when the CPA package is unpacked.
The plan gains P13, bookspec (D-34): a formal, sourced accounting
specification first (rules with symbolic forms and worked examples), then
its own formal validation and a conformance harness any engine can be
tested against, seeded by P3's regression tests. docs/testing.md records
slices 3-8 and what P12 must cover; plan/STATUS.md says where P2 stands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3gXMVt7XJPi6ens1or9Dj
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-20 11:14:22 -06:00
1 parent 3cf359a0cd
commit d5c9522ad1
24 files changed
+2937 -20

No files matched your search

+22 -1
View File
@@ -347,7 +347,7 @@ impl BooksServer {
#[cfg(test)]
mod tests {
use super::plain_file_name;
use super::{CALLER, plain_file_name, token_flag};
/// A name kept before names were checked is handed over cleaned, never
/// refused (a W-9 sealed earlier, say).
@@ -364,6 +364,10 @@ mod tests {
let long = "x".repeat(400);
let cut = plain_file_name(&long);
assert!(cut.len() <= ledger_store::uploads::MAX_NAME_BYTES);
// Cut to fit, not dropped: as much of the name as the checks take,
// and a name that fits already kept whole.
assert_eq!(cut, "x".repeat(255));
assert_eq!(plain_file_name(&"y".repeat(255)), "y".repeat(255));
for n in [
"W9 \u{2714}\u{FE0F}.pdf",
"a/b\\c\n.pdf",
@@ -377,4 +381,21 @@ mod tests {
);
}
}
/// A command given to the agent names its token only when it isn't
/// the one the commands use by default ("agent"): the command runs as
/// the caller, never as another token.
#[test]
fn a_command_names_the_callers_token_unless_it_is_the_default() {
let flag_for = |caller: Option<(&str, &str)>| {
CALLER.with(|c| {
*c.borrow_mut() = caller.map(|(id, name)| (id.to_string(), name.to_string()))
});
token_flag()
};
assert_eq!(flag_for(None), "");
assert_eq!(flag_for(Some(("tok_1", "agent"))), "");
assert_eq!(flag_for(Some(("tok_2", "reader"))), " --token reader");
assert_eq!(flag_for(None), "");
}
}