fix: test-mode-gate singular/non-PD inversion crash (release tail)#389
Merged
Conversation
Return a benign dummy from the inversion reconstruction/log-det sites when PYAUTO_TEST_MODE is active, instead of raising on a singular/non-PD curvature-regularization matrix. In test mode the fitted model is fabricated / under-converged and the inversion output is discarded, so an unguarded test-mode path (search chaining, preloads, result construction) should not crash — while the real likelihood path already resamples such solutions via FitException. Normal operation is byte-for-byte unchanged: the four sites re-raise exactly as before (LinAlgError / InversionException), so real-mode numerics and the search resample behaviour are untouched. numpy-only: the JAX linalg path returns NaN rather than raising. Sites gated on autoconf.is_test_mode(): - inversion_util.reconstruction_positive_negative_from (xp.linalg.solve) - inversion_util.reconstruction_positive_only_from (fnnls except) - abstract.log_det_curvature_reg_matrix_term (cholesky) - abstract.log_det_regularization_matrix_term (cholesky) Fixes the flaky release-tail FAILs slam.py / cpu_fast_modeling.py (PyAutoArray#388; follow-up to PyAutoHeart#72, PyAutoLens#607). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes part of PyAutoArray#388.
Summary
Return a benign dummy from the inversion reconstruction / log-det sites only when
autoconf.is_test_mode()is active, instead of raising on a singular/non-PD curvature-regularization matrix. In test mode the fitted model is fabricated / under-converged and the inversion output is discarded, so an unguarded test-mode path (search chaining, preloads, result construction) should not crash — while the real likelihood path already resamples such solutions viaFitException.Normal operation is byte-for-byte unchanged: all four sites re-raise exactly as before (
LinAlgError/InversionException), so real-mode numerics and search resample behaviour are untouched. numpy-only by construction (the JAX linalg path returns NaN rather than raising). No conditioning floor — nothing perturbs real evidences/reconstructions.Sites gated on
is_test_mode():inversion_util.reconstruction_positive_negative_from(xp.linalg.solve)inversion_util.reconstruction_positive_only_from(fnnlsexcept)abstract.log_det_curvature_reg_matrix_term(cholesky)abstract.log_det_regularization_matrix_term(cholesky)Corrective-PR exception (Heart RED)
Opened under the human-authorized corrective-PR exception (
AUTONOMY.md), authorized in-session 2026-07-14.release validation FAILED (stage integrate)interferometer/.../multi_gaussian_expansion/slam.py+imaging/features/pixelization/cpu_fast_modeling.py(run 29341418859) → both crash on an unguarded singular inversion in test-mode chained paths → 4-siteis_test_mode()dummy guard → this PR. Follow-up to PyAutoLens#607, which guarded the real/likelihood path but not these test-mode paths.PyAutoArray: on branch feature/ticks-minus-in-math (not main)— Heart stays RED until that is also resolved and integrate validation re-runs.Caveat on causal strength
Unlike #607 (deterministic repro), these two FAILs did not reproduce on clean
main(TEST_MODE=1 and =2 both pass; the crash is flaky/non-deterministic). This is a test-mode-gated dummy, not a real-path correctness change. It plausibly removes the FAILs; confirmation comes only from the post-merge fresh-wheels re-validation of the integrate stage.Validation checklist
PYAUTO_TEST_MODEreturns finite dummies.test_autoarray/inversion/inversion/(util + abstract): 41 passed.test_autoarray/inversion/: 233 passed.*_workspace_testparity scripts.main+ new Heart verdict (required before any release decision).Self-review: CLEAN — commit
48fae1ac, 3 files (+101/−12), no mixed scope.