pyflightstream.qa (stable)¶
Generated from the docstrings at build time: every one of the 42 names in the __all__ of pyflightstream.qa has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Probe harness and physics regression tooling.
Pipeline role: produces the evidence behind the command database. Tier 2
probes (:mod:pyflightstream.qa.probes) execute each database command in
a minimal script on a licensed machine and classify it into four
outcomes: verified, broken and removed are promotable evidence,
and unprobed records why no judgment exists. A build whose solver
refuses the name is removed rather than broken, because the two
produce different refusals for a caller. A command that runs but does
nothing is broken, not verified;
:mod:pyflightstream.qa.compat writes the compat report under
reports/compat/ and promotes database statuses from it. Tier 3 is
here as well: the physics judge, reductions and references
(:mod:pyflightstream.qa.physics), the version-comparison drift diff
(:mod:pyflightstream.qa.drift), and the driver that reads
both out of a campaign workspace (:mod:pyflightstream.qa.matrix): the
cases are rows of the workspace's physics matrix, run through the run
layer over the workspace's synthetic library, so no research geometry is
needed and no case is stated in Python (PFS-2031.17).
:mod:pyflightstream.qa.reports holds the report-naming and
never-overwrite rule all three writers share, so a run is refused before
a licensed seat is spent rather than after. The pyfs-qa CLI
(:mod:pyflightstream.qa.cli) drives all three.
The probe specification catalog (:mod:pyflightstream.qa.specs) is cut
into private modules that register into one shared table:
qa._spec_kit holds the instruments and the registry,
qa._spec_catalog_b, qa._spec_ccs_noise, qa._spec_ccs_mesh and
qa._spec_t1 hold the entries, and qa.specs imports them all and
re-exports PROBE_SPECS.
One member of this package spends no seat at all and reads no report:
:mod:pyflightstream.qa.cost builds the wall-time cost view from
campaign manifests alone, points down and solver builds across, so a
build that got slower on the same points can be shown. FR-19 has
recorded the field; this is what reads it.
Used in the guides¶
pyflightstream.qa.cost_view
¶
cost_view(source: CostSource) -> CostView
Build the wall-time cost view of one campaign's manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
CampaignWorkspace, str, Path, or iterable of RunRecord
|
A managed workspace, a campaign root whose |
required |
Returns:
| Type | Description |
|---|---|
CostView
|
Points down, solver builds across. Empty (no builds, no points) for a campaign with no recorded runs, which a caller must decide about: an empty cost table is not a fast campaign. |
See Also
cost_rows : the long form, one row per run.
pyflightstream.results.tables.run_table : the results-layer view of
the same manifest, which carries coefficients and maps a
missing wall time to math.nan.
Examples:
A campaign with no recorded run is an empty view, not a fast one; this module's top docstring compares two builds.
>>> view = cost_view([])
>>> view.builds, view.points
((), ())
Advanced¶
pyflightstream.qa.BuildComparison
dataclass
¶
BuildComparison(
baseline: BuildKey,
candidate: BuildKey,
paired: tuple[PointCost, ...] = (),
unpaired: tuple[PointKey, ...] = (),
)
Two builds over the points BOTH of them timed.
Attributes:
| Name | Type | Description |
|---|---|---|
baseline, candidate |
BuildKey
|
The two columns compared, in that order. |
paired |
tuple of PointCost
|
Points timed on both builds, in the view's row order. |
unpaired |
tuple of PointKey
|
Points recorded on at least one of the two builds and timed on fewer than both. They are named rather than silently dropped, because the totals below exclude them and a reader has to know how much of the campaign the comparison did not cover. |
baseline_total_s
property
¶
baseline_total_s: float
Seconds the baseline spent on the paired points.
candidate_total_s
property
¶
candidate_total_s: float
Seconds the candidate spent on the same paired points.
ratio
property
¶
ratio: float | None
Total candidate time over total baseline time; None if unknown.
None when no point is paired, so the caller cannot read
"nothing to compare" as "no change".
pyflightstream.qa.BuildKey
dataclass
¶
BuildKey(fs_build: str | None, fs_exe_sha256: str | None)
One column of the cost view: the solver that produced the times.
Attributes:
| Name | Type | Description |
|---|---|---|
fs_build |
str or None
|
Vendor build string as the solver reported it, from
:attr: |
fs_exe_sha256 |
str or None
|
Hex sha256 of the executable that ran, from
:attr: |
label
property
¶
label: str
Reading name of the column, <build>@<first 12 of sha256>.
Both halves are present even when one field is missing, so a label is always shaped the same way and a reader can tell an unrecorded field from a recorded one.
pyflightstream.qa.CostCell
dataclass
¶
CostCell(
samples: tuple[float, ...] = (),
run_count: int = 0,
excluded_count: int = 0,
excluded_samples: tuple[float, ...] = (),
)
Every run recorded for one (point, build), and what they cost.
Attributes:
| Name | Type | Description |
|---|---|---|
samples |
tuple of float
|
Wall-clock seconds of each run there that recorded one AND reached an answer, in manifest order. A re-run adds a sample rather than replacing one: a manifest is evidence and the second reading does not delete the first. |
excluded_samples |
tuple of float
|
Wall-clock seconds of the runs counted in |
run_count |
int
|
Runs recorded for this (point, build), timed or not. |
excluded_count |
int
|
How many of them did NOT REACH AN ANSWER, which is a wider set than failure: every FAILED status, a run the wall clock stopped, and a point still in a queue. Time to a failure is time, and it is not the time to an answer; the runs are kept and counted rather than dropped, because a silent drop is a quieter lie than a reported one. |
wall_time_s
property
¶
wall_time_s: float | None
Mean of the recorded samples in seconds, or None.
Over the runs that reached an answer only. None when none of
them was timed. It is deliberately not
0.0 and deliberately not math.nan: see this module's
top docstring.
pyflightstream.qa.CostView
dataclass
¶
CostView(
builds: tuple[BuildKey, ...] = (),
points: tuple[PointKey, ...] = (),
cells: Mapping[
tuple[PointKey, BuildKey], CostCell
] = dict(),
)
The pivot: sweep points down, solver builds across.
Attributes:
| Name | Type | Description |
|---|---|---|
builds |
tuple of BuildKey
|
Columns, ordered by label so a rendering is reproducible. |
points |
tuple of PointKey
|
Rows, ordered by simulation id then by axis values. |
cells |
mapping
|
|
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If two builds render the same label, which two hashes sharing
their first twelve characters would do. Refusing is the point:
a duplicated label makes one column overwrite the other in
:meth: |
cell
¶
cell(point: PointKey, build: BuildKey) -> CostCell
Return the runs recorded for one point on one build.
Returns an empty cell (run_count == 0) when that point was
never run on that build, which is a different fact from a run
that was not timed; :attr:CostCell.recorded separates them.
wall_time_s
¶
wall_time_s(
point: PointKey, build: BuildKey
) -> float | None
Mean wall-clock seconds there, or None when absent.
build
¶
build(label: str) -> BuildKey
Resolve one column by its label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
A label as :attr: |
required |
Returns:
| Type | Description |
|---|---|
BuildKey
|
The column that label names. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If no column carries it. The message lists the labels that do exist, because the caller typed one and the useful answer is the real ones rather than the shape of a label. |
rows
¶
rows() -> list[dict[str, object]]
Return the pivot as plain rows: identity columns, then one per build.
Returns:
| Type | Description |
|---|---|
list of dict
|
One dict per point. Keys are |
compare
¶
compare(
baseline: BuildKey | str, candidate: BuildKey | str
) -> BuildComparison
Put two builds side by side over the points both of them timed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
baseline
|
BuildKey or str
|
The two columns, as keys or as labels. The baseline is the build the other is measured against, so a ratio above 1 means the candidate is slower. |
required |
candidate
|
BuildKey or str
|
The two columns, as keys or as labels. The baseline is the build the other is measured against, so a ratio above 1 means the candidate is slower. |
required |
Returns:
| Type | Description |
|---|---|
BuildComparison
|
Carrying the paired points, the points it could not pair, and the two totals over the paired set only. |
pyflightstream.qa.DEFAULT_ERROR_PATTERNS
module-attribute
¶
DEFAULT_ERROR_PATTERNS: tuple[str, ...] = (
"(?i)\\berror\\b",
"(?i)\\bunable\\b",
"(?i)\\bfailed\\b",
"(?i)\\binvalid\\b",
"(?i)not recognized",
)
pyflightstream.qa.Judgment
dataclass
¶
Judgment(
*,
command: str,
fs_version: str,
outcome: ProbeOutcome,
date: str,
report: str,
)
One report's promotable judgment of one command in one build.
Keyword-only, and that is the whole point of the type rather than a
style choice. The five fields are consecutive strings, so a
positional constructor would put the swap hazard it was created to
remove back on the mandatory path: contradicting_evidence takes
this record, so building one by hand is the only way to call it, and
a swapped pair makes the index lookup miss and answer "nothing
contradicts, promote it". ProbeSpec is keyword-only for the same
reason.
Attributes:
| Name | Type | Description |
|---|---|---|
command |
str
|
Database command name. |
fs_version |
str
|
Canonical FlightStream identifier the report probed. |
outcome |
ProbeOutcome
|
One of :data: |
date |
str
|
The report's ISO date, or the empty string when it carries none. ISO dates order lexicographically, which is what makes the comparison below a plain string comparison. |
report |
str
|
Repository-relative POSIX path of the report, the same form the database cites. |
pyflightstream.qa.PROMOTABLE_OUTCOMES
module-attribute
¶
PROMOTABLE_OUTCOMES = frozenset(ProbeOutcome) - {
ProbeOutcome.UNPROBED
}
pyflightstream.qa.PointCost
dataclass
¶
PointCost(
point: PointKey, baseline_s: float, candidate_s: float
)
One point measured on both builds of a comparison.
Attributes:
| Name | Type | Description |
|---|---|---|
point |
PointKey
|
The simulation and sweep point. |
baseline_s, candidate_s |
float
|
Mean wall-clock seconds on each build. |
ratio
property
¶
ratio: float | None
candidate_s / baseline_s; above 1 means slower.
None when the baseline reading is zero, which no real
solver run produces and a hand-built record can.
pyflightstream.qa.PointKey
dataclass
¶
PointKey(
sim_id: str,
axes: tuple[tuple[str, float], ...],
job: tuple[str, ...] | None = None,
)
One row of the cost view: a simulation and the point it ran.
The point is IDENTIFIED here, not analysed. Its axes stay a sorted
tuple rather than becoming columns, which is why this table has no
axis-collides-with-a-fixed-column failure mode;
:func:pyflightstream.results.tables.sweep_table is where an axis
becomes a column and where that collision is checked.
THE AXES ARE THE AERODYNAMIC ONES AND ONLY THOSE, because the point
is what the run layer recorded and the run layer records
:meth:pyflightstream.cases.SweepAxis.points. A geometry variant is
therefore invisible in a row: two rotations of the same mesh run
under one sim_id at one alpha land in ONE cell, and
:attr:CostCell.wall_time_s averages them, so the variant that got
slower cannot be seen. That is not a gap to close here. It is the
evidence-side half of the reason a geometric sweep is not allowed to
multiply with an aerodynamic one (PFS-2025.17): a study OF the
geometry is one case per geometry, and a case is a sim_id, so
each geometry is a row of its own in this table and the comparison
the module exists for stays askable.
Attributes:
| Name | Type | Description |
|---|---|---|
sim_id |
str
|
Simulation identifier from the manifest record. |
axes |
tuple of (str, float)
|
Sweep point as (axis name, value) pairs sorted by name. Values are compared exactly, which is what makes two runs of the same matrix line land in the same row; units are the axis's own, as the case matrix declared them. Empty for a job row. |
job |
tuple of str, optional
|
|
label
property
¶
label: str
Reading name of the point, alpha_deg=2.0, beta_deg=0.0.
The value is rendered with repr, which round-trips a float
exactly, rather than with a fixed precision. This label is an
IDENTITY and two points a hair apart are two rows; :g would
have printed six significant digits and given them one name.
A job row reads sweep of 3 points: AL+000, AL+002, AL+004.
pyflightstream.qa.ProbeArtifacts
dataclass
¶
ProbeArtifacts(
workdir: Path,
log_before: str | None,
log_after: str | None,
begin_marker: str,
end_marker: str,
execution: ExecutionResult,
)
Everything a probe left behind, handed to the effect assertion.
Attributes:
| Name | Type | Description |
|---|---|---|
workdir |
Path
|
Working directory of this probe; support files and any solver outputs land here. |
log_before |
str or None
|
Log exported after the BEGIN sentinel and before the target command; None when the file never appeared. |
log_after |
str or None
|
Log exported right after the END sentinel and before the epilogue; None when the file never appeared (script aborted at the target, or halted by design). Exporting it before the epilogue keeps abort attribution clean: an epilogue instrument that aborts can never be blamed on the target. |
begin_marker, end_marker |
str
|
The sentinel texts delimiting the target command's log region. |
execution |
ExecutionResult
|
Typed outcome of the solver process. |
saved_before
¶
saved_before() -> str | None
Return the simulation file saved before the target, if any.
saved_after
¶
saved_after() -> str | None
Return the simulation file saved after the target, if any.
target_region
¶
target_region() -> str
Return the log lines belonging to the target command alone.
The region runs from the last line carrying the BEGIN marker to the first later line carrying the END marker, both exclusive, in the log exported after the command. Empty when that log or the BEGIN marker is missing.
pyflightstream.qa.ProbeEnvironmentError
¶
Bases: PyflightstreamError, RuntimeError
The probe environment is unusable, so no command was judged.
Raised when the baseline probe fails (solver not starting, license checkout failure, log export not landing) or when a probe working directory cannot be prepared safely. Environment failures abort the run because recording them as broken commands would be false evidence.
pyflightstream.qa.ProbeOutcome
¶
Bases: StrEnum
Judgment of one probe.
verified, broken and removed are promotable evidence;
unprobed records why no judgment exists (no probe specification
yet, not in this run's subset, or an inconclusive execution such as
a timeout).
broken and removed are not interchangeable and the
difference is the caller's, not the record keeper's. Both refuse at
build time, so the difference is WHICH refusal and whether a waiver
exists.
broken means the build CARRIES the command and it misbehaves
against its documentation. The command stays in the version view
with its grammar, and the caller meets BrokenCommandError, whose
message says the solver accepts the line and would return numbers
nothing marks as wrong; Script.allow_broken waives it. Both
halves are FALSE for a build that does not carry the command: the
solver rejects the line outright, and a waiver would emit it anyway.
removed means the build does not carry it. The command leaves
the view entirely, so the caller gets a refusal naming the build and
there is no waiver to reach for.
pyflightstream.qa.ProbeResult
dataclass
¶
ProbeResult(
command: str,
outcome: ProbeOutcome,
detail: str,
sentinel_before: bool = False,
sentinel_after: bool = False,
effect: bool | None = None,
log_errors: tuple[str, ...] = (),
wall_time_s: float | None = None,
return_code: int | None = None,
script_sha256: str | None = None,
expected: str = "",
observation: str | None = None,
)
Evidence line of one command in one probe run.
Attributes:
| Name | Type | Description |
|---|---|---|
command |
str
|
Database name of the probed command. |
outcome |
ProbeOutcome
|
The judgment; see :class: |
detail |
str
|
Human-readable evidence sentence behind the judgment. |
sentinel_before, sentinel_after |
bool
|
Whether each sentinel marker was found printed in its exported log; the pair discriminates "aborted at the command" from "never ran". |
effect |
bool or None
|
Effect assertion result; None when it never ran. |
log_errors |
tuple of str
|
Error lines matched between the sentinels, verbatim. |
wall_time_s |
float or None
|
Wall-clock time of the solver process, seconds. |
return_code |
int or None
|
Solver process return code; None when killed on timeout. |
script_sha256 |
str or None
|
Hash of the generated probe script, for reproducibility. |
expected |
str
|
The effect the specification asserts (its |
observation |
str or None
|
What the specification's |
pyflightstream.qa.ProbeRun
dataclass
¶
ProbeRun(
version: str,
solver_identity: tuple[str, ...],
fs_exe_name: str,
package_version: str,
results: tuple[ProbeResult, ...],
fs_exe_sha256: str | None = None,
executor: ExecutorRecord | None = None,
)
One whole probe run: version, environment identity, evidence.
Attributes:
| Name | Type | Description |
|---|---|---|
version |
str
|
Canonical FlightStream version the run targeted. |
solver_identity |
tuple of str
|
Verbatim log lines naming the solver version and build, taken from the baseline probe (FR-18: the printed version string may not discriminate hotfix builds; the build number does). |
fs_exe_name |
str
|
File name of the executable that ran (never the local path; executables live outside Git). |
package_version |
str
|
pyflightstream version that generated the probes. |
results |
tuple of ProbeResult
|
One evidence line per database command of this version. |
fs_exe_sha256 |
str or None
|
Lowercase hexadecimal sha256 of the executable's bytes, or
|
executor |
ExecutorRecord or None
|
How the solver was called, read off the baseline run
(PFS-2012.04): the executor's class name and the argv it ran.
The report builds its executor sentence from this rather than
asserting the default executor; |
outcome_counts
¶
outcome_counts() -> dict[str, int]
Return how many commands landed in each outcome.
pyflightstream.qa.ProbeSpec
dataclass
¶
ProbeSpec(
*,
command: str,
build_target: Callable[[Script, Path], None],
assert_effect: Callable[[ProbeArtifacts], bool | None]
| None = None,
expects_halt: bool = False,
requires: Requires = Requires.NONE,
early_prelude: Callable[[Script, Path], None]
| None = None,
prelude: Callable[[Script, Path], None] | None = None,
epilogue: Callable[[Script, Path], None] | None = None,
save_state: bool = False,
dump_state: bool = False,
effect_note: str = "",
observe: Callable[[ProbeArtifacts], str] | None = None,
timeout_s: float | None = None,
preconditions: tuple[str, ...] = (),
)
How to probe one command: emission, and the observable effect.
Attributes:
| Name | Type | Description |
|---|---|---|
command |
str
|
Database name of the target command. |
build_target |
callable
|
|
assert_effect |
(callable, optional)
|
|
expects_halt |
bool
|
The command is expected to halt script processing (STOP); the halt itself is the asserted effect, so the sentinel logic inverts: the log before the command must exist and the one after it must never appear. |
requires |
Requires
|
Prelude tier emitted before the sentinels; see
:class: |
early_prelude |
(callable, optional)
|
|
prelude |
(callable, optional)
|
|
epilogue |
(callable, optional)
|
|
save_state |
bool
|
Bracket the target with SAVEAS, writing the simulation file
before and after it ( |
dump_state |
bool
|
Bracket the target with OUTPUT_SETTINGS_AND_STATUS dumps
( |
effect_note |
str
|
One sentence naming the asserted effect; quoted in the compat report evidence line. |
observe |
(callable, optional)
|
|
timeout_s |
(float, optional)
|
Per-probe override of the run timeout; halting probes use a short one because the hidden solver may idle after the halt. |
preconditions |
tuple of str
|
Commands the spec's prelude emits so that the target has
something to act on, and that the database may record |
pyflightstream.qa.QaEvidenceError
¶
Bases: PyflightstreamError, ValueError
A committed QA artifact cannot be read as the evidence it claims.
A reference or report whose schema, version basis or metric set does not parse, a geometry manifest that disagrees with the mesh it describes, an update that would overwrite evidence with something not comparable to it. The QA layer refuses rather than guessing, because its whole output is evidence.
FR-39: ValueError is a second base so except ValueError also
catches this refusal.
pyflightstream.qa.Requires
¶
Bases: StrEnum
Session state a probe needs before its sentinels (prelude tier).
none runs on the empty session; sim opens a local
simulation file (explicit input, never committed); solver adds
the minimal solver setup and INITIALIZE_SOLVER; solution adds
a short START_SOLVER run. Each tier used by a run is validated by
its own baseline first, so a broken prelude downgrades its probes
to unprobed instead of blaming the target commands.
pyflightstream.qa.apply_compat
¶
apply_compat(
report_path: str | Path,
*,
repo_root: str | Path = ".",
commands_dir: str | Path | None = None,
reports_dir: str | Path | None = None,
) -> list[tuple[str, str, str]]
Promote database statuses from a committed compat report.
Every command the report judged with one of
:data:PROMOTABLE_OUTCOMES (verified, broken or
removed) gets its version line in the chapter YAML written with
the new status and the report cited in the report field;
unprobed commands are untouched. A command that already records the version is rewritten
in place; one that does not gains the line at its release position,
which is what the first probe run of a newly registered version
needs. A row whose status the report changes keeps, in its note, the
outcome and the report it replaced ("This verdict supersedes ..."), so a
superseded verdict still names its evidence. The edit is line-level
on the flow-mapping version lines, so chapter comments and layout
survive; a command whose version block holds no single-line entry to
pattern on is refused loudly rather than mangled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_path
|
str or Path
|
The committed report YAML ( |
required |
repo_root
|
str or Path
|
Repository root; the report citation written into the database is the report path relative to it, in POSIX form. |
'.'
|
commands_dir
|
str or Path
|
Chapter YAML directory, which must lie under |
None
|
reports_dir
|
str or Path
|
Directory of committed compat reports the incoming one is
checked against for supersession; defaults to
|
None
|
Returns:
| Type | Description |
|---|---|
list of tuple
|
One |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
When the report is not a compat report, when it or the command
database lies outside |
pyflightstream.qa.compat_report_paths
¶
compat_report_paths(
out_dir: str | Path,
*,
version: str,
date: str | None = None,
label: str | None = None,
) -> tuple[Path, Path]
Return where a compat report for one run WOULD be written.
Derive the paths before spending a licensed solver seat so a caller can refuse an existing report stem before launching probes. The writer uses the same paths, avoiding a late collision that would discard run results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_dir
|
str or Path
|
Target directory, normally |
required |
version
|
(str, keyword - only)
|
Version identifier, 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.contradicting_evidence
¶
contradicting_evidence(
judgments: dict[tuple[str, str], tuple[Judgment, ...]],
*,
incoming: Judgment,
) -> tuple[Judgment, ...]
Judgments in the committed evidence that supersede incoming.
A judgment supersedes when it is at least as recent AND records a DIFFERENT outcome. Both halves are deliberate.
Agreement never supersedes. The plan behind this guard
(PLN-20260804-1500) asked for the strictly newest report to be
the cited one, and measurement of the committed evidence refuted it as the
rule to enforce: four rows cite a full run while a later
--identity-only run of the same build also judges PRINT,
because the baseline probe exercises it. Nothing is wrong with
those four rows, and a guard red on a correct database is a guard
that gets switched off. What the plan actually measured, and what
this catches, is a report REVERTING a status another report
already moved.
Same-date is included because two reports of one day that disagree are ambiguous, and an ambiguity resolved silently by file order is the failure this whole function exists to prevent. A report with no date sorts oldest and so can never supersede a dated one: a report that cannot show it is newer is treated as not newer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
judgments
|
dict
|
Index from :func: |
required |
incoming
|
Judgment
|
The judgment about to be written. Passed as the record rather
than as its five fields, because five interchangeable strings in
a row fail SILENTLY when two are swapped: the lookup misses, the
answer is empty, and the caller reads that as "nothing
contradicts, promote it". The record cannot be mis-ordered.
Its |
required |
Returns:
| Type | Description |
|---|---|
tuple of Judgment
|
Superseding judgments, oldest first; empty when nothing contradicts the incoming one. |
pyflightstream.qa.cost_rows
¶
cost_rows(source: CostSource) -> list[dict[str, object]]
Return the long form of the same evidence: one row per run.
Where :func:cost_view pivots so two builds can be read across, this
keeps the manifest's own shape and spells fs_build and
fs_exe_sha256 as ordinary columns, with the FULL hash rather
than a label prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
CampaignWorkspace, str, Path, or iterable of RunRecord
|
As :func: |
required |
Returns:
| Type | Description |
|---|---|
list of dict
|
One dict per run, in manifest order, which is the order the
campaign recorded them in and therefore the evidence order.
Keys are :data: |
pyflightstream.qa.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.dump_changed
¶
dump_changed() -> Callable[[ProbeArtifacts], bool | None]
Make an effect assertion: the state dump differs after the target.
A difference proves the command acted; an identical dump proves nothing (the dump may simply not expose that state), so it records None (unprobed), never False.
Returns:
| Type | Description |
|---|---|
callable
|
The assertion: True when the dump after the target differs from the one before, None otherwise. |
pyflightstream.qa.dump_gained
¶
dump_gained(
token: str, strict: bool = False
) -> Callable[[ProbeArtifacts], bool | None]
Make an effect assertion: a distinctive token entered the state dump.
The token is a value only the probe would set (for example
7.2531), searched in the OUTPUT_SETTINGS_AND_STATUS dump taken
after the target (dump_state probes). Absence means None
(unobservable, unprobed) unless strict, for settings the dump
is known to expose, where absence is a real no-op (broken).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
Distinctive text expected in the dump after the command. |
required |
strict
|
bool
|
Whether an absent token breaks instead of recording unprobed. A missing dump file records unprobed either way: it is the instrument that failed. |
False
|
Returns:
| Type | Description |
|---|---|
callable
|
True when the token appears after the target and was absent in the before-dump.
Missing baseline evidence is None; an absent after-token is False when
|
pyflightstream.qa.file_effect
¶
file_effect(name: str) -> Callable[[ProbeArtifacts], bool]
Make an effect assertion: the command produced a non-empty file.
Strict on absence: an export that runs without error and writes nothing is broken, not verified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
File name relative to the probe working directory. |
required |
Returns:
| Type | Description |
|---|---|
callable
|
The assertion: True when the file exists and is not empty. |
pyflightstream.qa.fsm_changed
¶
fsm_changed(
*, strict: bool = True
) -> Callable[[ProbeArtifacts], bool | None]
Make an effect assertion: the target ALTERED the saved simulation.
The weaker sibling of :func:fsm_gained, for the commands whose
effect is real and has no distinctive value to search for: a toggle
writes T or F, a selection writes a list, a binding writes an index
that is 1 or 2. Searching for those matches everywhere, which is how
a probe reports a pass on a command that did nothing.
What it asserts instead is that the saved state MOVED. A command
that changed nothing in the simulation did nothing, whatever it
printed to the log, and that is exactly the reading broken has
in this harness.
Use it deliberately and not as a default. A command whose work is outside the simulation (an export, a refresh of a view, a selection the file does not carry) legitimately changes nothing here, and this assertion would call it broken. Those keep their unobservable record and say why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strict
|
bool
|
Whether a missing or empty state file breaks (the default) or
records unprobed. As in :func: |
True
|
Returns:
| Type | Description |
|---|---|
callable
|
The effect assertion, called with the probe artifacts and returning True, False, or None for unprobed. |
pyflightstream.qa.fsm_gained
¶
fsm_gained(
*tokens: str, strict: bool = True
) -> Callable[[ProbeArtifacts], bool | None]
Make an effect assertion: a distinctive value entered the SAVED SIMULATION.
The instrument for everything the compat reports called stored in binary form. The saved .fsm is sectioned text, so a value the command wrote is findable in it; what it is NOT is labelled, every field being positional within its section, which is why this reads the value rather than parsing a field.
Compare changed lines, not the whole text. A short token can also
occur in an unrelated mesh index, date or count. For example,
SET_SOLVER_CONVERGENCE_ITERATIONS 37 can change a line from 15
to 37 even when another line already contains 37.
So the question asked here is the one the diff answers: is there a line the target ADDED or CHANGED that carries this value. That is also the honest strength of the instrument. It cannot say WHICH field received the value, since the format names none; a probe that needed that would have to learn a per-build line map, and a wrong map reports a pass for a value written somewhere else.
Values are matched in the file's own Fortran rendering as well as
the plain one, because it stores 0.98765 as
9.87650000000000028E-01.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*tokens
|
str
|
Distinctive values the target is expected to write. Every one
of them must appear on a changed line. Pass values no default
produces: a probe asserting |
()
|
strict
|
bool
|
Whether a missing or empty state file breaks (the default) or
records unprobed. It governs THE INSTRUMENT ONLY, and this is
the one place it differs from the older |
True
|
Returns:
| Type | Description |
|---|---|
callable
|
The effect assertion, called with the probe artifacts and returning True, False, or None for unprobed. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If no token is given. With none, |
pyflightstream.qa.generate_probe_script
¶
generate_probe_script(
spec: ProbeSpec,
version: str | FsVersion,
workdir: Path,
registry: CommandRegistry | None = None,
fsm: Path | None = None,
) -> Script
Build the probe script for one command, sentinels included.
The script is validated emission end to end (no raw()): the
tier prelude, the spec prelude, the BEGIN sentinel with its log
export, the target command (bracketed by state dumps when
dump_state), the END sentinel, the spec epilogue, the final
log export, and CLOSE_FLIGHTSTREAM so the hidden solver exits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
ProbeSpec
|
What to probe and how. |
required |
version
|
str or FsVersion
|
Target FlightStream version; emission is validated against it. |
required |
workdir
|
Path
|
Probe working directory; log exports point into it. |
required |
registry
|
CommandRegistry
|
Alternative database, used by tests. |
None
|
fsm
|
Path
|
Local simulation file for tier preludes above |
None
|
Returns:
| Type | Description |
|---|---|
Script
|
The rendered-ready probe script. |
Raises:
| Type | Description |
|---|---|
ProbeEnvironmentError
|
If the spec's prelude tier opens a simulation file and |
pyflightstream.qa.physics_report_paths
¶
physics_report_paths(
out_dir: str | Path,
*,
version: str,
date: str | None = None,
label: str | None = None,
) -> tuple[Path, Path]
Return where a physics report for one build WOULD be written.
The counterpart of :func:pyflightstream.qa.compat.compat_report_paths for the PHY
series. It computes report paths so callers can refuse an existing report before spending
a licensed solver seat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out_dir
|
str or Path
|
Target directory, normally |
required |
version
|
(str, keyword - only)
|
Version identifier, 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. |
Examples:
Ask before spending a licensed seat, which is the whole reason this function exists:
>>> from pyflightstream.qa import physics_report_paths, refuse_existing_report
>>> yaml_path, md_path = physics_report_paths(
... "reports/physics", version="26.123", date="2026-08-17", label="example"
... )
>>> yaml_path.name
'PHY-26123_2026-08-17_example.yaml'
>>> refuse_existing_report(yaml_path, md_path)
Nothing is written by either call. The refusal fires only for a stem that already exists, so a label that names an existing report is refused.
pyflightstream.qa.printed_line
¶
printed_line(text: str, marker: str) -> bool
Return whether marker was printed as a log message.
A line that carries PRINT <marker> is the script command being
echoed, not the message itself, and does not count; this keeps the
check honest on solvers that echo script lines into the log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Log text to scan. |
required |
marker
|
str
|
Exact marker text the probe printed. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when a genuine message line carries the marker. |
pyflightstream.qa.probe_version
¶
probe_version(
version: str | FsVersion,
*,
workroot: str | Path,
fs_exe: str | Path | None = None,
executor: Executor | None = None,
commands: Sequence[str] | None = None,
specs: Mapping[str, ProbeSpec] | None = None,
fsm: str | Path | None = None,
timeout_s: float | None = None,
error_patterns: Sequence[str] = DEFAULT_ERROR_PATTERNS,
registry: CommandRegistry | None = None,
) -> ProbeRun
Probe the commands of one FlightStream version.
Runs the baseline probe first (aborting on an unusable
environment), validates each prelude tier the run will use, then
one probe per command that has a specification, and records every
remaining database command of the version as unprobed, so the
compat report carries one evidence line per command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str or FsVersion
|
Target version, canonical identifier (26.120); a vendor release name works only where it names exactly one registered build. |
required |
workroot
|
str or Path
|
Root directory receiving one working subdirectory per probe; scratch evidence, never committed (the report is the evidence). |
required |
fs_exe
|
str or Path
|
Explicit path of the FlightStream executable (SAD Section 5:
never read from the environment or guessed). Required unless
|
None
|
executor
|
Executor
|
Alternative executor, used by tests; overrides |
None
|
commands
|
sequence of str
|
Subset to probe; every name must exist in the version's view. Commands outside the subset are recorded as unprobed. |
None
|
specs
|
mapping of str to ProbeSpec
|
Probe specifications; defaults to the packaged catalog in
:mod: |
None
|
fsm
|
str or Path
|
Local simulation (.fsm) file for prelude tiers above |
None
|
timeout_s
|
float
|
Wall-clock limit per probe, unless the spec overrides it. When omitted,
reads the process option |
None
|
error_patterns
|
sequence of str
|
Regular expressions scanned between the sentinels. |
DEFAULT_ERROR_PATTERNS
|
registry
|
CommandRegistry
|
Alternative database, used by tests. |
None
|
Returns:
| Type | Description |
|---|---|
ProbeRun
|
One evidence line per command of the version. |
Raises:
| Type | Description |
|---|---|
ProbeEnvironmentError
|
When no executor and no |
QaEvidenceError
|
When |
pyflightstream.qa.read_compat_report
¶
read_compat_report(path: str | Path) -> dict
Load and check a machine-readable compat report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The report YAML file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The parsed report document. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
When the file does not carry the compat report schema marker
(a |
pyflightstream.qa.read_compat_reports
¶
read_compat_reports(
reports_dir: str | Path | None = None,
*,
repo_root: str | Path = ".",
) -> dict[tuple[str, str], tuple[Judgment, ...]]
Index every promotable judgment in a directory of compat reports.
Files that do not carry the compat schema are skipped rather than refused: the directory is committed evidence, not a curated input, and a README beside the reports must not stop a promotion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reports_dir
|
str or Path
|
Directory of compat report YAML files; defaults to
|
None
|
repo_root
|
str or Path
|
Repository root; report paths are recorded relative to it, in
POSIX form, so they compare directly against the |
'.'
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If |
pyflightstream.qa.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: |
()
|
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 |
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.region_printed
¶
region_printed(
marker: str,
) -> Callable[[ProbeArtifacts], bool]
Make an effect assertion: a marker was printed in the target region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
marker
|
str
|
The text expected in the log between the BEGIN and END sentinels. |
required |
Returns:
| Type | Description |
|---|---|
callable
|
The assertion: True when the marker was printed in the target region. |
pyflightstream.qa.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, |
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. |
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 |
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.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, |
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.
pyflightstream.qa.unrecognised_commands
¶
unrecognised_commands(
log_text: str | None,
) -> frozenset[str]
Command names the solver refused as unrecognised, from its crash log.
The refusal does NOT reach the exported log: the script aborts at
the offending line, so the log after the command never appears and
the only record is FlightStreamLog.txt, which
:class:~pyflightstream.run.ExecutionResult carries as log_text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_text
|
str or None
|
Content of the solver's crash log; None when it wrote none, which is the normal case for a run that completed. |
required |
Returns:
| Type | Description |
|---|---|
frozenset of str
|
The COMMAND of each refused line, upper-cased: the solver quotes the whole script line, arguments included, and only its leading token names the command. Empty when the log is absent or names none. |
Notes
The crash log is the one log of this pipeline that reaches a reader without the scrubbing every exported log gets, and it does carry stray NUL bytes (12 in the measured 26.122 run), so they are dropped here rather than left to break a field separator.
pyflightstream.qa.write_compat_report
¶
write_compat_report(
run: ProbeRun,
out_dir: str | Path,
*,
date: str | None = None,
label: str | None = None,
) -> tuple[Path, Path]
Write one probe run as a compat report pair (YAML plus Markdown).
The YAML file is the machine-readable evidence apply_compat
reads; the Markdown file renders the same content as a table for
review. Both share the stem CMP-<version digits>_<date> plus
the optional label. Existing report files are never overwritten:
evidence supersedes evidence only through a new, dated report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
run
|
ProbeRun
|
The probe run 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 the same day
(for example |
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 resolves
through the registry. |