Lock coord-mutation gate with regression test + lagged-clone SL design note#249
Merged
Merged
Conversation
… SL design note Two close-out items following PR #246 (the foolproof mesh-coordinate mutation gate): 1. tests/test_0826_deform_capability_gate.py — a dedicated regression test that the gate actually FIRES. PR #246's existing tests wrap calls to *avoid* the gate; none asserted that a bare _deform_mesh on a live mesh raises. This locks the user-facing protection: bare _deform_mesh raises (naming `deform`), mesh.deform() moves nodes, _coord_mutation() sanctions a direct call, and ephemeral_coords() restores on exit. level_1 + tier_a, runs in ~7s. 2. docs/developer/design/lagged-clone-sl-history.md — design note for the next phase of free-surface / adaptation work. The ALE v_mesh-pulse + CARRY history only APPROXIMATES "old field on old geometry"; at a receding free surface the departure point lands in the vacated layer and the new-mesh P3 extrapolates (the Ra=1e5 blow-up). Geometry-aware clamp / monotone band-aids only delay it (verified). The note specifies the cure: a lagged rolling-clone of the previous-step mesh (shared partition; stores primitives; recompute fluxes homogeneously) as the SL reference, with mixed-mesh expression evaluation as the Phase-1 enabling primitive. Unifies free-surface and adaptation. Underworld development team with AI support from Claude Code
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a regression test to ensure the mesh coordinate-mutation capability gate introduced in PR #246 continues to fire (and that sanctioned paths work), and introduces a forward-looking developer design note describing a lagged rolling-clone approach for robust semi-Lagrangian history on moving meshes.
Changes:
- Add
tests/test_0826_deform_capability_gate.pyto assert_deform_meshraises on live meshes unless inside sanctioned scopes, and thatdeform()/ephemeral_coords()behave correctly. - Add
docs/developer/design/lagged-clone-sl-history.mddescribing Phase 1 (mixed-mesh evaluation) and Phase 2 (lagged rolling-clone SL history) architecture.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_0826_deform_capability_gate.py | New regression tests for the _deform_mesh capability gate and sanctioned coordinate-mutation entry points. |
| docs/developer/design/lagged-clone-sl-history.md | New design note/spec for a future lagged-clone SL-history implementation and mixed-mesh evaluation primitive. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+12
| Related: [REMESH_FIELD_TRANSFER_DESIGN](REMESH_FIELD_TRANSFER_DESIGN.md), | ||
| [in_memory_checkpoint_design](in_memory_checkpoint_design.md), | ||
| [submesh-solver-architecture](submesh-solver-architecture.md), | ||
| [STRESS_EQUILIBRIUM_FREESURFACE](STRESS_EQUILIBRIUM_FREESURFACE.md). |
Comment on lines
+45
to
+46
| with pytest.raises(RuntimeError, match="deform"): | ||
| mesh._deform_mesh(_perturbed(mesh)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close-out items following #246 (foolproof mesh-coordinate mutation gate).
1. Gate regression test (
tests/test_0826_deform_capability_gate.py)#246 added the capability gate but nothing in the suite asserted it fires — the
three tests it touched wrap calls to avoid the gate. This locks the user-facing
protection so it can't silently regress:
mesh._deform_mesh(coords)on a live mesh raises (namingdeform)mesh.deform(coords, dt=…)moves the nodeswith mesh._coord_mutation():sanctions a deliberate direct callwith mesh.ephemeral_coords():restores coords on exitlevel_1 + tier_a, ~7s, 4 tests pass locally.2. Design note (
docs/developer/design/lagged-clone-sl-history.md)Spec for the next phase. The ALE
v_mesh-pulse +CARRYhistory onlyapproximates "old field on old geometry"; at a receding free surface the SL
departure point lands in the vacated layer and the new-mesh P3 extrapolates → the
Ra=1e5 blow-up. Geometry-aware clamp / monotone only delay it (verified). The
note specifies the cure — a lagged rolling-clone of the previous-step mesh
(shared partition; stores primitives; recompute fluxes homogeneously) as the SL
reference — with mixed-mesh expression evaluation as the Phase-1 enabling
primitive. Unifies free-surface and adaptation.
No production code change; test + docs only.
Underworld development team with AI support from Claude Code