Refactor ChangeBatcher tests to remove skipped count checks

- Updated the `encodeInstance.stress.spec.lua` tests to eliminate checks for skipped counts, as duplicates are now included alongside unique children.
- Adjusted expectations in the tests to reflect the new behavior of the encoding process, ensuring accurate validation of encoded instances.
- Removed legacy assertions related to skipped counts, streamlining the test cases for better clarity and maintainability.
This commit is contained in:
Joe 2026-02-17 02:54:49 -06:00
parent d6162ac210
commit e313f61515
7 changed files with 53 additions and 132 deletions

View file

@ -81,6 +81,7 @@ pub fn match_forward(
&snap_available,
tree_children,
&mut tree_available,
&snap_matched,
tree,
&mut matched,
);
@ -192,15 +193,19 @@ fn pass3_similarity(
snap_available: &[Option<InstanceSnapshot>],
tree_children: &[Ref],
tree_available: &mut [bool],
already_matched_snap: &[bool],
tree: &RojoTree,
matched: &mut Vec<(usize, usize)>,
) {
// Track which snap indices have been matched in this pass.
let mut snap_matched: Vec<bool> = vec![false; snap_available.len()];
// Inherit pass1 match state and extend with pass3 matches.
let mut snap_matched: Vec<bool> = already_matched_snap.to_vec();
// Group remaining by name.
// Group remaining (unmatched) by name.
let mut snap_by_name: HashMap<&str, Vec<usize>> = HashMap::new();
for (i, snap_opt) in snap_available.iter().enumerate() {
if snap_matched[i] {
continue;
}
if let Some(snap) = snap_opt {
snap_by_name.entry(&snap.name).or_default().push(i);
}

View file

@ -265,10 +265,11 @@ impl RojoTree {
if !found {
// Fallback: try matching by instance name (for backward
// compatibility with legacy ref paths and instances without
// filesystem backing).
// filesystem backing). Case-insensitive to match the primary
// lookup semantics.
for &child_ref in children {
let child = self.inner.get_by_ref(child_ref)?;
if child.name == *segment {
if child.name.eq_ignore_ascii_case(segment) {
current_ref = child_ref;
found = true;
break;