Pin caller bugs while a confirmation or a result waits (red)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-11-29 07:58:56 +01:00
commit ce16dfe2ca

View file

@ -1335,6 +1335,35 @@ fn each_refusal_site_says_its_code_a_user_state_is_blocked_a_caller_bug_is_refus
assert_eq!(codes(&frame_at(&mut core, &mut state, at(3)).diagnostics), vec![Code::ActivationRefused], "dropped resume");
}
#[test]
fn a_caller_bug_is_refused_even_while_a_command_waits_for_confirmation_or_for_a_result() {
let bugs = || {
[
("no-such-node", ActivationKind::Press, "not in the surface"),
("go", ActivationKind::Submit, "no command for this kind"),
("name", ActivationKind::Change(number_value(1.0)), "bad change value"),
]
};
let mut ids = SeqIds::new();
// Another command waits for confirmation.
let mut document = go_surface();
document.commands[1] = decl("after", &[], Some("sure?"));
let mut rig = Rig::new(MemState::new(), &document);
assert!(rig.press("after", PINNED_NOW, &mut ids).is_empty());
for (node, kind, site) in bugs() {
assert_eq!(codes(&rig.act(&nid(node), kind, at(1), &mut ids)), vec![Code::ActivationRefused], "confirming: {site}");
}
assert_eq!(rig.draft(&nid("name")), None);
// A command waits for its result.
let mut rig = Rig::new(MemState::new(), &go_surface());
rig.press("go", PINNED_NOW, &mut ids);
for (node, kind, site) in bugs() {
assert_eq!(codes(&rig.act(&nid(node), kind, at(1), &mut ids)), vec![Code::ActivationRefused], "waiting: {site}");
}
}
#[test]
fn a_command_param_outside_a_composition_leaves_no_tree_to_activate() {
let mut document = go_surface();