Skip to content

pyflightstream.qa.reports (stable)

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

Where an evidence report goes, and the refusal to overwrite one.

Pipeline role: the one home of the report-naming rule the three evidence writers share. qa.compat, qa.physics and qa.drift all name their output <SERIES>-<digits>_<date>[_label] and all refuse to overwrite one, because a report states what a solver did on a day and evidence supersedes evidence only through a new, dated report.

Pre-flight checks and writers share the naming rule, including the version key, so a collision can be refused before a licensed run starts. The CLI tests compare each writer's output path with the helper's predicted path.

The caller resolves the date once and passes that value to the path helper and document body. This keeps the file name and its recorded date aligned; the compatibility-report tests check both representations.

Advanced

pyflightstream.qa.reports.refuse_existing_report

refuse_existing_report(*paths: Path) -> None

Refuse to overwrite a committed report, wherever it is asked.

Evidence supersedes evidence only through a new, dated report, and a caller that has not yet spent a licensed seat should be told so BEFORE it does. Call it with the output of :func:report_paths.

Parameters:

Name Type Description Default
*paths Path

Report paths to test, normally the pair returned by :func:report_paths. Nothing is created and nothing is read; only existence is tested.

()

Raises:

Type Description
FileExistsError

If any named path exists. The BUILTIN, deliberately, and not a catalogued type: this preserves what the three writers have always raised, so except FileExistsError around a write still catches it. It is named in tests/tier1_offline/test_exceptions_catalog.py's ratchet rather than left unobserved.

Notes

The message suggests a distinguishing label or another directory. These describe ways to choose a new stem, not parameters of this function. Each CLI expresses the remedy using its own flags; the QA CLIs do not expose a date flag.

pyflightstream.qa.reports.report_paths

report_paths(
    out_dir: str | Path,
    *,
    series: str,
    versions: Sequence[str],
    date: str,
    label: str | None = None,
) -> tuple[Path, Path]

Return where one evidence report WOULD be written.

Parameters:

Name Type Description Default
out_dir str or Path

Target directory. NOT created here: asking where a report would go must not have the side effect of making a directory, because the whole point of asking is to decide whether to run at all.

required
series (str, keyword - only)

Report series, "CMP", "PHY" or "DRF": compat, physics and drift reports.

required
versions sequence of str, keyword-only

The canonical version identifiers the report is about, in the order the series states them: one for a single-version report, two for a comparison. The dots are stripped and the identifiers joined here rather than by the caller, so the writer and the pre-flight ask one question rather than two that happen to agree.

A LIST, NEVER A BARE STRING, and the refusal below is why the distinction is worth a paragraph. versions="26.123" type checks against Sequence[str], is not empty, and iterates its CHARACTERS, producing the stem PHY-2-6--1-2-3_2026-08-18; the doubled hyphen is the dot stripping to nothing. That is this module's own failure, one input over: a pre-flight asked that way is green against a name nothing will ever write, the licensed run proceeds, and the writer refuses at the end.

required
date (str, keyword - only)

ISO date, resolved by the caller. Required rather than defaulted; see this module's docstring.

required
label (str, optional, keyword - only)

Stem suffix distinguishing several reports on one day.

None

Returns:

Type Description
tuple of Path

The YAML path and the Markdown path, in that order. Neither is created.

Raises:

Type Description
QaEvidenceError

If label is not a portable file-name token, which the write could not create after the run. If versions is empty, or is a bare string. Both produce a stem no later reader can trace back to a solver: the empty sequence gives CMP-_2026-08-18 and a string gives one character per version. The word BUILD is kept only for the vendor's build number, which is a different field. The catalogued type rather than a bare ValueError, per FR-39, and it keeps ValueError as a base so an existing handler catches what it always did.

Notes

Everything after out_dir is keyword-only, and that is the adopted rule rather than a preference. series and the elements of versions are all strings, so a positional signature makes a swapped pair silent: report_paths("26123", "CMP", ...) would produce 26123-CMP_2026-08-18 and complain about nothing, and the failure would surface much later as a citation that does not resolve.

This is the PRIMITIVE the three series helpers call. A caller with a run in hand wants :func:pyflightstream.qa.compat.compat_report_paths, :func:pyflightstream.qa.physics.physics_report_paths or :func:pyflightstream.qa.drift.drift_report_paths instead: each knows its own series letter, so asking through one of them cannot put the wrong letter on a stem.

Examples:

These examples show the primitive with an explicit series. For a run object, prefer its series-specific helper, which supplies that value and delegates to this function.

>>> from pyflightstream.qa import report_paths
>>> yaml_path, md_path = report_paths(
...     "reports/physics", series="PHY", versions=["26.123"], date="2026-08-17"
... )
>>> yaml_path.name
'PHY-26123_2026-08-17.yaml'

Two versions make a comparison stem, joined in the order given:

>>> yaml_path, _ = report_paths(
...     "reports/physics",
...     series="DRF",
...     versions=["26.122", "26.123"],
...     date="2026-08-17",
...     label="full",
... )
>>> yaml_path.name
'DRF-26122-26123_2026-08-17_full.yaml'

A bare string is refused rather than iterated:

>>> from pyflightstream.qa import QaEvidenceError
>>> try:
...     report_paths(
...         "reports/physics", series="PHY", versions="26.123", date="2026-08-17"
...     )
... except QaEvidenceError as refused:
...     print(str(refused).split(";")[0])
versions is a sequence of version identifiers, not one string

pyflightstream.qa.reports.resolve_report_date

resolve_report_date(date: str | None = None) -> str

Return the ISO date a report is stamped with, defaulting to today.

Parameters:

Name Type Description Default
date str

An explicit ISO date. Returned unchanged when given, so this is safe to call on a value that may already be resolved.

None

Returns:

Type Description
str

The ISO date, YYYY-MM-DD.

Notes

Series helpers, writers, CLI subcommands and reference updates share this default. Resolve once and pass the result to both pre-flight and writer: independent calls can disagree across midnight. Each pyfs-qa subcommand passes one resolved value to both; direct Python callers must likewise retain the value across the run.