fix: add auto-simulate guards to unguarded dataset loads - #65
Merged
Conversation
chapter_4_pixelizations/tutorial_3_inversions.py is one of the 4 missing-dataset smoke failures from PyAutoHeart run 30790463134 (FileNotFoundError on dataset/imaging/source_complex/data.fits), reproduced on a clean checkout before any edit. The script already carried a correct guard at L49 for its FIRST dataset (simple__no_lens_light); the source_complex block further down had none. Guarded against the existing scripts/simulator/source_complex.py. tutorial_5_borders.py gets the same treatment for dataset/imaging/ x2_lens_galaxies (scripts/simulator/lens_x2.py). It stays no_run for its unrelated mask reason, but the guard is correct either way. Verified: tutorial_3_inversions EXIT 0 in 19s under the real smoke env built via autohands.env_config.build_env_for_script. PYAUTO_SMALL_DATASETS=1 makes should_simulate rmtree and re-simulate, so the guard was genuinely exercised. tutorial_5_borders is not verified by execution (no_run). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <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.
Part of PyAutoLabs/autolens_workspace#455
Summary
chapter_4_pixelizations/tutorial_3_inversions.pyis one of the 4 missing-dataset smoke failures from PyAutoHeart run30790463134—FileNotFoundError: dataset/imaging/source_complex/data.fits. Reproduced on a clean checkout before any edit (this repo ships nodataset/directory at all, so the reproduction conditions were genuine).The paired simulator already existed. The fix is an auto-simulate guard.
Root cause shape
The script already carried a correct guard at
:49— for its first dataset,simple__no_lens_light. Thesource_complexblock further down at:152-158had none. Same shape as the twoautolens_workspacefailures in the companion PR: a second dataset load that nobody guarded.Scripts Changed
scripts/chapter_4_pixelizations/tutorial_3_inversions.pysource_complex) →scripts/simulator/source_complex.pyscripts/chapter_4_pixelizations/tutorial_5_borders.pyx2_lens_galaxies) →scripts/simulator/lens_x2.py★ = the reported smoke failure.
tutorial_5_borders.pystaysno_runfor its own unrelated reason ("Cant get right masks, need proper update"), but its second dataset load had the identical missing guard and it is correct either way.After this branch, zero unguarded dataset loads remain in this repo.
Validation
tutorial_3_inversions.py— EXIT 0 in 19s under its real smoke env, built viaautohands.env_config.build_env_for_scriptagainstconfig/build/profile_smoke.yamlrather than hand-set variables. That env setsPYAUTO_SMALL_DATASETS=1, which makesshould_simulatermtreeand re-simulate, so the guard was genuinely exercised rather than skipped over pre-existing data. The guard created exactly the file from the original traceback,dataset/imaging/source_complex/data.fits.Not verified by execution:
tutorial_5_borders.pyisno_run. Its guard uses the same idiom and is syntax- and import-checked, but was not run.Notebooks regenerated with
generate.py howtolens.Ship gate
Heart
redat ship time (2026-08-03T17:44:16Z). Shipped under the corrective-PR exception, human-authorized in session, scoped to the YELLOW reason"workspace validation not passing (19 failed, 1 timeout, cloud#30790463134: …)"— the run this task was filed from. None of the three RED reasons relate to this change. The exception permits commit/push/PR-open only — merge and release stay human.🤖 Generated with Claude Code