fix(786): share the last three detectors with their proofs, and close the round-4 wording items
Round four returned MERGEABLE with seven LOW/NIT items. All seven are fixed rather than shipped,
because three of them are the same defect class this branch has been closing all along.
THREE MORE PROOFS RE-IMPLEMENTED THE COMPARISON THEY NAMED. The previous commit extracted
`duplicate_row_faults` and `env_shadow_faults` for exactly this reason and left the set-equality and
Kind comparisons inline, so `test_MUTATION_a_guard_job_with_its_row_DELETED_is_reported`,
`…_a_PHANTOM_row_is_reported` and `…_a_row_whose_KIND_disagrees_is_reported` still rebuilt
`declared - listed` and the Kind check themselves. Review demonstrated it by flattening the live
assertion and watching the file stay green at 50 passed.
`coverage_faults(declared, listed) -> (missing, phantom)` and `kind_faults(roles, listed)` are now
named detectors that the live checks and all three proofs call, and each proof gained a negative
control. Witnessed after the change:
coverage_faults disarmed -> deleted-row proof REDDENED, phantom-row proof REDDENED
kind_faults disarmed -> kind-disagreement proof REDDENED
Worth recording that the system was never fail-open here: the manifest harness already caught the
same disarm ("the named test still PASSED with the clause mutated"). The in-file proofs were weaker
than their names, not absent.
THE ENV-MERGE EVIDENCE WAS STEP-SCOPE USED FOR A JOB-SCOPE CLAIM. `build`'s Smoke step shows the
runner LAYERS step-level `env:` over workflow-level, and what this branch newly relies on is
job-level layering. Measured: on origin/main no job anywhere declared both a job-level `env:` and a
consumed workflow-level var, so the job scope had no in-repo witness. The gap is now named, with
the exposure bounded — the two publish jobs are `if: github.event_name != 'pull_request'`, so PR CI
cannot exercise it and a non-layering runner would fail loudly on the first push to `main` trying to
publish `":<sha>"`, not silently.
Four wording fixes, each measured:
* the record still enumerated "exactly three jobs are `none`" while three other sites say a list
in prose is a second copy that rots — the fourth site now agrees with them.
* "the remaining `docker-build.yml` jobs" over-scoped: six remain after `test`/`migrations`, and
the table has four, because `toolchain-preflight` and `scan` carry the mark/assert protocol
voluntarily without being in the enforced scope. Said so.
* "on every push to `main`" ignored the Smoke step's own `docs_only` gate.
* `docs/ci-cd.md`'s excluded-token list omitted `tar`, which the source comment includes; and the
`scan` Proof cell disclosed the two pytest files' `NONE` but not the cited script row's, two
cells from a sibling that discloses it — so that row now states it claims no proof at all.
Suite: 1178 passed, 2 skipped (the production-log guard deselected; it is the shared-$HOME flake,
green in isolation — #809/#822). ruff 0.12.11 clean over all 47 tracked files; decisions-validate
OK; doc-narrative 0 warnings.
Refs #786
Refs #789
This commit is contained in:
+1
-1
@@ -387,7 +387,7 @@ careless workflow edit; a marker a handful of lines from the `container:` block
|
||||
each job's own step bodies, looking for tools that exist only in the CI image (`dotnet`,
|
||||
`dotnet-ef`, `node`, `npm`, `npx`, `ffmpeg`, `ffprobe`, `playwright`, `reportgenerator` — the list
|
||||
lives in `TOOLCHAIN_ONLY_TOOLS`, and this sentence is a summary of it, not a second copy to keep in
|
||||
sync). `git`/`jq`/`python3`/`curl` are **excluded** because they do not discriminate: the
|
||||
sync). `git`/`jq`/`python3`/`curl`/`tar` are **excluded** because they do not discriminate: the
|
||||
bare-runner lanes provide or provision them too. That check depends on neither the marker nor the
|
||||
block, and it is the only one that catches a .NET step **moved** into a bare-runner job, where no
|
||||
set changes at all.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@ status: active
|
||||
since: '2026-08-28'
|
||||
supersedes: none
|
||||
superseded-by: none
|
||||
rule: 'A population of workflow JOBS is declared by the workflow itself, one machine-readable marker per job under `env:`, and every set a guard compares is DERIVED from those markers rather than from a literal list in the checker. A missing marker and an unrecognised value are both HARD FAILURES, never a default: a scheme whose absent value reads as some safe class stops applying the moment somebody adds a job and forgets, and the job nobody remembered to mark is the job nobody reviewed. Two markers exist under this rule. `CI_EXECUTION_CLASS` (toolchain / bare-runner) replaced the `TOOLCHAIN_JOBS` and `BARE_RUNNER_JOBS` literals in `test_ci_image_pin_population.py` (#789). `CI_JOB_ROLE` (guard / report-only / none) is the population of workflow-job guards that `docs/guard-inventory.md` was blind to (#786), and it is decided by what the job PRODUCES: a `guard` job output is a VERDICT, a `none` job output is an ARTIFACT, and a red in a `none` job means the build did not work rather than that an invariant was violated. `docker-build.yml::build` publishes an image and smoke-tests it and is `none`; exactly three jobs are `none`, the two image publishers and `renovate`. TWO READINGS ARE REJECTED and recorded so neither returns. Anything-that-can-fail makes every job a guard and the table distinguishes nothing. And the more principled-sounding repository-versus-product split is worse: it puts `test` and `migrations` outside the population, and those are the two REQUIRED status contexts on `main`, precisely where a failure to fire is fail-OPEN against branch protection and precisely the gap #786 exists to close. THE VALUE IS `report-only` AND NOT `advisory` ON PURPOSE: `docs/ci-cd.md` already calls `functional-e2e` an advisory job in a different sense — not a required context, though it can certainly fail — so reusing the word would make a reader infer the wrong marker for exactly the job whose marker is `guard`. WHY THE MARKER BEATS THE LITERAL it replaced, since the literal had a real justification: set equality between two DERIVED sets is blind to a member leaving both at once, so a job that loses its `container:` block leaves the declared and the pinned set together and the comparison stays balanced. The population therefore needs an anchor that does not move with the thing it guards, and a reviewed literal was the only one available. The marker is that anchor and is strictly better placed: it lives NEXT TO the job, so a reviewer of that job reaches it, and it moves with the job when the job is renamed. THE COST IS ADJACENCY and must be paid explicitly rather than argued away — a literal in a distant file survives a careless workflow edit, whereas a marker a handful of lines from the `container:` block can be deleted along with it in one plausible slip. So a marker scheme is not sufficient on its own: it ships with a THIRD derivation independent of both the marker and the thing it describes. For the toolchain class that is `jobs_whose_steps_need_the_toolchain`, which reads the job OWN step bodies for tools present only in the CI image, and it is the only one of the three that can see the failure #789 was filed for — a .NET-dependent step MOVED into a bare-runner job, where no set changes and every equality stays balanced. That third check is NECESSARY-CONDITION ONLY and says so: step text cannot see a tool reached only through a script, so visible use implies the declaration and the converse is not asserted. MEASURED rather than asserted — the blind-spot set is EMPTY today, all five declared toolchain jobs being detected directly. AND THE RESIDUAL IS REAL: all three checks fail together under one edit that drops the container block, flips the marker AND moves the invocation into a script. What bounds it is the failure MODE — the job then dies on a missing binary, loudly, where the original defect would send a REQUIRED check green on the bare runner. A silent pass traded for a noisy crash, not a hole closed. Filtering to the jobs that visibly invoke a tool is legitimate subject selection for a PER-MEMBER property under `testing.guard-derives-population-from-source`, not a filtered completeness claim; the completeness claims are that every job declares a marker and that the two sets match both ways. WHAT THIS DOES NOT DO, stated because the checks read stronger than they are: it proves every job was CLASSIFIED by someone and that the table and the workflow agree, never that the classification is CORRECT, and an inline YAML assertion cannot be proven to work without running the job, so such a row carries `Proof: NONE` unless a pytest genuinely covers PART of it — `ci-image-pin` and `set-verdict-status` each cite one, and each row says which part, because a proof reference that covers a fraction of a job must not read as covering the job.'
|
||||
rule: 'A population of workflow JOBS is declared by the workflow itself, one machine-readable marker per job under `env:`, and every set a guard compares is DERIVED from those markers rather than from a literal list in the checker. A missing marker and an unrecognised value are both HARD FAILURES, never a default: a scheme whose absent value reads as some safe class stops applying the moment somebody adds a job and forgets, and the job nobody remembered to mark is the job nobody reviewed. Two markers exist under this rule. `CI_EXECUTION_CLASS` (toolchain / bare-runner) replaced the `TOOLCHAIN_JOBS` and `BARE_RUNNER_JOBS` literals in `test_ci_image_pin_population.py` (#789). `CI_JOB_ROLE` (guard / report-only / none) is the population of workflow-job guards that `docs/guard-inventory.md` was blind to (#786), and it is decided by what the job PRODUCES: a `guard` job output is a VERDICT, a `none` job output is an ARTIFACT, and a red in a `none` job means the build did not work rather than that an invariant was violated. `docker-build.yml::build` publishes an image and smoke-tests it and is `none`. Which jobs are `none` is read off the markers and is deliberately NOT enumerated here — a list in prose is a second copy of the workflow that rots on the next job added, and nothing checks it. TWO READINGS ARE REJECTED and recorded so neither returns. Anything-that-can-fail makes every job a guard and the table distinguishes nothing. And the more principled-sounding repository-versus-product split is worse: it puts `test` and `migrations` outside the population, and those are the two REQUIRED status contexts on `main`, precisely where a failure to fire is fail-OPEN against branch protection and precisely the gap #786 exists to close. THE VALUE IS `report-only` AND NOT `advisory` ON PURPOSE: `docs/ci-cd.md` already calls `functional-e2e` an advisory job in a different sense — not a required context, though it can certainly fail — so reusing the word would make a reader infer the wrong marker for exactly the job whose marker is `guard`. WHY THE MARKER BEATS THE LITERAL it replaced, since the literal had a real justification: set equality between two DERIVED sets is blind to a member leaving both at once, so a job that loses its `container:` block leaves the declared and the pinned set together and the comparison stays balanced. The population therefore needs an anchor that does not move with the thing it guards, and a reviewed literal was the only one available. The marker is that anchor and is strictly better placed: it lives NEXT TO the job, so a reviewer of that job reaches it, and it moves with the job when the job is renamed. THE COST IS ADJACENCY and must be paid explicitly rather than argued away — a literal in a distant file survives a careless workflow edit, whereas a marker a handful of lines from the `container:` block can be deleted along with it in one plausible slip. So a marker scheme is not sufficient on its own: it ships with a THIRD derivation independent of both the marker and the thing it describes. For the toolchain class that is `jobs_whose_steps_need_the_toolchain`, which reads the job OWN step bodies for tools present only in the CI image, and it is the only one of the three that can see the failure #789 was filed for — a .NET-dependent step MOVED into a bare-runner job, where no set changes and every equality stays balanced. That third check is NECESSARY-CONDITION ONLY and says so: step text cannot see a tool reached only through a script, so visible use implies the declaration and the converse is not asserted. MEASURED rather than asserted — the blind-spot set is EMPTY today, all five declared toolchain jobs being detected directly. AND THE RESIDUAL IS REAL: all three checks fail together under one edit that drops the container block, flips the marker AND moves the invocation into a script. What bounds it is the failure MODE — the job then dies on a missing binary, loudly, where the original defect would send a REQUIRED check green on the bare runner. A silent pass traded for a noisy crash, not a hole closed. Filtering to the jobs that visibly invoke a tool is legitimate subject selection for a PER-MEMBER property under `testing.guard-derives-population-from-source`, not a filtered completeness claim; the completeness claims are that every job declares a marker and that the two sets match both ways. WHAT THIS DOES NOT DO, stated because the checks read stronger than they are: it proves every job was CLASSIFIED by someone and that the table and the workflow agree, never that the classification is CORRECT, and an inline YAML assertion cannot be proven to work without running the job, so such a row carries `Proof: NONE` unless a pytest genuinely covers PART of it — `ci-image-pin` and `set-verdict-status` each cite one, and each row says which part, because a proof reference that covers a fraction of a job must not read as covering the job.'
|
||||
signals: 'CI_EXECUTION_CLASS · CI_JOB_ROLE · per-job marker · workflow declares its own metadata · TOOLCHAIN_JOBS removed · BARE_RUNNER_JOBS removed · missing marker is a hard failure · unknown marker value is a hard failure · the anchor that does not move · adjacency is the cost · third derivation from the job own steps · toolchain-only tools · a step MOVED into a bare-runner job · guard jobs vs guard files · role records purpose not failability · paths: `scripts/tests/test_ci_image_pin_population.py`, `scripts/tests/test_workflow_job_guards.py`, `docs/guard-inventory.md`, `.gitea/workflows/docker-build.yml` · issues: #786, #789, #774, #787, #806'
|
||||
mechanics: '`CI_EXECUTION_CLASS` is scoped to `docker-build.yml`, the only workflow using the toolchain image — a claim `test_docker_build_is_the_ONLY_workflow_pinning_the_toolchain_image` checks against the tracked workflow set. `CI_JOB_ROLE` spans every tracked workflow. Both populations come from the GIT INDEX per `testing.guard-derives-population-from-source`. The toolchain-only tool list is drawn from `docker/ci/Dockerfile` and deliberately excludes git, jq, python3 and curl. The reason is that they do not DISCRIMINATE: the bare-runner lanes provide or provision them (`small` ships git and adds Python via `actions/setup-python`; `build` runs on `ubuntu-latest`), so a match on one says nothing about whether the job needs the toolchain image. Measured, they flag 4 of the 8 jobs, not all of them.'
|
||||
---
|
||||
|
||||
@@ -303,7 +303,7 @@ job it covers, because a proof reference that covers a fraction must not read as
|
||||
| `docker-build.yml::test` | a merge — the REQUIRED context `Build ErsatzTV Image / Build & test (.NET) (pull_request)` | GUARD | the `dotnet test` / `npm test` suites, which include the C# and TypeScript structural guards named in scope-limit item 2 above | `scripts/ci-step-ran.sh` covers a dropped step — every consequential step `mark`s and the final step `assert`s, which is the mechanism `test_ci_dropped_step_guard.py` enforces on this job; the suites carry their own assertions |
|
||||
| `docker-build.yml::migrations` | a merge — the REQUIRED context `Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request)` | GUARD | `dotnet ef migrations has-pending-model-changes` plus apply-to-fresh-DB, per provider | `scripts/ci-step-ran.sh` covers a dropped step — same `mark`/`assert` mechanism, enforced on this job by `test_ci_dropped_step_guard.py` |
|
||||
| `docker-build.yml::functional-e2e` | a PR or a push to `main`, on a broken HTTP contract or UI flow | GUARD | `scripts/e2e-functional.sh`, which holds the HTTP contract assertions and is the only `GUARD` of the three. `scripts/e2e-ui.sh` DRIVES the Playwright specs (the UI assertions live in those specs, not in the script) and `scripts/e2e-local.sh` only BOOTS the instance they run against; both are `TOOLING` above, and naming either as the assertion would credit the coverage to a script that does not provide it | `scripts/e2e-functional.sh`'s row above (`GUARD`, `NONE`); no dropped-step guard — see the decision table below |
|
||||
| `docker-build.yml::scan` | a merge and the release path, when a banned expression delimiter appears in the `run:` body of a delimiter-ban job (`DELIMITER_BAN_JOBS` = the required contexts **plus `build`**, which is wider than the marked set). It carries no `if:`, so it runs on PRs too and a red blocks through the combined status | GUARD | the ban assertion is `test_ci_dropped_step_guard.py::test_the_delimiter_banned_jobs_have_NO_expression_delimiter_in_any_run_body` — note that file is graded `PROOF` above for its `ci-step-ran.sh` role, and also carries this GUARD-shaped assertion; `test_ci_release_path_scan_job.py` (`GUARD`) protects the job that runs it, and `scripts/ci-prove-ban-detects.sh` proves the ban still detects | `scripts/ci-prove-ban-detects.sh`'s row above; the two pytest files carry `NONE`, so this row does not claim a proof it lacks |
|
||||
| `docker-build.yml::scan` | a merge and the release path, when a banned expression delimiter appears in the `run:` body of a delimiter-ban job (`DELIMITER_BAN_JOBS` = the required contexts **plus `build`**, which is wider than the marked set). It carries no `if:`, so it runs on PRs too and a red blocks through the combined status | GUARD | the ban assertion is `test_ci_dropped_step_guard.py::test_the_delimiter_banned_jobs_have_NO_expression_delimiter_in_any_run_body` — note that file is graded `PROOF` above for its `ci-step-ran.sh` role, and also carries this GUARD-shaped assertion; `test_ci_release_path_scan_job.py` (`GUARD`) protects the job that runs it, and `scripts/ci-prove-ban-detects.sh` proves the ban still detects | `scripts/ci-prove-ban-detects.sh`'s row above — which itself carries `NONE`, as do the two pytest files, so this row claims no proof at all |
|
||||
| `docker-build.yml::api-docs` | a PR whose committed OpenAPI spec, endpoint index or SPA client types are stale | GUARD | inline — `git diff --exit-code` after re-running `scripts/update-openapi.sh` | NONE |
|
||||
| `docker-build.yml::format` | a PR whose changed `.cs` files do not conform to `.editorconfig` | GUARD | inline — `dotnet format --verify-no-changes` | NONE |
|
||||
| `pr-checks.yml::ci-image-pin` | a PR whose `ersatztv-ci` pin is not the 7-char sha of the last commit to touch `docker/ci` | GUARD | inline | `test_ci_image_pin_population.py::test_a_single_job_losing_its_pin_is_DETECTED` covers the POPULATION half only; the git-history half has no test |
|
||||
@@ -318,8 +318,9 @@ job it covers, because a proof reference that covers a fraction must not read as
|
||||
`scripts/ci-step-ran.sh` turns a step the runner silently DROPPED into a red job. Its scope is
|
||||
derived from `.gitea/required-status-contexts.json` (#787), so today it is enforced on `test` and
|
||||
`migrations` — the two required Actions contexts, where a drop is fail-OPEN against branch
|
||||
protection. The remaining `docker-build.yml` jobs were listed in #786 as unexplained; each is
|
||||
recorded here rather than given a marker reflexively.
|
||||
protection. `toolchain-preflight` and `scan` carry the `mark`/`assert` protocol voluntarily without
|
||||
being in the enforced scope. That leaves the **four** jobs below, which #786 listed as unexplained;
|
||||
each is recorded here rather than given a marker reflexively.
|
||||
|
||||
| Job | Decision |
|
||||
| --- | --- |
|
||||
|
||||
@@ -198,6 +198,31 @@ def duplicate_row_faults(rows: list[tuple[str, str]]) -> list[str]:
|
||||
return dupes
|
||||
|
||||
|
||||
def kind_faults(roles: dict[str, str | None], listed: dict[str, str]) -> list[str]:
|
||||
"""THE DETECTOR for a row whose Kind contradicts the job's marker. Shared with its proof."""
|
||||
return [
|
||||
f"'{job}' declares {ROLE_KEY}: {roles.get(job)} (Kind {ROLE_KIND.get(roles.get(job))}) but its row says {kind}"
|
||||
for job, kind in sorted(listed.items())
|
||||
if ROLE_KIND.get(roles.get(job)) != kind
|
||||
]
|
||||
|
||||
|
||||
def guard_jobs() -> set[str]:
|
||||
"""The jobs whose declared role obliges them to hold a row."""
|
||||
return {j for j, r in declared_roles().items() if r in ROLE_KIND}
|
||||
|
||||
|
||||
def coverage_faults(declared: set[str], listed: set[str]) -> tuple[set[str], set[str]]:
|
||||
"""(missing, phantom) — THE DETECTOR the live check and its three proofs all call.
|
||||
|
||||
Named for the same reason `duplicate_row_faults` is: three `test_MUTATION_*` below used to
|
||||
rebuild `declared - listed` inline, and a proof that reimplements the comparison stays green
|
||||
when the shipped one is disarmed — a behavioural test wearing a MUTATION name. Cold review
|
||||
demonstrated exactly that by flattening the live assertion and watching the file stay green.
|
||||
"""
|
||||
return declared - listed, listed - declared
|
||||
|
||||
|
||||
def inventory_jobs() -> dict[str, str]:
|
||||
"""`<workflow>::<job>` -> Kind. One entry per job; see `test_no_job_has_TWO_rows`.
|
||||
|
||||
@@ -251,16 +276,15 @@ def test_the_inventory_covers_exactly_the_guard_JOBS_that_exist():
|
||||
Right-to-left: a row for a job that no longer declares itself a guard (renamed, deleted, or
|
||||
downgraded), which is how a table becomes a comforting fiction.
|
||||
"""
|
||||
declared = {j for j, r in declared_roles().items() if r in ROLE_KIND}
|
||||
listed = set(inventory_jobs())
|
||||
assert declared - listed == set(), (
|
||||
missing, phantom = coverage_faults(guard_jobs(), set(inventory_jobs()))
|
||||
assert missing == set(), (
|
||||
f"these workflow jobs declare {ROLE_KEY} guard/report-only but have NO row in "
|
||||
f"`## {SECTION}` — {sorted(declared - listed)}. Add a row saying what each blocks, where "
|
||||
f"`## {SECTION}` — {sorted(missing)}. Add a row saying what each blocks, where "
|
||||
"its assertion lives and what proof it carries."
|
||||
)
|
||||
assert listed - declared == set(), (
|
||||
assert phantom == set(), (
|
||||
f"`## {SECTION}` has rows for jobs that no longer declare a guard/report-only role — "
|
||||
f"{sorted(listed - declared)}. Either the job was renamed or removed, or its marker "
|
||||
f"{sorted(phantom)}. Either the job was renamed or removed, or its marker "
|
||||
"changed; the row must follow."
|
||||
)
|
||||
|
||||
@@ -303,13 +327,7 @@ def test_each_row_carries_the_KIND_its_marker_declares():
|
||||
exactly that job (`continue-on-error: true` on every check step), so the case is live, not
|
||||
hypothetical.
|
||||
"""
|
||||
roles = declared_roles()
|
||||
listed = inventory_jobs()
|
||||
faults = [
|
||||
f"'{job}' declares {ROLE_KEY}: {roles.get(job)} (Kind {ROLE_KIND.get(roles.get(job))}) but its row says {kind}"
|
||||
for job, kind in sorted(listed.items())
|
||||
if ROLE_KIND.get(roles.get(job)) != kind
|
||||
]
|
||||
faults = kind_faults(declared_roles(), inventory_jobs())
|
||||
assert not faults, "row Kind disagrees with the job's declared role:\n " + "\n ".join(faults)
|
||||
|
||||
|
||||
@@ -324,11 +342,20 @@ def test_no_job_env_key_SHADOWS_a_workflow_level_one():
|
||||
workflow-level value — and the loss is invisible: the job still runs, just with the shared
|
||||
compiler back on.
|
||||
|
||||
THAT THE SCOPES MERGE RATHER THAN REPLACE is not assumed here, and the evidence is in-repo and
|
||||
THAT THE SCOPES LAYER RATHER THAN REPLACE is not assumed here, and the evidence is in-repo and
|
||||
live: `build`'s "Smoke + IPTV E2E" step declares its own step-level `env:`
|
||||
(`SMOKE_SHORT_SHA`, `SMOKE_RUN_ID`) and on the same line consumes the WORKFLOW-level `${IMAGE}`
|
||||
— `IMG="${IMAGE}:${SMOKE_SHORT_SHA}"` — on every push to `main`. A replacing runner would have
|
||||
broken that long ago.
|
||||
— `IMG="${IMAGE}:${SMOKE_SHORT_SHA}"` — on pushes to `main` and `v*` tags (its `if:` also skips
|
||||
a docs-only push). A replacing runner would have broken that long ago.
|
||||
|
||||
THE GAP IN THAT EVIDENCE, stated because it is a scope narrower than the claim: it is STEP-level
|
||||
layering, and what this branch newly relies on is JOB-level. On `origin/main` no job anywhere
|
||||
declared both a job-level `env:` and a consumed workflow-level var, so the job scope had no
|
||||
in-repo witness. The inference is that a runner layering one scope layers the other; the
|
||||
exposure if it did not is the two publish jobs (`ci-image.yml::build` reads `CI_IMAGE`,
|
||||
`docker-build.yml::build` reads `IMAGE`), both `if: github.event_name != 'pull_request'` — so PR
|
||||
CI cannot exercise it, and the first push to `main` would try to publish `":<sha>"` and fail
|
||||
loudly rather than silently.
|
||||
|
||||
So this check is not what proves merging; it removes the remaining exposure, which is a NAME
|
||||
COLLISION. Merging is only safe while no job-level key shadows a workflow-level one, and that is
|
||||
@@ -408,21 +435,21 @@ def test_MUTATION_a_guard_job_with_its_row_DELETED_is_reported():
|
||||
would make every real row report as a PHANTOM, demonstrating a false POSITIVE while proving
|
||||
nothing about the missing-row detection the inventory row claims.
|
||||
"""
|
||||
declared = {j for j, r in declared_roles().items() if r in ROLE_KIND}
|
||||
declared = guard_jobs()
|
||||
listed = set(inventory_jobs())
|
||||
assert declared and listed, "nothing to mutate — the population or the table is empty"
|
||||
# NEGATIVE CONTROL, the same one its phantom twin carries. Without it a PRE-EXISTING
|
||||
# `declared - listed` gap satisfies every iteration below, so the loop would pass while proving
|
||||
# nothing about the deletion — the live assertion would be red in that state, but this proof
|
||||
# would be claiming coverage it does not have.
|
||||
assert declared - listed == set(), (
|
||||
f"NEGATIVE CONTROL FAILED: guard jobs {sorted(declared - listed)} already have no row, so "
|
||||
"every deletion below would be satisfied by the pre-existing gap."
|
||||
assert coverage_faults(declared, listed)[0] == set(), (
|
||||
f"NEGATIVE CONTROL FAILED: guard jobs {sorted(coverage_faults(declared, listed)[0])} "
|
||||
"already have no row, so every deletion below would be satisfied by the pre-existing gap."
|
||||
)
|
||||
for victim in sorted(listed):
|
||||
mutated = listed - {victim}
|
||||
assert declared - mutated == {victim}, (
|
||||
f"deleting the row for '{victim}' was not reported as exactly that job missing"
|
||||
missing, _ = coverage_faults(declared, listed - {victim})
|
||||
assert missing == {victim}, (
|
||||
f"the DETECTOR did not report deleting the row for '{victim}' as exactly that job missing"
|
||||
)
|
||||
|
||||
|
||||
@@ -434,16 +461,17 @@ def test_MUTATION_a_PHANTOM_row_is_reported():
|
||||
itself, so the assertion could not fail and proved nothing about the parser. Pinning the
|
||||
UNMUTATED set to zero phantoms first is what makes the second assertion mean anything.
|
||||
"""
|
||||
declared = {j for j, r in declared_roles().items() if r in ROLE_KIND}
|
||||
declared = guard_jobs()
|
||||
listed = set(inventory_jobs())
|
||||
assert listed, "the table parsed to nothing, so this proof would be vacuous"
|
||||
assert listed - declared == set(), (
|
||||
assert coverage_faults(declared, listed)[1] == set(), (
|
||||
f"NEGATIVE CONTROL FAILED: the unmutated table already reports phantoms "
|
||||
f"{sorted(listed - declared)}, so the mutation below would prove nothing."
|
||||
f"{sorted(coverage_faults(declared, listed)[1])}, so the mutation below would prove nothing."
|
||||
)
|
||||
phantom = "docker-build.yml::a-job-that-was-deleted"
|
||||
assert (listed | {phantom}) - declared == {phantom}, (
|
||||
"a row naming a non-guard job was not reported as exactly the phantom introduced"
|
||||
_, reported = coverage_faults(declared, listed | {phantom})
|
||||
assert reported == {phantom}, (
|
||||
"the DETECTOR did not report a row naming a non-guard job as exactly the phantom introduced"
|
||||
)
|
||||
|
||||
|
||||
@@ -453,9 +481,14 @@ def test_MUTATION_a_row_whose_KIND_disagrees_is_reported():
|
||||
report_only = [j for j, r in roles.items() if r == REPORT_ONLY]
|
||||
assert report_only, "no report-only job exists, so this proof is vacuous"
|
||||
listed = dict(inventory_jobs())
|
||||
assert not kind_faults(roles, listed), (
|
||||
"NEGATIVE CONTROL FAILED: the unmutated table already disagrees with a marker"
|
||||
)
|
||||
listed[report_only[0]] = "GUARD"
|
||||
faults = [j for j, kind in listed.items() if ROLE_KIND.get(roles.get(j)) != kind]
|
||||
assert faults, "a report-only job carrying a GUARD row was accepted"
|
||||
faults = kind_faults(roles, listed)
|
||||
assert faults and report_only[0] in faults[0], (
|
||||
f"the DETECTOR did not report a report-only job carrying a GUARD row: {faults}"
|
||||
)
|
||||
|
||||
|
||||
def test_a_workflow_job_added_without_a_marker_is_DETECTED():
|
||||
|
||||
Reference in New Issue
Block a user