[roads] QA F-03: a kill-switch road with an error fails closed, through no exit
Any check() error used to make a road grant nothing, and for never-online-without nothing meant no kill switch: an exit that stopped being one (or left devices.json) silently turned off every kill switch through it. The road is still reported as an error, but its subject's kill switch stays on through no exit (only the mesh), and going direct to the internet is still dropped. An expired kill switch ends as written. The road_file fuzz target's deny-by-default check now allows exactly that narrowing and nothing else.
This commit is contained in:
@@ -93,7 +93,6 @@ fn f02_going_direct_never_overlaps_what_the_tunnel_carries() {
|
||||
/// typo: the exit device stops offering itself as an exit (or leaves devices.json), and every kill switch
|
||||
/// through it silently disappears while the rest of the plan compiles.
|
||||
#[test]
|
||||
#[ignore = "QA F-03 (major): an invalid kill-switch road fails open"]
|
||||
fn f03_a_kill_switch_whose_exit_goes_away_fails_closed() {
|
||||
let parts = Parts::home().edit_devices(|d| {
|
||||
d.replace(
|
||||
@@ -109,10 +108,48 @@ fn f03_a_kill_switch_whose_exit_goes_away_fails_closed() {
|
||||
.any(|p| p.path.contains("w9c3ke") && p.is_error()),
|
||||
"the kill-switch road is reported"
|
||||
);
|
||||
let ks = c.plans[&key(1)].kill_switch.as_ref();
|
||||
assert!(
|
||||
c.plans[&key(1)].kill_switch.is_some(),
|
||||
ks.is_some(),
|
||||
"mark-pc lost its kill switch because its exit stopped being one: it now fails open"
|
||||
);
|
||||
assert_eq!(
|
||||
ks.unwrap().through,
|
||||
None,
|
||||
"closed means through no exit: only the mesh"
|
||||
);
|
||||
// Mutation guard: the same road made valid again keeps its exit.
|
||||
assert_eq!(
|
||||
Parts::home().compile().plans[&key(1)]
|
||||
.kill_switch
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.through,
|
||||
Some(key(2))
|
||||
);
|
||||
}
|
||||
|
||||
/// F-03, the other references: an unknown exit, and an exit road that has expired, which ends as written.
|
||||
#[test]
|
||||
fn f03_an_unknown_exit_fails_closed_and_an_expired_kill_switch_ends() {
|
||||
let text = Parts::home().road_text("w9c3ke");
|
||||
let unknown = text.replace(
|
||||
"exit:AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI",
|
||||
"exit:CQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQk",
|
||||
);
|
||||
let c = Parts::home().replace_road("w9c3ke", &unknown).compile();
|
||||
assert!(
|
||||
c.problems
|
||||
.iter()
|
||||
.any(|p| p.path.contains("w9c3ke") && p.is_error())
|
||||
);
|
||||
assert_eq!(c.plans[&key(1)].kill_switch.as_ref().unwrap().through, None);
|
||||
let expired = unknown.replace("created:", "until: 2026-11-01T00:00:00+01:00\ncreated:");
|
||||
let c = Parts::home().replace_road("w9c3ke", &expired).compile();
|
||||
assert!(
|
||||
c.plans[&key(1)].kill_switch.is_none(),
|
||||
"an expired kill switch ends as written"
|
||||
);
|
||||
}
|
||||
|
||||
/// F-04. Deleting a person from the directory (the upstream event, without also editing devices.json) leaves
|
||||
|
||||
Reference in New Issue
Block a user