pyflightstream.qa.probes (stable)¶
Generated from the docstrings at build time: every one of the 21 names in the __all__ of pyflightstream.qa.probes has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Tier 2 command-validity probes (SAD Section 11).
Pipeline role: produces the run evidence behind the command database. Each probe executes exactly one database command in a minimal script on a licensed machine and classifies it from four signals. The first is read before the other three, because each of those would answer its case with a different wrong word:
- Unrecognised command: the solver's crash log names the probed
command as one it does not recognise, so this build does not carry
it (
removed, RPT-026). The refusal never reaches the exported log, since the script aborts at the offending line. - Sentinel missing: the log exported after the command never appears, so script processing aborted at the command.
- Log error patterns: error messages between the probe sentinels.
- Failed effect assertion: the script continued past the command but
its observable effect is absent. A command that runs but does
nothing is
broken, notverified.
The generated scripts wrap the target command between two sentinel
PRINT markers, each followed by an EXPORT_LOG, so the exported
log carries a delimited region that belongs to the target command
alone. The harness therefore relies on three instrument commands
(PRINT, EXPORT_LOG, CLOSE_FLIGHTSTREAM); a baseline probe validates
them before any command is judged, and a baseline failure aborts the
whole run instead of writing false evidence (a dead license must never
read as broken commands).
Two further instruments are used PER SPEC rather than per run, and
neither is baseline-validated: OUTPUT_SETTINGS_AND_STATUS for the
settings dump, and SAVEAS for the saved-simulation assertions. The
consequence is worth stating because it points the wrong way: an
instrument that fails records the TARGET rather than the harness, so a
spec that cannot rely on its instrument asks for strict=False and
gets unprobed instead of broken. Both instruments bracket the
target from OUTSIDE the sentinels, so their own error lines never land
in the target's region, and a missing settings dump reads unprobed
whatever strict says (PFS-2102.014).
Statuses are promoted from the resulting compat report only through
pyfs-qa apply-compat (:mod:pyflightstream.qa.compat), never by
hand (CONTRIBUTING.md invariant 3).
Advanced¶
pyflightstream.qa.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.emit_solver_setup
¶
emit_solver_setup(script: Script) -> None
Emit the minimal steady setup preceding INITIALIZE_SOLVER.
Constant free stream, sea-level standard atmosphere, and a short iteration budget: the smallest state in which the solver initializes and runs on an opened simulation (M2 pipeline shape).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
The probe script, after its simulation was opened. |
required |
pyflightstream.qa.probes.emit_tier_prelude
¶
emit_tier_prelude(
script: Script,
tier: Requires,
fsm: Path,
after_open: Callable[[Script], None] | None = None,
) -> None
Emit the standard prelude of one tier (SAD Section 11).
sim opens the local simulation file; solver adds the
minimal steady setup of the M2 pipeline (constant free stream,
sea-level atmosphere, short iteration budget) and
INITIALIZE_SOLVER on all boundaries without symmetry; solution
adds START_SOLVER. Physical relevance is not the point: the tier
only manufactures the session state the target command needs to
act on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
script
|
Script
|
Script under construction. |
required |
tier
|
Requires
|
Tier to emit; |
required |
fsm
|
Path
|
Local simulation (.fsm) file for the OPEN command. |
required |
after_open
|
callable
|
|
None
|
pyflightstream.qa.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.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.probes.unattended_profile_spec
¶
unattended_profile_spec(
point: tuple[float, float, float],
) -> ProbeSpec
Prepare G52's receipt against an explicitly supplied solved surface point.
Use only with build 26.125 and a saved, solved control state. The session selects the upper-wing point from its control export, as RPT-075 describes. This spec is deliberately absent from the generic probe catalog: its geometry-dependent input must never be guessed. A nonempty file proves export completion only; inspection of its format and product acceptance remain separate, and the product stays disabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
tuple of float
|
Three finite reference-frame coordinates selected from the solved control. |
required |
Returns:
| Type | Description |
|---|---|
ProbeSpec
|
Unregistered, bounded probe for the 26.125 unattended-profile receipt. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If the point is invalid, or the generated target uses another build. |
pyflightstream.qa.probes.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.