From a300a1ce9e045f68e62b71e1aca9b9817faabe9e Mon Sep 17 00:00:00 2001 From: Weksa Date: Mon, 9 Nov 2026 11:09:46 +0000 Subject: [PATCH] Test: the asker is the role glossed agent, not the first role (kills request_gate survivor) Co-Authored-By: Claude Sonnet 5.5 --- crates/weksa/tests/lower.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/weksa/tests/lower.rs b/crates/weksa/tests/lower.rs index 9e5cccc..3ec94cf 100644 --- a/crates/weksa/tests/lower.rs +++ b/crates/weksa/tests/lower.rs @@ -655,6 +655,34 @@ fn consent_to_one_of_two_requests_leaves_the_other_unconsented() { ); } +#[test] +fn the_asker_is_the_role_the_inventory_glosses_agent_not_the_first_role() { + // role:1 and role:2 swap glosses: "agent" is now role:2, so the asker of + // `asked()` (role:1 filled by the addressee) is the one role:2 names, Nibu. + // A lookup that took the first role, or the first live entry, would read the + // addressee and let the request through. + let dir = tempfile::tempdir().unwrap(); + let mut store = InventoryStore::open(&dir.path().join("i.cc")).unwrap(); + let (rev1, mut entries) = weksa::inventory::seed(); + for e in &mut entries { + if e.id == iv("role:1") { + e.gloss = "patient".into(); + } else if e.id == iv("role:2") { + e.gloss = "agent".into(); + } + } + store.admit_revision(rev1, entries).unwrap(); + let (rev2, entries) = proof_revision(); + store.admit_revision(rev2, entries).unwrap(); + let inv = store.inventory().unwrap(); + assert_eq!( + lower(&admitted(&asked(), &store), &inv, &committed_entities()), + Err(LowerError::AskerNotAddressee { + predication: nd("n4") + }) + ); +} + #[test] fn a_request_by_someone_other_than_the_addressee_is_refused() { let (inv, _dir) = committed(); -- 2.47.3