@@ -981,11 +981,34 @@ def _test_mode_samples_info(self) -> dict:
981981 Sampler-specific keys to merge into ``samples_info`` when the
982982 sampler is bypassed via ``PYAUTO_TEST_MODE=2`` or ``=3``.
983983
984- Override in subclasses to add the diagnostic keys that the real
985- run would populate (e.g. NUTS ESS, MCMC autocorrelations) so that
986- tutorial scripts and downstream code can access those keys
987- without ``KeyError``. Use NaN/0 placeholders — the bypass did not
988- actually sample.
984+ **Opt-in, not a per-sampler obligation.** Most searches do not
985+ override this, and that is correct — no library code reads these
986+ diagnostic keys under bypass. The properties that read them
987+ (``SamplesMCMC.total_steps``, ``SamplesNest.total_samples``, …)
988+ live on ``Samples`` subclasses the bypass never constructs;
989+ ``_fit_bypass_test_mode`` always builds a ``SamplesPDF``. The only
990+ consumers are workspace scripts reading ``samples_info[...]``
991+ directly, so override this only when such a script exists.
992+
993+ Which fix applies depends on what that script does with the keys:
994+
995+ - It **prints** them (a tutorial, whose point is the prose, so it
996+ may legitimately run bypassed) → override here, returning NaN/0
997+ placeholders. The bypass did not sample; honest empties.
998+ - It **asserts** on them (a test) → the script must not run
999+ bypassed at all. Give it an ``ENV: real_search`` declaration
1000+ instead. Do **not** add placeholders for an asserting reader:
1001+ the assert then silently passes on a stub value, which is worse
1002+ than the ``KeyError`` it replaced.
1003+
1004+ Both live cases follow that split. ``BlackJAXNUTS`` overrides this
1005+ because ``autofit_workspace/scripts/searches/mcmc.py`` prints
1006+ ``ess_min`` / ``n_divergent``, carries no ``__Env__`` declaration
1007+ and is in that workspace's ``smoke_tests.txt``, so it runs
1008+ bypassed on every PR (PyAutoFit #1260).
1009+ ``AbstractMultiStartGradient`` deliberately does not: its only
1010+ reader asserts on ``total_steps``, so that script declares
1011+ ``ENV: real_search jax`` instead (autofit_workspace_test #83).
9891012 """
9901013 return {}
9911014
0 commit comments