nirs4all.pipeline.dagml.core_archive_replay module

Fail-closed public replay adapter for native Package V2/V3 Core containers.

This module only performs host-input adaptation. Core owns container and selected-closure validation (the declared owner, content type, profile and operation), DAG-ML owns replay contracts and scheduling, and the Methods runtime owns numerical execution. The caller passes the one retained Core handle of its public call (N4aSource) or, for a direct path call, Core opens the path itself. No legacy runner or Python model callback is part of this path.

exception nirs4all.pipeline.dagml.core_archive_replay.CoreArchiveDependencyError(dependency: str, message: str, *, mitigation: str)[source]

Bases: CoreArchiveReplayError

A required native Archive V2 component is absent or incompatible.

exception nirs4all.pipeline.dagml.core_archive_replay.CoreArchiveReplayError[source]

Bases: RuntimeError

A recognized Core archive cannot be replayed safely.

class nirs4all.pipeline.dagml.core_archive_replay.CoreArchiveValidation(core: Any, package: dict[str, Any], predictors: tuple[dict[str, Any], ...], methods_library_path: str, methods_library_sha256: str)[source]

Bases: object

Core-derived, byte-bound evidence cached by one strict consumer.

core: Any
methods_library_path: str
methods_library_sha256: str
package: dict[str, Any]
predictors: tuple[dict[str, Any], ...]
nirs4all.pipeline.dagml.core_archive_replay.core_input(archive_path: str | Path, source: Any = None) → Any[source]

The Core reader input of one public call: the retained NativePackage, else the path.

source is the N4aSource already opened by the caller; its retained Core NativePackage carries the selected proof, so every read reuses one verified closure.

nirs4all.pipeline.dagml.core_archive_replay.predict_core_methods_archive_v2(archive_path: str | Path, data: Any, *, methods_library_path: str | Path | None, validated_archive: CoreArchiveValidation | None = None, source: Any = None, outcome_id: str = 'outcome:nirs4all.core_archive_predict', run_id: str = 'run:nirs4all.core_archive_predict') → tuple[ndarray, dict[str, Any]][source]

Replay one exact, explicitly identified raw cohort through Core V2.

validated_archive is the immutable package-contract cache owned by a loaded Session; it is bound to that Session’s retained Core handle (source), whose reads Core verifies against the opened container, so a changed file is refused by Core rather than re-hashed here. Core reads the selected closure for every replay, and the Methods runtime keeps all native handles scoped to that call. It is not a general replay-result cache.

nirs4all.pipeline.dagml.core_archive_replay.validate_core_methods_archive_v2(archive_path: str | Path, *, methods_library_path: str | Path | None = None, source: Any = None) → CoreArchiveValidation[source]

Validate one Package V2 container and derive its predictors from native bytes.