refactor(mcp): the party_id, document_id and cash_account aliases are removed (P5)

Agent reason: one name for one thing. S4 and S6 kept the old spellings "until
P5" so an agent that learned them did not break; P5 removes them, so the
schema an agent reads has one parameter for each fact and a call cannot name
the same thing twice with different answers.

books.create_invoice takes customer and books.create_bill vendor (a record's
id, its party's id or its name; required), no party_id.
books.receive_payment and books.pay_bill take invoice or bill and
deposit_to or paid_from, no document_id or cash_account; a payment names its
document and its account or is refused saying which to pass. A number that is
one record's id and another's name is still refused, never guessed (INVARIANT
6).

The over-the-wire tests that used the old spellings now use the new
(document_id becomes invoice or bill, cash_account becomes deposit_to or
paid_from, party_id becomes customer or vendor given as the id's text); the
one test that named the alias, party_id_alias_still_works, is now
a_customer_by_id_and_by_name_is_one_record and checks the same two spellings
of a customer, by id and by name, name one record.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
swaitsandClaude Fable 5.1 committed 2026-10-29 15:48:27 -06:00
1 parent 70a3f795f4
commit a319a64c3a
13 files changed
+81 -135

No files matched your search

+17 -17
View File
@@ -911,7 +911,7 @@ fn happy_path(name: &str) -> Mcp {
// A/R and A/P.
let inv = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-01", "due_date": "2026-03-01",
json!({"customer": (customer).to_string(), "date": "2026-02-01", "due_date": "2026-03-01",
"lines": [{"description": "Consulting", "amount": "500.00"}],
"confirmed": true}),
)["id"]
@@ -919,7 +919,7 @@ fn happy_path(name: &str) -> Mcp {
.unwrap();
m.ok(
"books.receive_payment",
json!({"confirmed": true, "document_id": inv, "date": "2026-02-10", "amount": "200.00", "cash_account": "1000"}),
json!({"confirmed": true, "invoice": inv, "date": "2026-02-10", "amount": "200.00", "deposit_to": "1000"}),
);
let vendor_invoice = m.upload(
b"vendor invoice",
@@ -929,7 +929,7 @@ fn happy_path(name: &str) -> Mcp {
);
let bill = m.ok(
"books.create_bill",
json!({"party_id": vendor, "date": "2026-02-01", "due_date": "2026-02-28",
json!({"vendor": (vendor).to_string(), "date": "2026-02-01", "due_date": "2026-02-28",
"vendor_ref": "V-1001",
"lines": [{"description": "Office rent", "amount": "300.00", "account": "6000"}],
"upload_id": vendor_invoice, "confirmed": true}),
@@ -938,7 +938,7 @@ fn happy_path(name: &str) -> Mcp {
.unwrap();
m.ok(
"books.pay_bill",
json!({"confirmed": true, "document_id": bill, "date": "2026-02-05", "amount": "300.00", "cash_account": "1000"}),
json!({"confirmed": true, "bill": bill, "date": "2026-02-05", "amount": "300.00", "paid_from": "1000"}),
);
m.ok("books.ar_aging", json!({"as_of": "2026-06-30"}));
m.ok("books.ap_aging", json!({"as_of": "2026-06-30"}));
@@ -946,7 +946,7 @@ fn happy_path(name: &str) -> Mcp {
// P4b S1: a document voided, and the control accounts' tie-out.
let dup = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-02", "due_date": "2026-03-02",
json!({"customer": (customer).to_string(), "date": "2026-02-02", "due_date": "2026-03-02",
"lines": [{"description": "Consulting, entered twice", "amount": "500.00"}],
"confirmed": true}),
)["id"]
@@ -972,7 +972,7 @@ fn happy_path(name: &str) -> Mcp {
// P4b S7: a bad debt, its evidence uploaded and filed with it.
let bad = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-03", "due_date": "2026-03-03",
json!({"customer": (customer).to_string(), "date": "2026-02-03", "due_date": "2026-03-03",
"lines": [{"description": "Consulting, never paid", "amount": "400.00"}],
"confirmed": true}),
)["id"]
@@ -1685,15 +1685,15 @@ fn run_op(m: &mut Mcp, k: &mut Known, op: &Op) {
vendor_ref,
} => (
"books.create_bill",
json!({"party_id": party.resolve(&k.vendors), "date": "2026-03-01",
json!({"vendor": (party.resolve(&k.vendors)).to_string(), "date": "2026-03-01",
"due_date": "2026-03-31", "vendor_ref": vendor_ref,
"lines": [{"description": "thing", "amount": amount, "account": "6000"}],
"existing_attachment_id": k.vendor_invoice, "confirmed": true}),
),
Op::PayBill { doc, amount } => (
"books.pay_bill",
json!({"confirmed": true, "document_id": doc.resolve(&k.bills), "date": "2026-03-15", "amount": amount,
"cash_account": "1000"}),
json!({"confirmed": true, "bill": doc.resolve(&k.bills), "date": "2026-03-15", "amount": amount,
"paid_from": "1000"}),
),
Op::Payout { deposit } => (
"books.record_payout",
@@ -1834,7 +1834,7 @@ fn inv3_other_tools_refuse_ungrammatical_amounts() {
);
m.refuse(
"books.create_bill",
json!({"party_id": vendor, "date": "2026-03-01", "due_date": "2026-03-31",
json!({"vendor": (vendor).to_string(), "date": "2026-03-01", "due_date": "2026-03-31",
"lines": [{"description": "x", "amount": bad}]}),
);
m.refuse(
@@ -2591,7 +2591,7 @@ fn assigned_roles_steer_invoices() {
.unwrap();
m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-01", "due_date": "2026-03-01",
json!({"customer": (customer).to_string(), "date": "2026-02-01", "due_date": "2026-03-01",
"lines": [{"description": "Consulting", "amount": "500.00"}],
"confirmed": true}),
);
@@ -2654,7 +2654,7 @@ fn documents_void_and_tie_out_over_the_wire() {
);
let inv = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-01", "due_date": "2026-03-01",
json!({"customer": (customer).to_string(), "date": "2026-02-01", "due_date": "2026-03-01",
"lines": [{"description": "Consulting", "amount": "500.00"}],
"confirmed": true}),
)["id"]
@@ -2662,8 +2662,8 @@ fn documents_void_and_tie_out_over_the_wire() {
.unwrap();
let paid = m.ok(
"books.receive_payment",
json!({"confirmed": true, "document_id": inv, "date": "2026-02-10", "amount": "200.00",
"cash_account": "1000", "instrument": "Harbor checking", "reference": "tr_8812"}),
json!({"confirmed": true, "invoice": inv, "date": "2026-02-10", "amount": "200.00",
"deposit_to": "1000", "instrument": "Harbor checking", "reference": "tr_8812"}),
);
assert_eq!(paid["remaining"], "300.00", "{paid}");
assert_eq!(paid["status"], "partial", "{paid}");
@@ -2685,7 +2685,7 @@ fn documents_void_and_tie_out_over_the_wire() {
let dup = m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": "2026-02-02", "due_date": "2026-03-02",
json!({"customer": (customer).to_string(), "date": "2026-02-02", "due_date": "2026-03-02",
"lines": [{"description": "Consulting, entered twice", "amount": "500.00"}],
"confirmed": true}),
)["id"]
@@ -2753,7 +2753,7 @@ fn documents_list_and_timeline_over_the_wire() {
let invoice = |m: &mut Mcp, date: &str, due: &str, amount: &str| {
m.ok(
"books.create_invoice",
json!({"party_id": customer, "date": date, "due_date": due,
json!({"customer": (customer).to_string(), "date": date, "due_date": due,
"lines": [{"description": "Consulting", "amount": amount}],
"confirmed": true}),
)["id"]
@@ -2764,7 +2764,7 @@ fn documents_list_and_timeline_over_the_wire() {
let later = invoice(&mut m, "2026-02-05", "2026-04-30", "80.00");
let pay = m.ok(
"books.receive_payment",
json!({"confirmed": true, "document_id": late, "date": "2026-02-10", "amount": "200.00", "cash_account": "1000"}),
json!({"confirmed": true, "invoice": late, "date": "2026-02-10", "amount": "200.00", "deposit_to": "1000"}),
)["entry_id"]
.as_u64()
.unwrap();