Skip to content

Lock coord-mutation gate with regression test + lagged-clone SL design note#249

Merged
lmoresi merged 1 commit into
developmentfrom
bugfix/deform-gate-test-and-design
Jun 17, 2026
Merged

Lock coord-mutation gate with regression test + lagged-clone SL design note#249
lmoresi merged 1 commit into
developmentfrom
bugfix/deform-gate-test-and-design

Conversation

@lmoresi

@lmoresi lmoresi commented Jun 17, 2026

Copy link
Copy Markdown
Member

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:

  • bare mesh._deform_mesh(coords) on a live mesh raises (naming deform)
  • mesh.deform(coords, dt=…) moves the nodes
  • with mesh._coord_mutation(): sanctions a deliberate direct call
  • with mesh.ephemeral_coords(): restores coords on exit

level_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 + CARRY history only
approximates "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

… 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
Copilot AI review requested due to automatic review settings June 17, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to assert _deform_mesh raises on live meshes unless inside sanctioned scopes, and that deform() / ephemeral_coords() behave correctly.
  • Add docs/developer/design/lagged-clone-sl-history.md describing 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))
@lmoresi lmoresi merged commit 71ca49d into development Jun 17, 2026
2 checks passed
@lmoresi lmoresi deleted the bugfix/deform-gate-test-and-design branch June 17, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants