Repository navigation
fix: resize paths, non-mutating diagnostics and residual report, stage S5 (spec 005) - #402
Merged
Merged
Conversation
…ve 2D counts, reject rectilinear resize
…al and exclusion blocks
lachlangrose
force-pushed
the
feat/005-s5-diagnostics-and-resize
branch
from
November 5, 2026 22:41
67739bb to
181c3ee
Compare
This was referenced Nov 5, 2026
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.
Summary
Stage S5 of spec 005 (coordinate and fault-frame correctness): the remaining resize paths, cell-centre sampling, non-mutating diagnostics, and the residual and exclusion report (FR-014 remainder, FR-015, FR-023, FR-024; SC-009, SC-011). The spec, plan and tasks are in
specs/005-coordinate-frame-correctness/. All 20 S5 tasks (T069 to T088) are done. S6 is not planned yet.Changes
nstepsandstep_vectorsetters keep the origin and the extent. Before,nstepschanged the extent (11 to 21 nodes at step 1 gave an extent of 10.48), andstep_vectortreated a node count as a cell count.nsteps_cells,n_cell_xandn_cell_yare derived fromnsteps. The 2Dmaximumkeeps its legacy value (FR-028).NotImplementedError, because they left the node arrays unchanged.set_nelementsclampsnstepsto at least 2.BoundingBox.cell_centresis correct for rotated boxes._bounding_box.pyis unchanged. A guard test records this (OP12).grad /= normchanged the stored gradient data in place (position and weight columns too), andgrad[:, :3:6]selected one column.evaluate_value_residuals,evaluate_gradient_cosinesandGeologicalFeature.verification_report().ConstraintDiagnosticsReportgets three new defaulted fields (ResidualSummaryandExclusionRecordblocks). They show into_dictandsummaryonly when they are not empty.GeologicalFeature.evaluate_gradientoverwrote its result array in the fault branch and crashed with a shape mismatch for faulted features.COMPAT.mdhas the S5 notices.ROADMAP.mdrecords the misfit decision.Behaviour changes
nelementsget an exact support extent. Before,set_nelementsshrank it. 78 of 611 keys of the 3D structured-support golden file changed. They were reviewed and regenerated under C-004. The 2D golden file and theloop_interpolationgolden file are unchanged. No tolerance changed.COMPAT.mdhas a notice.Test plan
ruff check LoopStructural packages: passpytest packages/loop_common/tests packages/loop_interpolation/tests: 1021 passed, 47 skipped, 2 xfailedpytest(root): 2218 passed, 4 skippedtest_resize_paths.py(40 cells; 24 fail without the fix),test_cell_centre_sampling.py,test_diagnostics_frames.py(149 cells),test_residual_exclusion_report.py. Pre-fix evidence is inverification.md.verification.md("S5 rollback checks").Known limitation (open decision)
For a faulted feature, the new physical residual methods evaluate through the feature. That applies the faults a second time to stored positions that were already fault-restored. The two frames are compared, so the residual is wrong: 0.080 measured, where the true value is 0.0004 to 0.0018. The old methods had the same behaviour, so it is not a regression. The proposed fix is to evaluate the interpolator directly at the stored positions, with no fault step. This goes against plan decision 8, so it is not in this pull request. FR-023 and FR-024 hold only for features with no fault.
Notes
specs/005-coordinate-frame-correctness/run-state.json. Two to look at: a BOM was added at line 1 of_structured_grid_3d.py, and_structured_grid_2d.pyhas format-only hunks.set_nelementspasses a cell count to thenstepssetter, as it did before (1000 elements on a unit cube give 729 cells).P1Interpolator.add_gradient_constraintsispass).black --checkwas run on each file by the workers, not on the whole repository.pyevtkorloopstructuralvisualisationskip when those are missing.