yera.runtime.replay_executor

Replay a stored session through the normal runtime event boundary.

Replay republishes recorded output events in their original order. At each recorded input event it pauses and requires the live caller to submit the same typed response before continuing. This recreates the session transcript without executing the original app.

Symbols

class ReplayExecutor — Replay one stored session without executing its application.

ReplayExecutor

Replay one stored session without executing its application.

Construction loads the session's ordered input and output events from the session store. start() creates a fresh event stream and a spawned process that republishes output until it reaches recorded input.

Live input must match the recorded event exactly. A timeout or mismatch is converted into a failure exit event, allowing the normal runtime and UI paths to report replay failure.

Methods

__init__ — Initialize an executor with the events stored for one session.
start — Start replay in a spawned process with a fresh event stream.
stop — Stop replay and release its process and stream resources.
make_factory_fn — Build an executor factory backed by recorded sessions.

ReplayExecutor.__init__

__init__(
    session_id: str,
    session_store_root: Path | None = None,
)

Initialize an executor with the events stored for one session.

Parameters

session_id
type: str

Identifier of the session whose events should be replayed.

session_store_root
type: Path | None = None

Directory containing the session database, or None to use Yera's default storage directory.

Raises

RuntimeError

If the stored events cannot be loaded.

ReplayExecutor.start

start() → None

Start replay in a spawned process with a fresh event stream.

Calling this method while its replay process is still running has no effect.

ReplayExecutor.stop

stop() → None

Stop replay and release its process and stream resources.

The process is given a bounded opportunity to exit before termination. Streams owned by the executor are closed so blocked output consumers wake up.

ReplayExecutor.make_factory_fn

make_factory_fn(
    session_sources: str | dict[str, str],
    session_store_root: Path | None = None,
) → Callable[[AppFunctionWrapper, tuple, dict, str], PyRuntimeExecutor]

Build an executor factory backed by recorded sessions.

Parameters

session_sources
type: str | dict[str, str]

One source session ID for every launched session, or live-session IDs mapped to their source session IDs.

session_store_root
type: Path | None = None

Directory containing the session database, or None to use Yera's default storage directory.

Returns

type: Callable[[AppFunctionWrapper, tuple, dict, str], PyRuntimeExecutor]

A runtime-executor factory that resolves each live session to its recorded source.