Skip to content

pyflightstream.workspace.record_document (provisional)

Generated from the docstrings at build time: every one of the 4 names in the __all__ of pyflightstream.workspace.record_document has an entry below. The names a guide or an example uses come first; the others follow under Advanced.

Versioned run storage with immutable definitions and resolved in-memory rows.

Only the explicit workspace migration accepts an earlier document. Resolving a current document never consults today's inputs or changes historical evidence.

Advanced

pyflightstream.workspace.record_document.SCHEMA_VERSION module-attribute

SCHEMA_VERSION = 4

pyflightstream.workspace.record_document.decode_document

decode_document(
    document: Any,
    *,
    source: str | Path = "runs.json",
    unreadable: list[dict] | None = None,
) -> list[dict]

Validate and resolve the current document without converting earlier formats.

Parameters:

Name Type Description Default
document object

Parsed JSON document in the current storage format.

required
source str or Path

Source filename used in a refusal.

'runs.json'
unreadable list of dict

Query-only diagnostic sink. When supplied, row-local failures append their one-based position, run identity and error. Failed rows retain only their identity in the result. Omit this argument for strict writer reads.

None

Returns:

Type Description
list of dict

Resolved records with the original evidence and order preserved.

Raises:

Type Description
WorkspaceError

The document has an old format or invalid references or headers.

pyflightstream.workspace.record_document.encode_rows

encode_rows(rows: list[dict]) -> dict

Build one self-contained document without mutating resolved records.

Parameters:

Name Type Description Default
rows list of dict

Resolved run records and deletion entries, in their recorded order.

required

Returns:

Type Description
dict

Current document containing run headers and immutable shared definitions.

pyflightstream.workspace.record_document.read_rows

read_rows(
    path: Path, *, unreadable: list[dict] | None = None
) -> list[dict]

Read a current manifest; an absent file describes no executed runs.

Parameters:

Name Type Description Default
path Path

Manifest file to read without taking the writer's lease or changing the file; the read is kept out of this process's replace of it.

required
unreadable list of dict

Query-only row diagnostics, as in :func:decode_document. Omit for strict reads; malformed documents and shared registries are refused in both modes.

None

Returns:

Type Description
list of dict

Resolved records, or an empty list when the file is absent.

Raises:

Type Description
WorkspaceError

The file is unreadable, invalid or requires explicit migration.