Skip to content

fix: restore profile validation search compatibility #567

Closed

Description

@Jammy2211

Overview

PyAutoGalaxy's new profile-constructor guards correctly reject unphysical parameters, but raw ValueError now escapes model fitting where invalid candidates must be resampled. The same validation also exposes results tutorials and regression fixtures that construct profile instances from marginal error vectors or deliberately invalid all-ones samples. This task restores release/workspace compatibility without changing prior support.

Heart's exact RED reason is release validation FAILED (stage integrate) in PyAutoHeart Actions run 31354307923. The related workspace validation reports 45 failures.

Plan

  • Preserve direct constructor validation while making invalid fit candidates rejectable by PyAutoFit.
  • Keep existing priors and scientific parameter support unchanged.
  • Avoid constructing physical profiles from marginal/error vectors that are not guaranteed jointly physical.
  • Repair deliberately invalid fixtures and move intentional NaN injection downstream of constructor validation.
  • Re-run the failed script surface, workspace validation, release integration, and Heart readiness.
Detailed implementation plan

Affected Repositories

  • PyAutoGalaxy (primary)
  • autogalaxy_workspace
  • autolens_workspace
  • autogalaxy_workspace_test
  • autolens_workspace_test

Branch Survey

Repository Current Branch Dirty?
PyAutoGalaxy main clean
autogalaxy_workspace main clean
autolens_workspace main clean
autogalaxy_workspace_test main clean
autolens_workspace_test main clean

No active task claims these repositories. A clean unregistered autolens workspace worktree exists on feature/point-source-campaign-evidence-tail; it is an acknowledged non-blocking overlap warning.

Suggested branch: feature/profile-validation-resample-recovery

Work Classification: Both — library first, then workspaces.

Worktree root: ~/Code/PyAutoLabs-wt/profile-validation-resample-recovery/

Implementation Steps

  1. In PyAutoGalaxy/autogalaxy/exc.py, introduce a narrowly scoped profile-parameter exception inheriting from both ValueError and autofit.exc.FitException.
  2. In PyAutoGalaxy/autogalaxy/profiles/validate.py, raise that exception directly for ell_comps and pass it as exc_type to the shared AutoArray scalar validators. Do not change broad ProfileException behavior or catch arbitrary ValueError in PyAutoFit.
  3. Extend PyAutoGalaxy/test_autogalaxy/profiles/test_validate.py to prove direct calls remain ValueError, fitting recognizes FitException, valid values/JAX tracers still pass, and error messages remain actionable.
  4. Update the results guides in autogalaxy_workspace and autolens_workspace so component-wise marginal/error vectors use list/dictionary output where they are not guaranteed to form a valid physical profile. Regenerate affected notebooks.
  5. Replace invalid all-ones ellipticity components in the affected aggregator regression fixtures in autogalaxy_workspace_test and autolens_workspace_test, preserving unrelated sentinel values and assertions.
  6. Redesign autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.py so its deliberate NaN reaches the downstream likelihood without asking profile constructors to accept NaN parameters.
  7. Run focused PyAutoGalaxy tests and the full library suite; then run all 22 scripts that failed in release integration under their declared environments, verify generated notebook parity, dispatch workspace/release validation, and refresh Heart.

Key Files

  • PyAutoGalaxy/autogalaxy/exc.py — fit-aware profile parameter exception.
  • PyAutoGalaxy/autogalaxy/profiles/validate.py — constructor validation exception contract.
  • PyAutoGalaxy/test_autogalaxy/profiles/test_validate.py — regression tests.
  • autogalaxy_workspace/scripts/guides/results/ — marginal/error summary examples.
  • autolens_workspace/scripts/guides/results/ — matching lensing examples.
  • autogalaxy_workspace_test/scripts/misc/aggregator/ — physical fixture vectors.
  • autolens_workspace_test/scripts/misc/aggregator/ — physical fixture vectors.
  • autolens_workspace_test/scripts/imaging/jax_likelihood/delaunay.py — downstream NaN injection.

Out of Scope

  • Joint unit-disk priors or axis-ratio/position-angle reparameterization.
  • Global catching of ValueError in PyAutoFit.
  • Narrowing component priors to an orientation-dependent square.
  • Tenant-firewall drift unrelated to this regression.

Original Prompt

Click to expand starting prompt

Can we target making heart red

Should it not be the priors prevent these unphysical values throughout? That might be a big task but worth assessing

Just do 1 i agree 2 is too much

