[roads] QA F-04: a dangling owner or group member drops only itself, not every plan
Deleting a person from directory.json without editing devices.json left a dangling owner, a snapshot error, and so no plans for anybody. A well-formed owner or member id that is not a person is now reported on its own codes (devices.owner-unknown, directory.member-unknown) and removed: the device is ownerless, the member leaves the group. Malformed ids, duplicates and bad JSON still stop every plan. Two new structural fixtures keep devices.owner and directory.member covered.
This commit is contained in:
@@ -46,6 +46,15 @@ fn inactive_code(code: &str) -> bool {
|
||||
.contains(&code)
|
||||
}
|
||||
|
||||
/// Snapshot errors that are a dangling reference, not a structural fault: reported, but plans are produced.
|
||||
fn dangling_code(code: &str) -> bool {
|
||||
[
|
||||
rules::DEVICES_OWNER_UNKNOWN,
|
||||
rules::DIRECTORY_MEMBER_UNKNOWN,
|
||||
]
|
||||
.contains(&code)
|
||||
}
|
||||
|
||||
/// Runs one case; returns the codes it produced.
|
||||
fn run(case: &Case, baseline: &[u8]) -> BTreeSet<String> {
|
||||
let bytes = std::fs::read(
|
||||
@@ -122,6 +131,13 @@ fn run(case: &Case, baseline: &[u8]) -> BTreeSet<String> {
|
||||
"{}: a road with an error changed a plan",
|
||||
case.file
|
||||
);
|
||||
} else if dangling_code(&case.code) {
|
||||
// QA F-04: a dangling reference drops only itself; everybody else keeps a plan.
|
||||
assert!(
|
||||
c.has_plans(),
|
||||
"{}: one dangling reference stopped every plan",
|
||||
case.file
|
||||
);
|
||||
} else {
|
||||
assert!(
|
||||
c.plans.is_empty(),
|
||||
|
||||
Reference in New Issue
Block a user