feat(test_mode): PYAUTO_LATENT_NAN_INJECT hook for latent NaN robustness tests#112
Open
Jammy2211 wants to merge 1 commit into
Open
feat(test_mode): PYAUTO_LATENT_NAN_INJECT hook for latent NaN robustness tests#112Jammy2211 wants to merge 1 commit into
Jammy2211 wants to merge 1 commit into
Conversation
…ustness tests Adds latent_nan_inject_spec() and inject_latent_nans() to autoconf.test_mode, env-gated test-only helpers (no-op in production) used by the *_workspace_test integration suites to reproduce the per-batch latent masking bug fixed in PyAutoFit's compute_latent_samples. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Summary
Adds a test-only NaN-injection hook to
autoconf.test_modeso the*_workspace_testintegration suites can deterministically reproduce the latent-variable masking failure fixed in PyAutoFit (compute_latent_samples). Two helpers are added, both gated on thePYAUTO_LATENT_NAN_INJECTenvironment variable and a complete no-op when it is unset — production behaviour is unchanged.API Changes
Added two public functions to
autoconf.test_mode:latent_nan_inject_spec()andinject_latent_nans(values_2d, start_index). Both are inert unlessPYAUTO_LATENT_NAN_INJECTis set. No existing symbols changed.See full details below.
Test Plan
pytest test_autoconf/passes.inject_latent_nans(arr, 0)returnsarrunchanged.latent_nan_robustness.pyworkspace_test scripts reproduce the bug pre-fix and pass post-fix against the PyAutoFit change.Full API Changes (for automation & release notes)
Added
autoconf.test_mode.latent_nan_inject_spec()— returns thePYAUTO_LATENT_NAN_INJECTspec string (e.g."stride:N") orNone.autoconf.test_mode.inject_latent_nans(values_2d, start_index)— sets NaN on column 0 of a(n_samples, n_latents)array at non-zero absolute indices that are multiples ofNper the spec; handles NumPy and JAX arrays; no-op when the spec is unset/unrecognised.🤖 Generated with Claude Code