pyflightstream.qa.drift (stable)¶
Generated from the docstrings at build time: every one of the 6 names in the __all__ of pyflightstream.qa.drift has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Cross-version drift suite (FR-27, SAD Section 11).
Pipeline role: diffs the same physics case set measured on two
FlightStream versions, so a solver release cannot silently move the
physics the research depends on. The case set is the Tier 3 registry of
:mod:pyflightstream.qa.physics, and the two measurements
are two runs of the workspace's physics matrix under two registries,
made by :func:pyflightstream.qa.matrix.drift_from_workspace
(PFS-2031.17); this module owns the diff and the report and runs
nothing itself.
Drift needs no stored references: version A is the baseline and version B is judged against it inside the same WARN and FAIL half widths the case metrics declare, so "the physics moved more than a reference regression would tolerate" means the same thing in both suites. The degenerate self-comparison (same version twice) exercises the whole machinery and must land every delta at zero, since repeat runs on 26.120 proved bit-identical (PHY-26120_2026-07-21_full).
Every executable path is explicit input, one per version, never guessed (SAD Section 5).
Advanced¶
pyflightstream.qa.drift.DriftCaseResult
dataclass
¶
DriftCaseResult(
case_id: str,
title: str,
metrics: dict[str, DriftMetric],
error: str | None = None,
)
Drift outcome of one physics case.
error carries the failure text when the case aborted on either
version; a failed case reports instead of hiding the others.
pyflightstream.qa.drift.DriftMetric
dataclass
¶
DriftMetric(
value_a: float,
value_b: float,
delta: float,
verdict: Verdict,
warn: float,
fail: float,
kind: str,
)
One metric compared across the two versions.
Attributes:
| Name | Type | Description |
|---|---|---|
value_a, value_b |
float
|
Measured values on the baseline and the compared version. |
delta |
float
|
|
verdict |
Verdict
|
Judgment of |
warn, fail |
float
|
The half widths applied, from the case metric specification. |
kind |
str
|
Band kind applied ( |
pyflightstream.qa.drift.DriftRun
dataclass
¶
DriftRun(
version_a: str,
version_b: str,
fs_exe_names: dict[str, str],
package_version: str,
results: tuple[DriftCaseResult, ...],
solver_identity: tuple[str, ...] = (),
fs_exe_sha256s: dict[str, str | None] = dict(),
executors: dict[str, ExecutorRecord | None] = dict(),
)
pyflightstream.qa.drift.diff_runs
¶
diff_runs(run_a: PhysicsRun, run_b: PhysicsRun) -> DriftRun
Diff two physics runs case by case and metric by metric.
Pure reduction over already-measured runs, so the drift judgment
is testable without a solver. Metrics are judged with the case's
declared bands centered on the version-A value; a metric absent
from the case specifications judges NO_REFERENCE rather than
inventing a band, and so does a relative metric whose A value is
exactly zero. A metric one run lacks judges FAIL, and a case
one run lacks is an aborted comparison: neither is skipped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run_a
|
PhysicsRun
|
The baseline and compared runs, normally of two different versions on the same case set. |
required |
run_b
|
PhysicsRun
|
The baseline and compared runs, normally of two different versions on the same case set. |
required |
Returns:
| Type | Description |
|---|---|
DriftRun
|
The comparison: one entry per case present in both runs, then one aborted entry (no metrics, an error naming the run that has it) per case present in one run only. |
pyflightstream.qa.drift.drift_report_paths
¶
drift_report_paths(
out_dir: str | Path,
*,
version_a: str,
version_b: str,
date: str | None = None,
label: str | None = None,
) -> tuple[Path, Path]
Return where a drift report for one comparison WOULD be written.
The DRF counterpart of
:func:pyflightstream.qa.physics.physics_report_paths, and the one
with the most to lose from a second copy: its stem joins TWO build
identifiers, so the CLI predicting the name had to reproduce both the
dot-stripping and the join order. The two builds are stated in the
order compared, A then B, which is the order the report's own body
uses; the join is not sorted, so swapping the arguments names a
different report rather than the same one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_dir
|
str or Path
|
Target directory, normally |
required |
version_a
|
(str, keyword - only)
|
Version identifiers, as :attr: |
required |
version_b
|
(str, keyword - only)
|
Version identifiers, as :attr: |
required |
date
|
(str, optional, keyword - only)
|
ISO date stamped into the stem; defaults to today. A caller that
will also write the report should resolve the date once and pass
it here AND to :func: |
None
|
label
|
str
|
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 and the directory is not made. |
pyflightstream.qa.drift.write_drift_report
¶
write_drift_report(
run: DriftRun,
out_dir: str | Path,
*,
date: str | None = None,
label: str | None = None,
) -> tuple[Path, Path]
Write one drift comparison as a report pair (YAML plus Markdown).
Same evidence discipline as the physics reports: the stem is
DRF-<A digits>-<B digits>_<date> plus the optional label, under
reports/physics/, and an existing report is never overwritten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
DriftRun
|
The comparison to record. |
required |
out_dir
|
str or Path
|
Target directory, normally |
required |
date
|
str
|
ISO date stamped into the report; defaults to today. |
None
|
label
|
str
|
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. |
Raises:
| Type | Description |
|---|---|
FileExistsError
|
When a report with the same stem already exists. |
QaEvidenceError
|
When the date is not spelled |
(UnknownVersionError, AmbiguousVersionAliasError)
|
When the run's version is not a registered build, or is a
vendor release name shared by several. The stem's build key is resolved through the
registry, so
these reach a direct Python caller where they did not before.
|