feat(mcp): every write call is one transaction with a request key (P15 T1, D-88, D-89)
Accounting reasoning: these are financial books reached over the internet, where a request is retried. A write whose answer is lost and then sent again must not post twice, a call half done must not be left looking done, and a failed write must be on the record. Every tool that can change the books (83 of the 140: three that only read what is sealed and may answer with a TIN are reads) takes a required `request_key`, added to its schema in tools/list and taken out of the arguments before the tool runs, so no tool, preview digest or check changes. A write without a usable key is refused in words. Write calls take turns, and each runs as one transaction of the store: opened (or answered from the books if its key committed: the same tool and arguments return the first answer and write nothing; other arguments are refused as a misuse of the key; the access log says `repeat`), then closed with its answer if it answered ok, or rolled back and closed `failed` if it errored, failed or was stopped by a close. Books an older version wrote take no write at all until the owner's go-ahead (D-89): every write is refused with the upgrade remedy; reads work as ever. `books.import_bank_csv` is one transaction like the rest. The handbook, docs/mcp-interface.md, the claims (WB-format-8 to 12, and WB-format-3 amended for D-89) and docs/parity.md say so. Tests that wrote to old books through the tools now assert the refusal and write after the upgrade; the shared wire helpers add a fresh key to every tool call (the journal helpers leave the call frames out, as they left out nothing before), so no other test changed. The store-level `_waits_for_<feature>` tests still check each feature's own gate. No figure and no golden moved. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
2633109d55
commit
e542319e63
25 files changed
+1084
-186
No files matched your search
@@ -1083,7 +1083,8 @@ fn a_call_whose_answer_was_never_read_is_on_record_as_having_run() {
|
||||
let mut raw = raw::Raw::connect(&home, A);
|
||||
let body = json!({"jsonrpc": "2.0", "id": 5, "method": "tools/call", "params": {
|
||||
"name": "books.draft_entry",
|
||||
"arguments": {"date": "2026-03-01", "description": "unread"}}})
|
||||
"arguments": {"date": "2026-03-01", "description": "unread",
|
||||
"request_key": common::fresh_request_key()}}})
|
||||
.to_string();
|
||||
raw.start(
|
||||
"POST",
|
||||
@@ -1521,7 +1522,8 @@ fn a_stalled_mcp_body_cannot_hold_a_close_and_nothing_of_it_is_journaled() {
|
||||
let mut raw = raw::Raw::connect(&home, A);
|
||||
let body = json!({"jsonrpc": "2.0", "id": 9, "method": "tools/call", "params": {
|
||||
"name": "books.draft_entry",
|
||||
"arguments": {"date": "2026-03-01", "description": "never finished"}}})
|
||||
"arguments": {"date": "2026-03-01", "description": "never finished",
|
||||
"request_key": common::fresh_request_key()}}})
|
||||
.to_string();
|
||||
raw.start_inside(
|
||||
"POST",
|
||||
@@ -1645,7 +1647,8 @@ fn a_running_call_is_never_cut_when_the_grace_runs_out() {
|
||||
);
|
||||
let mut raw = raw::Raw::connect(&home, A);
|
||||
let body = json!({"jsonrpc": "2.0", "id": 4, "method": "tools/call", "params": {
|
||||
"name": "books.attach_receipt", "arguments": {"upload_id": up}}})
|
||||
"name": "books.attach_receipt",
|
||||
"arguments": {"upload_id": up, "request_key": common::fresh_request_key()}}})
|
||||
.to_string();
|
||||
raw.start(
|
||||
"POST",
|
||||
@@ -2171,7 +2174,8 @@ fn the_servers_own_close_cuts_stalled_requests_and_exits_zero_in_time() {
|
||||
let mut raw_call = raw::Raw::connect(&home, B);
|
||||
let body = json!({"jsonrpc": "2.0", "id": 9, "method": "tools/call", "params": {
|
||||
"name": "books.draft_entry",
|
||||
"arguments": {"date": "2026-03-01", "description": "never finished"}}})
|
||||
"arguments": {"date": "2026-03-01", "description": "never finished",
|
||||
"request_key": common::fresh_request_key()}}})
|
||||
.to_string();
|
||||
raw_call.start_inside(
|
||||
"POST",
|
||||
@@ -2623,9 +2627,11 @@ fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_back
|
||||
#[cfg(unix)]
|
||||
fn call_unanswered(home: &Home, w: &Wire, id: u64, tool: &str, args: Value) -> raw::Raw {
|
||||
let mut raw = raw::Raw::connect(home, A);
|
||||
let body = json!({"jsonrpc": "2.0", "id": id, "method": "tools/call", "params": {
|
||||
"name": tool, "arguments": args}})
|
||||
.to_string();
|
||||
let body = common::with_request_key(
|
||||
&json!({"jsonrpc": "2.0", "id": id, "method": "tools/call", "params": {
|
||||
"name": tool, "arguments": args}})
|
||||
.to_string(),
|
||||
);
|
||||
raw.start(
|
||||
"POST",
|
||||
"mcp",
|
||||
|
||||
Reference in new issue
Block a user