hive-c0re: scrub manager-surface cookies + SetParent doc fix (#715 batch 7)

This commit is contained in:
damocles 2026-05-31 17:42:57 +02:00 committed by mara
commit 2bdb8c7d51
5 changed files with 37 additions and 37 deletions

View file

@ -209,11 +209,11 @@ pub fn handle_cancel_loose_end(
}
/// Manager-only guard on the `Approval` cancel arm. Pulled out so
/// the auth check has its own focused unit test (argus nit on #508)
/// — testing the full `handle_cancel_loose_end` flow would need a
/// `Coordinator` fixture (broker + sqlite + in-memory questions),
/// which we don't have today. The check is a single string compare,
/// so a function-level test gives the same coverage with no harness.
/// the auth check has its own focused unit test — testing the full
/// `handle_cancel_loose_end` flow would need a `Coordinator` fixture
/// (broker + sqlite + in-memory questions), which we don't have
/// today. The check is a single string compare, so a function-level
/// test gives the same coverage with no harness.
fn check_approval_canceller_is_manager(canceller: &str) -> Result<(), String> {
if canceller != hive_sh4re::MANAGER_AGENT {
return Err("cancel_loose_end: only the manager can cancel approval rows".to_owned());
@ -227,9 +227,9 @@ mod tests {
#[test]
fn approval_cancel_rejects_sub_agent_callers() {
// Argus nit on #508: sub-agents must not be able to cancel
// approval rows even if they invent an id. The guard is
// server-side so client cooperation is irrelevant.
// Sub-agents must not be able to cancel approval rows even
// if they invent an id. The guard is server-side so client
// cooperation is irrelevant.
let err = check_approval_canceller_is_manager("bitburner").unwrap_err();
assert!(err.contains("only the manager"), "{err}");
// Bonus: empty / operator strings also rejected (only the