Enhance instance metadata and reconciliation logic for glob-ignored children

- Added `globIgnoredChildren` to `ApiInstanceMetadata` to manage child deletion behavior based on glob patterns.
- Updated `shouldDeleteChild` function to suppress deletions when `globIgnoredChildren` is true, differentiating from scripts-only mode.
- Enhanced tests to verify correct behavior of instance deletion based on the new metadata, ensuring robust handling of unknown scripts.
- Refactored snapshot handling to incorporate `globIgnoredChildren` in metadata, improving clarity and maintainability.
This commit is contained in:
Joe 2026-03-07 11:44:07 -06:00
parent 4b38c070fb
commit 12bccf91c5
50 changed files with 247 additions and 14 deletions

View file

@ -118,7 +118,8 @@ pub fn snapshot_dir_no_meta(
.instigating_source(path)
.relevant_paths(relevant_paths)
.context(context)
.ignore_unknown_instances(any_child_glob_ignored),
.ignore_unknown_instances(any_child_glob_ignored)
.glob_ignored_children(any_child_glob_ignored),
);
Ok(Some(snapshot))
@ -602,6 +603,10 @@ mod test {
snap.metadata.ignore_unknown_instances,
"Directory with glob-ignored children should have ignore_unknown_instances = true"
);
assert!(
snap.metadata.glob_ignored_children,
"Directory with glob-ignored children should have glob_ignored_children = true"
);
assert_eq!(
snap.children.len(),
1,
@ -636,6 +641,10 @@ mod test {
!snap.metadata.ignore_unknown_instances,
"Directory without glob-ignored children should have ignore_unknown_instances = false"
);
assert!(
!snap.metadata.glob_ignored_children,
"Directory without glob-ignored children should have glob_ignored_children = false"
);
assert_eq!(snap.children.len(), 2);
}
}