pyflightstream.qa.compat (stable)¶
Generated from the docstrings at build time: every one of the 23 names in the __all__ of pyflightstream.qa.compat has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
Compat reports and status promotion (SAD Sections 3.2 and 11).
Pipeline role: turns a probe run into committed evidence and the
evidence into database statuses. :func:write_compat_report writes the
machine-readable YAML report and its rendered Markdown table under
reports/compat/, one evidence line per database command of the
probed version. :func:apply_compat reads a committed report back and
promotes documented statuses to verified, broken or
removed in the chapter YAML files, citing the report in each
promoted entry; statuses are never hand-edited (CONTRIBUTING.md invariant 3),
and the schema rejects any of those three without its report citation.
A promotion writes every chapter it touches or none of them, and an
older report cannot revert a status established by a later run.
Size exemption: the database's one writer, with the rule of the notes it promotes beside it.
Advanced¶
pyflightstream.qa.compat.COMPAT_SCHEMA
module-attribute
¶
COMPAT_SCHEMA = 'pyflightstream-compat-report/1'
pyflightstream.qa.compat.EXECUTABLE_BASELINE_REPORT
module-attribute
¶
EXECUTABLE_BASELINE_REPORT = "reports/RPT-032_executable-identity-baseline_2026-08-19.md"
pyflightstream.qa.compat.ExecutableIdentity
dataclass
¶
ExecutableIdentity(
*,
verdict: ExecutableVerdict,
version: str,
fs_exe_name: str,
fs_exe_sha256: str,
baseline_sha256: str | None,
printed_build: str | None,
registry_build: str | None,
message: str,
)
The answer to "does the evidence already gathered still apply?".
Attributes:
| Name | Type | Description |
|---|---|---|
verdict |
ExecutableVerdict
|
What the caller may do next. |
version |
str
|
Canonical version whose evidence is in question. |
fs_exe_name |
str
|
File name of the candidate executable (never its path). |
fs_exe_sha256 |
str
|
Lowercase hexadecimal sha256 of the candidate's bytes. |
baseline_sha256 |
str or None
|
Digest the baseline records for this version, when it records one. This is the OLD side of the comparison, and it exists before any replacement arrives precisely because hashing a file costs no licensed seat. |
printed_build |
str or None
|
Build number the solver printed, when an identity run has
happened; |
registry_build |
str or None
|
Build number the registry records for this version. |
message |
str
|
One sentence naming the physical cause and the next step, in the form an operator can act on. |
pyflightstream.qa.compat.ExecutableVerdict
¶
Bases: StrEnum
What a candidate executable does to the evidence already gathered.
pyflightstream.qa.compat.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.compat.LicenceCandidate
dataclass
¶
LicenceCandidate(
*,
command: str,
chapter: str,
status: str,
citation: str | None,
inherited: bool,
reason: str,
)
One command whose evidence a licence change could falsify.
A CANDIDATE and not a member. Which commands belong in the subset a licensed seat is actually spent on is a domain judgment the owner holds; this type is the derived input to that judgment, carrying the fact that put each command on the list.
Attributes:
| Name | Type | Description |
|---|---|---|
command |
str
|
Command name. |
chapter |
str
|
Stem of the chapter YAML the entry came from, which is the chapter split this derivation groups by. |
status |
str
|
The measured status, |
citation |
str or None
|
The committed report the measurement came from. |
inherited |
bool
|
True when the record was inherited from the base release rather than measured on the version asked about. An inherited row is a weaker candidate and says so rather than being dropped silently. |
reason |
str
|
Why this command is a candidate, in one sentence naming what would be lost if a licence refused it. |
pyflightstream.qa.compat.MEASURED_STATUSES
module-attribute
¶
MEASURED_STATUSES = frozenset(
{Status.VERIFIED, Status.BROKEN}
)
pyflightstream.qa.compat.PROMOTABLE_OUTCOMES
module-attribute
¶
PROMOTABLE_OUTCOMES = frozenset(ProbeOutcome) - {
ProbeOutcome.UNPROBED
}
pyflightstream.qa.compat.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.apply_reanalysis
¶
apply_reanalysis(
report_path: str | Path, *, repo_root: str | Path
) -> list[str]
Reconcile withdrawn judgments through validated chapter rewrites.
Independent measured evidence remains authoritative. Where none remains, the row records direct inconclusive evidence as documented, never verified or broken. The original report remains on disk and cannot be reapplied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_path
|
str or Path
|
Explicit dated withdrawal report to apply. |
required |
repo_root
|
str or Path
|
Repository holding the reports and command chapters. |
required |
Returns:
| Type | Description |
|---|---|
list of str
|
Sorted command names whose judgments were reconciled. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If source evidence changed, a command is unknown, the build is unregistered, surviving evidence lies outside the repository, or validation fails. |
pyflightstream.qa.compat.classify_executable
¶
classify_executable(
fs_exe: str | Path,
*,
version: str,
baseline: Mapping[str, Mapping[str, str]],
printed_build: str | None = None,
) -> ExecutableIdentity
Ask a candidate executable whether the evidence in hand still applies.
This is the cheap question that decides whether a licensed seat is worth spending, and it is asked BEFORE any campaign, probe or physics run. Command evidence in this package is keyed by the canonical version string alone: a version row carries status, successor, note, report, probe reference and arguments, and no hash, path or size of any binary. So a relicensed or replaced binary reporting the same version is the same solver as far as every lookup, promotion and refusal here is concerned, and the only thing that separates them is the digest and the build number it prints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fs_exe
|
str or Path
|
The candidate executable. It is hashed; it is never started. |
required |
version
|
(str, keyword - only)
|
Canonical version whose evidence is in question. |
required |
baseline
|
(mapping, keyword - only)
|
The committed digest baseline, as
:func: |
required |
printed_build
|
(str, optional, keyword - only)
|
Build number an identity-only probe read from the solver's own
banner. |
None
|
Returns:
| Type | Description |
|---|---|
ExecutableIdentity
|
The verdict, both digests where both exist, both build numbers where both exist, and the next step in words. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
When the executable cannot be read, so no digest exists to compare. A missing binary is a machine problem and this function refuses rather than reporting an unknown binary that is really an absent one. |
UnknownVersionError
|
When |
Examples:
>>> from pyflightstream.qa.compat import (
... classify_executable,
... read_executable_baseline,
... )
>>> baseline = read_executable_baseline(
... "reports/RPT-032_executable-identity-baseline_2026-08-19.md"
... )
>>> answer = classify_executable(
... "_private/exe/FlightStream_26123/FlightStream_26123.exe",
... version="26.123",
... baseline=baseline,
... )
>>> answer.verdict, answer.spends_a_seat
(<ExecutableVerdict.UNKNOWN: 'unknown'>, True)
pyflightstream.qa.compat.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.compat.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.compat.licence_sensitive_candidates
¶
licence_sensitive_candidates(
version: str, *, registry: CommandRegistry | None = None
) -> tuple[LicenceCandidate, ...]
Derive the commands a licence change could falsify, for one build.
THE RISK THIS ANSWERS is not the build number. Command evidence here is keyed by the canonical version string alone, so a relicensed binary reporting the same version is the same solver as far as every lookup, promotion and refusal in this package is concerned. A command the new licence REFUSES therefore stays marked verified on a measurement taken under the old one, and no guard fires.
THE DERIVATION, and it is a deduction rather than a judgment: a
licence changes what the solver PERMITS, so it can only falsify
evidence that came from running the solver. A documented row
rests on a manual page and is untouched; a verified or broken
row is a measurement taken under one seat, and it is the population
returned here, grouped by the chapter split through
:attr:LicenceCandidate.chapter.
THE PROBE SPECIFICATIONS ARE NOT A SECOND FILTER, and the reason is
that they cannot disagree with the first one: a verified or
broken row is what a probe run WROTE, so every row here has a
specification the harness can run again. That coincidence is
asserted by a test rather than enforced here, so if the two
populations ever drift apart the suite says so instead of this
function silently dropping a candidate.
WHAT THIS FUNCTION DELIBERATELY DOES NOT DO is choose the subset. Two things decide that and neither is mechanical: how many commands a seat can afford, and which capabilities a vendor plausibly gates behind a tier. Both are the domain-expert seat's. This returns the candidates and the reason each is one; the membership is written where that seat records it, and never inferred here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
Version identifier whose evidence is in question. |
required |
registry
|
(CommandRegistry, optional, keyword - only)
|
Alternative database, used by tests. |
None
|
Returns:
| Type | Description |
|---|---|
tuple of LicenceCandidate
|
Sorted by chapter and then by command, so two runs of it over one database produce the same list in the same order. |
Raises:
| Type | Description |
|---|---|
UnknownVersionError
|
When |
Examples:
>>> from pyflightstream.qa.compat import licence_sensitive_candidates
>>> candidates = licence_sensitive_candidates("26.123")
>>> {candidate.status for candidate in candidates} <= {"verified", "broken"}
True
pyflightstream.qa.compat.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.compat.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.compat.read_executable_baseline
¶
read_executable_baseline(
path: str | Path,
) -> dict[str, dict[str, str]]
Read the committed executable digest baseline.
The baseline is a Markdown table in
:data:EXECUTABLE_BASELINE_REPORT, and its columns are resolved by
LABEL. A table makes no guarantee about column order, so a reader
that counts positions breaks on an edit that changes nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or Path
|
The report to read. |
required |
Returns:
| Type | Description |
|---|---|
dict of str to dict
|
Keyed by canonical version; each value carries |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
When the file carries no table with the expected labels, when a digest is neither withheld nor 64 hexadecimal characters, or when one version is recorded twice with different digests. A baseline that cannot be read is refused rather than treated as empty: an empty baseline makes every executable UNKNOWN, which reads as caution and is really a file nobody parsed. |
pyflightstream.qa.compat.record_unprobed_build
¶
record_unprobed_build(
report_path: str | Path,
command: str,
*,
manual_ref: str,
repo_root: str | Path,
commands_dir: str | Path | None = None,
) -> None
Record direct inconclusive evidence instead of inherited verification.
This explicit maintenance route adds a documented row only where the build has no row and no committed measured verdict. It never changes a measured record and never interprets unprobed as a broken command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report_path
|
str or Path
|
Committed report containing an unprobed outcome for the command. |
required |
command
|
str
|
One command to reconcile; other report entries are not applied. |
required |
manual_ref
|
str
|
Page citation of this build's manual, checked by the caller. |
required |
repo_root
|
str or Path
|
Repository containing both the report and command chapters. |
required |
commands_dir
|
str or Path
|
Chapter directory under the repository. |
None
|
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If evidence is not inconclusive, a direct record or measured verdict exists, the manual citation names another build, or paths are invalid. |
pyflightstream.qa.compat.resolve_commands_dir
¶
resolve_commands_dir(
repo_root: str | Path,
commands_dir: str | Path | None = None,
) -> Path
Return the command database a promotion writes, refusing one outside the repository.
PFS-2102.032, PFS-2088.016: anchor command data, citations and the supersession index on repo_root so installed-package data or another editable checkout cannot receive this repository's promotions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
repo_root
|
str or Path
|
The repository root. |
required |
commands_dir
|
str or Path
|
An explicit chapter directory. When left out,
|
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The resolved chapter directory, under |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If the directory is not under |
pyflightstream.qa.compat.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. |
pyflightstream.qa.compat.write_reanalysis
¶
write_reanalysis(
source: str | Path,
explanations: Mapping[str, str],
*,
repo_root: str | Path,
date: str,
label: str,
withdraw: bool = True,
) -> tuple[Path, Path]
Write dated analysis preserving the source execution, optionally withdrawing judgment.
Each named command requires an explanation. By default this withdraws a
judgment while preserving its observations; withdraw=False adds an analysis
note without changing that judgment. It launches nothing. The original report
UTF-8 text with LF line ends is pinned so that checkout line endings do not
change provenance and later content edits cannot silently change it.
Apply the result explicitly with :func:apply_reanalysis after review.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str or Path
|
Original committed compatibility report, inside the repository. |
required |
explanations
|
mapping of str to str
|
Commands to withdraw and the reason for each withdrawal. |
required |
repo_root
|
str or Path
|
Repository containing the original report and output directory. |
required |
date
|
str
|
ISO analysis date, later than the original report. |
required |
label
|
str
|
Distinguishing suffix for the analysis report filenames. |
required |
withdraw
|
bool
|
Withdraw the source judgment by default. False records an unprobed analysis note while retaining the source judgment and database status. |
True
|
Returns:
| Type | Description |
|---|---|
tuple of Path
|
New YAML report and rendered Markdown report, respectively. |
Raises:
| Type | Description |
|---|---|
QaEvidenceError
|
If provenance, dates, explanations or report destinations are invalid. |