Activity

  1. Jammy2211 commented on Aug 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Library PR Created

    • PR: fix: resample invalid profile parameters #568
    • Gate: 1,091 passed, 4 skipped
    • API impact: invalid concrete profile parameters now raise a dual ValueError / FitException, allowing stochastic non-linear-search candidates to be rejected through PyAutoFit resampling.
    • Workspace impact: migration is still needed for deterministic component-wise result summaries, aggregator sentinel vectors, and the intentional Delaunay NaN assertion identified in release run 31354307923.

    Next: /start_workspace for the approved narrow compatibility edits. The joint ellipticity-prior redesign remains explicitly out of scope.

  2. Jammy2211 commented on Aug 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Smoke Test Results — 2026-08-10

    Workspace Passed Failed Skipped Total
    autofit_workspace 8 2 0 10
    autogalaxy_workspace 14 2 0 16
    autolens_workspace 34 3 0 37
    autolens_workspace_test 20 4 0 24
    euclid_strong_lens_modeling_pipeline 6 0 0 6
    HowToLens 50 0 0 50
    Total 132 11 0 143

    Smoke gate failed. Per the ship-workspace contract, no workspace PRs were opened and no code was changed in response to these failures.

    Failures

    autofit_workspace/notebooks/overview/overview_1_the_basics.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autofit_workspace/notebooks/searches/mcmc.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autogalaxy_workspace/notebooks/imaging/modeling.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autogalaxy_workspace/notebooks/interferometer/simulator.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autolens_workspace/scripts/multi_galaxy/features/pixelization/cpu_fast_modeling.py

    Traceback (most recent call last):
      File "/home/jammy/Code/PyAutoLabs-wt/profile-validation-resample-recovery/autolens_workspace/scripts/multi_galaxy/features/pixelization/cpu_fast_modeling.py", line 43, in <module>
        import numba
    ModuleNotFoundError: No module named 'numba'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/jammy/Code/PyAutoLabs-wt/profile-validation-resample-recovery/autolens_workspace/scripts/multi_galaxy/features/pixelization/cpu_fast_modeling.py", line 45, in <module>
        input(
    EOFError: EOF when reading a line
    

    autolens_workspace/notebooks/imaging/modeling.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autolens_workspace/notebooks/interferometer/simulator.ipynb

    ModuleNotFoundError: No module named 'dill'
    

    autolens_workspace_test/scripts/interferometer/jax_likelihood/rectangular.py

    ModuleNotFoundError:
    --------------------
    You are attempting to perform interferometer analysis with the default JAX-native `TransformerNUFFT`.
    
    However, the optional library nufftax (https://github.com/GragasLab/nufftax) is not installed.
    
    Install it via the command `pip install nufftax`.
    
    If you want to use the legacy pynufft backend instead, pass `transformer_class=TransformerNUFFTPyNUFFT` and install pynufft.
    
    ----------------------
    

    autolens_workspace_test/scripts/interferometer/jax_likelihood/mge.py

    ModuleNotFoundError:
    --------------------
    You are attempting to perform interferometer analysis with the default JAX-native `TransformerNUFFT`.
    
    However, the optional library nufftax (https://github.com/GragasLab/nufftax) is not installed.
    
    Install it via the command `pip install nufftax`.
    
    If you want to use the legacy pynufft backend instead, pass `transformer_class=TransformerNUFFTPyNUFFT` and install pynufft.
    
    ----------------------
    

    autolens_workspace_test/scripts/interferometer/jax_likelihood/potential_correction.py

    ModuleNotFoundError:
    --------------------
    You are attempting to perform interferometer analysis with the default JAX-native `TransformerNUFFT`.
    
    However, the optional library nufftax (https://github.com/GragasLab/nufftax) is not installed.
    
    Install it via the command `pip install nufftax`.
    
    If you want to use the legacy pynufft backend instead, pass `transformer_class=TransformerNUFFTPyNUFFT` and install pynufft.
    
    ----------------------
    

    autolens_workspace_test/scripts/interferometer/subhalo_recovery_interferometer.py

    ModuleNotFoundError:
    --------------------
    You are attempting to perform interferometer analysis with the default JAX-native `TransformerNUFFT`.
    
    However, the optional library nufftax (https://github.com/GragasLab/nufftax) is not installed.
    
    Install it via the command `pip install nufftax`.
    
    If you want to use the legacy pynufft backend instead, pass `transformer_class=TransformerNUFFTPyNUFFT` and install pynufft.
    
    ----------------------
    
  3. Jammy2211 commented on Aug 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Smoke Test Results — 2026-08-10 (environment-repaired rerun)

    Workspace Passed Failed Skipped Total
    autofit_workspace 10 0 0 10
    autogalaxy_workspace 16 0 0 16
    autolens_workspace 37 0 0 37
    autolens_workspace_test 24 0 0 24
    euclid_strong_lens_modeling_pipeline 6 0 0 6
    HowToLens 50 0 0 50
    Total 143 0 0 143

    All 143 smoke targets passed across six workspaces after installing the required validation dependencies into the task-local virtual environment.

  4. Jammy2211 commented on Aug 10, 2026

    @Jammy2211
    CollaboratorAuthor

    Shipped — 2026-08-10

    PRs

    Summary

    The approved narrow compatibility fix shipped: invalid profile construction is now both a direct ValueError and a PyAutoFit FitException, and the affected deterministic summaries and invalid fixtures were corrected. The targeted smoke suite passed 143/143, and the library-first merge gate was observed. The explicitly out-of-scope joint-prior redesign was not implemented.

    Post-merge validation

    Fresh release integration later reported 660 passed / 1 failed / 101 skipped / 0 timeouts, with install checks A–F all passing. Issue #567 was reopened for the remaining extra_galaxies/slam.py escape path; see the subsequent validation comment.

  5. Jammy2211 commented on Aug 11, 2026

    @Jammy2211
    CollaboratorAuthor

    Post-merge release validation — RED (2026-08-10)

    Fresh validation run: https://github.com/PyAutoLabs/PyAutoHeart/actions/runs/31441556729

    • Release-fidelity scripts: 660 passed, 1 failed, 101 skipped, 0 timeouts
    • TestPyPI install verification: A–F all passed (including Python 3.12/3.13 and nufftax 0.6.1)
    • Remaining failure: autolens_workspace/scripts/imaging/features/extra_galaxies/slam.py
    • Exact rejection: ell_comps=(-0.9257683911051445, -0.5502774378326348), magnitude 1.0769644249264025

    The new library guard is behaving correctly: it rejects an unphysical ellipse. The remaining defect is that this workspace script still has a prior path capable of drawing |ell_comps| >= 1. Issue reopened so the organism state does not falsely claim GREEN. No live release was performed.

  6. Jammy2211 commented on Aug 11, 2026

    @Jammy2211
    CollaboratorAuthor

    The release-validation follow-up is now implemented in PyAutoFit: PyAutoLabs/PyAutoFit#1463

    It fixes the PYAUTO_TEST_MODE=1 lifecycle leak that reconstructed the PowerLaw point after its constructor guard had correctly rejected it with FitException. Full PyAutoFit validation passed (1707 passed, 2 skipped). The PR is a draft with pending-release; nothing has been merged or released.

  7. Jammy2211 commented on Aug 11, 2026

    @Jammy2211
    CollaboratorAuthor

    Release validation GREEN — 2026-08-11

    Green run: https://github.com/PyAutoLabs/PyAutoHeart/actions/runs/31534325304 (dispatched 20:42:55Z on Heart main b7634e2c, completed 21:50:07Z)

    53 jobs, 52 green, integrate / run_notebooks skipped by design. Artifacts written: release-stage-report, workspace-validation-report, verify-install-release.

    What closed the escape path

    The reopen (00:22Z) named the open question: is the ell_comps escape in PyAutoFit's post-likelihood/quick-update reconstruction, or does it need a narrower workspace prior? It was the reconstruction, in three places, plus one workspace guide. No prior was narrowed.

    PR Merged Fix
    PyAutoFit #1466 16:46Z preserve guarded sample lifecycle
    PyAutoFit #1468 17:46Z invalidate stale factor-graph subsample instances on model rebind
    PyAutoFit #1470 19:52Z expose valid stored sample/instance pairs
    autolens_workspace #484 19:59Z stop the aggregator results guide rebuilding profiles from invalid historical samples

    Evidence trail

    The failing surface shrinks monotonically across four Release Integrate dispatches as the fixes land:

    Run Time Result Failing script packages
    31456732688 03:52Z fail autofit/cookbooks, autolens/multi_dataset, autogalaxy/multi_dataset, autolens/guides
    31517075410 17:20Z fail 5 packages
    31525583134 18:59Z fail 1 — autolens/guides
    31534325304 20:42Z success none

    Attribution across runs is from job outcomes and merge timestamps, not job logs; the last leg is the firmest (the 18:59Z run's only failure was autolens/guides, #484 touches exactly that package, and the next dispatch was green).

    Heart's verdict

    Heart has not yet consumed this evidence, so its published board still shows the older tier — that is release_run.py's cached-artifact pattern working as designed, not a regression. The next dev-box tick reads the latest completed run of this channel, finds no sidecar for run id 31534325304, and self-ingests the release-stage-report; nothing needs to be run by hand. Tracked in PyAutoMind active.md as heart-green-validation-ingest, with the full record at complete/2026/08/heart-red-guarded-sample-escape.md.

    Closing: the regression this issue tracks is fixed and proven green at release fidelity. No live release was performed.


    Generated by Claude Code

  8. Jammy2211 commented on Aug 19, 2026

    @Jammy2211
    CollaboratorAuthor

    Closing: the evidence gap this tracked is resolved. The four fixes were already merged (see PyAutoMind complete/2026/08/heart-red-guarded-sample-escape.md); the outstanding validation ingest completed on the dev box on 2026-08-19 with fresh evidence covering current source — PyAutoHands rehearsal run 32210450811 (TestPyPI 2026.8.19.1.dev72301) + PyAutoHeart Release Integrate run 32264548345 (663 passed / 0 failed), ingested together: rehearse:pass, integrate:pass, release_ready: true, commit_shas matching all five library mains. Full record: PyAutoMind complete/2026/08/heart-green-validation-ingest.md.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions