fix(env_config): substring-match patterns against full path#91
Merged
Conversation
env_config._pattern_matches and build_util.should_skip stripped the .py suffix before substring-matching, silently nullifying any env_vars.yaml or no_run.yaml pattern that ended in `.py`. Three patterns in *_workspace_test env_vars.yaml (e.g. imaging/visualization.py) were therefore dead, leaving PYAUTO_FAST_PLOTS=1 set on visualization scripts and causing 7 of them to fail with "fit.png was not produced" / "dataset.png missing" (triage Cluster A). Substring-match against str(file) instead so `.py`-anchored patterns work as intended (imaging/visualization.py matches only the script, not _jax / _jit siblings). Updates the in-module call sites in env_config.build_env_for_script and repro_command.canonical_env_for_script. Add 8 regression tests in tests/test_pattern_matches.py. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Workspace PR: PyAutoLabs/autogalaxy_workspace_test#52 |
Collaborator
Author
|
Workspace PR: PyAutoLabs/autolens_workspace_test#107 |
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
env_config._pattern_matches(and the matchingbuild_util.should_skip/_find_skip_reason) was substring-matching the YAML pattern against the file path with its.pyextension stripped. Anyenv_vars.yamlorno_run.yamlpattern that ended in.pytherefore never fired — silently.In the
*_workspace_testrepos this dead-pattern bug leftPYAUTO_FAST_PLOTS=1set on 7visualization.pyscripts.PYAUTO_FAST_PLOTS=1short-circuitssubplot_save/save_figurein PyAutoArray (no PNG ever written), producing thedataset.png missing/fit.png was not producedfailures triaged as Cluster A (plus a parked 40d-oldautolens imaging/visualizationNEEDS_FIX entry).This change substring-matches against the full path (including extension) so patterns can anchor with
.pyto target a specific script form without inadvertently catching_jax/_jitsiblings. Updatesenv_config.build_env_for_scriptandrepro_command.canonical_env_for_script(both in-module call sites of_pattern_matches).The matching env_vars.yaml override updates ship separately in
autogalaxy_workspace_testandautolens_workspace_testPRs. Next triage cluster regen should clear Cluster A and the parked NEEDS_FIX entry.API Changes
None — internal changes only.
The signature of the private
_pattern_matcheshelper changes; its two in-module callers (build_env_for_script,canonical_env_for_script) are updated in the same commit. Public functions (should_skip,build_env_for_script,load_env_config,repro_command) are unchanged. See full details below.Test Plan
python -m pytest tests/— 72/72 pass, including 8 new regression tests intests/test_pattern_matches.py.visualization*.pyscripts across both*_workspace_testrepos resolve withPYAUTO_FAST_PLOTS=<unset>; 3 control scripts (aggregator/,imaging/convolution,imaging/model_fit) still resolvePYAUTO_FAST_PLOTS=1as expected.build_env_for_scriptpipeline). All pass:autogalaxy/ellipse/visualization.pyautogalaxy/imaging/visualization.pyautogalaxy/interferometer/visualization.pyautogalaxy/quantity/visualization.pyautolens/imaging/visualization.pyautolens/interferometer/visualization.pyautolens/point_source/visualization.pyautolens/point_source/visualization_jax.pyautolens/imaging/visualization_jax.pyFull API Changes (for automation & release notes)
Changed Signature (internal only)
autobuild.env_config._pattern_matches(file, file_path_no_ext, pattern)→_pattern_matches(file, pattern)— two in-module call sites (env_config.build_env_for_script,repro_command.canonical_env_for_script) updated.Changed Behaviour
autobuild.env_config._pattern_matches— substring matches againststr(file)(including.py) instead ofstr(file.with_suffix("")).autobuild.build_util.should_skip— same change.autobuild.build_util._find_skip_reason— same change.Previously-dead patterns ending in
.py(3 entries across the*_workspace_testrepos) now fire correctly. Patterns without.pystill match as before — they remain substrings of the now-extension-included path.Added
tests/test_pattern_matches.py— 8 tests locking in the convention:.py-anchored patterns match only the script (not siblings); prefix-only patterns substring-match all siblings; stem patterns match exactly.Migration
None required. The fix changes behaviour only for previously-dead patterns.
🤖 Generated with Claude Code