jaxrens.unvalidated

Mark code paths that have never been exercised in a production simulation.

This is about validation, not test coverage. A function marked here may be fully unit-tested and still carry the marker: what is missing is a real nested sampling run whose output someone looked at and believed. The two axes are orthogonal — use # pragma: no cover for the coverage gap, and this module for “I am not yet confident this does what I intended”.

Usage:

from jaxrens.unvalidated import unvalidated

@unvalidated(
    concern="the accept criterion is a hard delta_H < 1.0 cut, not a "
            "Metropolis test",
    since="0.2.2",
    clears_when="an NS run whose HMC accept rate tracks the random-walk move",
)
def build_kernel(...):
    ...

The decorator registers at import (so the unvalidated surface is enumerable without calling anything, see REGISTRY) and warns on the first call (so a user only hears about the paths they actually touch). Every marker that fires is recorded in triggered(), which is what the HDF5 trajectory writer stamps into the output file — a transient stderr warning is invisible in a batch job, but a caveat attached to the data survives.

Policy is set by the JAXRENS_UNVALIDATED env var:

warn (default)

Emit an UnvalidatedFeatureWarning once per feature, and log it to the jaxrens logger (so it lands in the run’s log file).

ignore

Stay silent, but still record the marker in triggered() so the output file is stamped regardless.

error

Raise. Useful for a production campaign where you want a hard guarantee that nothing unvalidated was touched.

Deliberately stdlib-only: this module is imported from JAX-free paths (notably jaxrens.io.trajectory) and must not pull JAX in.

Module Attributes

REGISTRY

Every marker declared at import time, keyed by feature name.

Functions

format_summary

Render records (default: triggered()) as one line per feature.

reset

Forget which markers have fired, so they warn again.

triggered

Markers that have actually fired in this process, in trigger order.

unvalidated

Decorator marking a function as never run in a production simulation.

warn_unvalidated

Flag feature as unvalidated, once per process.

Classes

F

Type variable.

Unvalidated

Provenance record for one unvalidated code path.

Exceptions

UnvalidatedFeatureWarning

A code path that has never been exercised in a production simulation.