tests/test_0810_amr_swarm_migration_regression.py::test_swarm_migration_after_adapt_does_not_raise fails with:
IndexError: index 91 is out of bounds for axis 0 with size 80
Cause: in nuke_coords_and_rebuild() (discretisation_mesh.py), the k-d tree is rebuilt at line 2346, but self._nav_coords isn't refreshed until line ~2401 -- later in the same function. So the rebuild runs against a stale nav_coords, sized for the old mesh, while nav_dm already reflects the new one. Confirmed by instrumenting a live run: at rebuild time, _nav_coords.shape=(80, 2) vs. nav_dm already at 127 points.
Checked the other two caches that also read nav_coords (faces_outer/inner_control_points from #135, and boundary_face_control_points_kdtree/_sign) -- both are invalidated but rebuilt lazily on next access, after this function has already finished, so they are not affected by this ordering issue.
tests/test_0810_amr_swarm_migration_regression.py::test_swarm_migration_after_adapt_does_not_raise fails with:
IndexError: index 91 is out of bounds for axis 0 with size 80
Cause: in nuke_coords_and_rebuild() (discretisation_mesh.py), the k-d tree is rebuilt at line 2346, but self._nav_coords isn't refreshed until line ~2401 -- later in the same function. So the rebuild runs against a stale nav_coords, sized for the old mesh, while nav_dm already reflects the new one. Confirmed by instrumenting a live run: at rebuild time, _nav_coords.shape=(80, 2) vs. nav_dm already at 127 points.
Checked the other two caches that also read nav_coords (faces_outer/inner_control_points from #135, and boundary_face_control_points_kdtree/_sign) -- both are invalidated but rebuilt lazily on next access, after this function has already finished, so they are not affected by this ordering issue.