Skip to content

feat(test_mode): PYAUTO_LATENT_NAN_INJECT hook for latent NaN robustness tests#112

Open
Jammy2211 wants to merge 1 commit into
mainfrom
feature/latent-nan-masking-fix
Open

feat(test_mode): PYAUTO_LATENT_NAN_INJECT hook for latent NaN robustness tests#112
Jammy2211 wants to merge 1 commit into
mainfrom
feature/latent-nan-masking-fix

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Adds a test-only NaN-injection hook to autoconf.test_mode so the *_workspace_test integration suites can deterministically reproduce the latent-variable masking failure fixed in PyAutoFit (compute_latent_samples). Two helpers are added, both gated on the PYAUTO_LATENT_NAN_INJECT environment 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() and inject_latent_nans(values_2d, start_index). Both are inert unless PYAUTO_LATENT_NAN_INJECT is set. No existing symbols changed.
See full details below.

Test Plan

  • pytest test_autoconf/ passes.
  • With the env var unset, inject_latent_nans(arr, 0) returns arr unchanged.
  • Downstream: the three latent_nan_robustness.py workspace_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 the PYAUTO_LATENT_NAN_INJECT spec string (e.g. "stride:N") or None.
  • 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 of N per the spec; handles NumPy and JAX arrays; no-op when the spec is unset/unrecognised.

🤖 Generated with Claude Code

…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>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant