Skip to content

fix: PYAUTO_DISABLE_JAX has exactly one reader (#181 step 7) - #643

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/env-jax-one-reader
Jul 23, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/env-jax-one-reader

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Step 7 of the env-profile migration (PyAutoHands#181; design PyAutoHands/docs/env_profile_redesign.md §5, failure mode 8): PYAUTO_DISABLE_JAX now has exactly one reader — af.Analysis.__init__. AnalysisLens.__init__ receives the base-resolved self._use_jax instead of the raw parameter at all three call sites, and AnalysisDataset's duplicate pre-super() env read is deleted.

This also fixes a live bug: AnalysisPoint and the weak analysis passed the raw use_jax to AnalysisLens, whose assignment overwrites the base class's resolution — so PYAUTO_DISABLE_JAX=1 was silently undone for them (they ran JAX in the nightly by accident). AnalysisDataset masked the same overwrite with its duplicate read, which also skipped the jax-not-installed downgrade the base applies — AnalysisLens could disagree with self._use_jax there.

API Changes

None — internal behaviour fix. Public signatures unchanged. Behavioural change only under PYAUTO_DISABLE_JAX=1 (release validation): point/weak analyses now honour the downgrade as designed.

Test Plan

  • New construction-level tests (NumPy-only): imaging + point downgrade under env=1, no over-downgrade with env unset — red-green proven (the point test fails on pre-fix source: _use_jax was True despite env=1; passes after)
  • test_autolens/analysis 59 passed; test_autolens/point 60 passed
  • grep -rn PYAUTO_DISABLE_JAX autolens/ → empty (only reader is the PyAutoFit base class)
  • Nightly-impact triage: exactly one release script flips JAX→NumPy (autolens_workspace_test/scripts/point_source/visualization.py — unmarked; every other point/weak script is jax_-marked or no_run'd; user workspaces pin PYAUTO_DISABLE_JAX: "0" so are untouched). Ran it under its exact NumPy release env with this branch on PYTHONPATH: pass, 8 s.

Heart gate

Continuation of today's #181 work under the same human-acknowledged pre-existing RED. No downstream workspace edits required.

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

af.Analysis.__init__ is the single resolver of PYAUTO_DISABLE_JAX +
jax-availability; AnalysisLens.__init__ now always receives the
base-resolved self._use_jax instead of the raw parameter, at all three
call sites. Deletes the duplicate env read in AnalysisDataset (design
failure mode 8) and FIXES a live bug: AnalysisPoint and the weak
analysis silently undid the env downgrade (base set False, AnalysisLens
overwrote True), so PYAUTO_DISABLE_JAX=1 was a no-op for them.

Construction-level tests: env downgrade respected for AnalysisImaging
and AnalysisPoint (the point test fails on pre-fix source), no
over-downgrade when the env var is unset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 23, 2026
@Jammy2211
Jammy2211 merged commit a608897 into main Jul 23, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/env-jax-one-reader branch July 23, 2026 18:26
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant