Agent guide: quality gates¶
Moved verbatim out of the root
AGENTS.md(progressive disclosure: the root file is loaded into every agent session, this one only when its pointer fires). The rootAGENTS.mdremains the primary contract.
AI-readiness gate¶
scripts/check_ai_readiness.py runs in CI as a fast structural gate (every gate script's full description: scripts-inventory.md). It checks:
| Check | Severity | What it enforces |
|---|---|---|
file-size |
ERROR > 2000 lines, WARN > 1500 | Every first-party Python tree (abicheck/, scripts/, tests/, skills-src/evaluation/field/, skills-src/evaluation/validation/, action/, the clang plugin's tests/ — FIRST_PARTY_PY_ROOTS) stays legible. LARGE_FILE_ALLOWLIST downgrades a specific pre-existing violator to WARN with a reviewed reason — it is not a way to silently exempt a new file |
claude-md-coverage |
ERROR | CLAUDE.md exists in each original major sub-tree (REQUIRED_CLAUDE_MD_DIRS, which now also covers skills-src/) |
agent-instructions-coverage |
ERROR | AGENTS.md or CLAUDE.md exists in .github/, action/, contrib/abicheck-clang-plugin/ (REQUIRED_AGENT_INSTRUCTION_DIRS) |
script-inventory |
WARN | Every scripts/*.py is named in scripts/CLAUDE.md's inventory table — an unlisted script is invisible to that discovery path |
generated-file-ownership |
ERROR | A known-generated file (GENERATED_FILE_MARKERS, plus every docs/reference/examples/case*.md, plus every *.md under the three generated agent-skill trees — .agents/skills/, .claude/skills/, .gemini/skills/ — scoped to the skill directories scripts/gen_agent_skills.py actually owns, so a hand-authored skill sharing an output root is not flagged) still carries its "this is generated, don't hand-edit" marker comment |
test-ratio |
WARN | At least 20% test-to-source file ratio; test files are discovered recursively under tests/ (not just top-level) |
future-annotations |
WARN | from __future__ import annotations per this file's convention |
changekind-partition |
ERROR | Every ChangeKind is in exactly one of BREAKING_KINDS / API_BREAK_KINDS / COMPATIBLE_KINDS / RISK_KINDS |
abi-taxonomy-coverage |
ERROR | Every leaf mechanism in docs/contribute/abi-api-failure-taxonomy.md (88 today) carries exactly one Phase 3 coverage status in docs/_meta/abi-taxonomy-coverage.json — the taxonomy counterpart of changekind-partition, so a leaf added without being classified can't silently drop out of the coverage denominator. Also validates that every learn page/topic/catalog case/ChangeKind the mapping names exists, that a non-COVERED status states a reason, that a KNOWN_UNDETECTABLE/NOT_IMPLEMENTED leaf's cross-reference really appears in docs/learn/limitations.md/docs/contribute/known-gaps.md, and that the recorded status agrees with its own Phase 2 columns under the plan's first-match-wins order. Rules live in scripts/abi_taxonomy_coverage.py, which scripts/gen_abi_taxonomy_coverage.py imports too, so the gate and the generated report (docs/contribute/abi-taxonomy-coverage.md) can't disagree |
known-gap-canaries |
ERROR | Every OPEN/PARTIAL/NARROWED entry of docs/contribute/known-gaps.md names a canary (<!-- canary: tests/...::test_x -->, a test marked @pytest.mark.known_gap_canary that asserts the gap's current answer, never skipped, xfail only strict=True) or carries one reasoned <!-- no-canary: ... --> note; no CLOSED/FIXED entry stays on that page; every marked test is named by an entry. A failing canary means the gap moved: archive the entry and turn the canary into a regression test. Rules in scripts/known_gap_canaries.py; tests/test_known_gap_canaries_gate.py also asks pytest to collect every named canary |
changekind-detector |
WARN | Every ChangeKind is produced somewhere (not orphaned) |
changekind-docs |
WARN | Every ChangeKind is mentioned in docs/ |
doc-count-sync |
ERROR on drift, WARN if anchor moved | Headline counts in docs (ChangeKind count, example-catalog size) match their source of truth (len(ChangeKind), ground_truth.json) — this file (AGENTS.md) is included in the generic sweep, same as README.md/CLAUDE.md |
cli-contract |
ERROR | No unallowlisted front-end cli*.py/appcompat.py module calls a Tier-1 core entry point (checker.compare, dumper.dump, service.resolve_input) directly — it must route through the Tier-2 service (service.run_compare/compare_snapshots, service.run_dump/service_dump_pipeline.run_dump_request, service_input_resolution.resolve_side_snapshot); ADR-037 D10.1, extended to the latter two per Phase 0 item 2 of docs/contribute/plans/duplication-and-convergence-assessment.md. CLI_CONTRACT_ALLOWLIST in scripts/check_ai_readiness.py held the reviewed, line-pinned legacy exceptions; the last ones left with the ABICC compat front end, so it is empty and any direct call fails |
engine-cli-boundary |
ERROR | No engine-layer module (service*.py, artifact_*.py, buildsource/**/*.py, workflows/artifact/**/*.py) imports click or a cli_* sibling — the CLI is a frontend adapter over the engine, not the reverse. ENGINE_CLI_BOUNDARY_ALLOWLIST (scripts/engine_cli_boundary.py) is now empty — every pre-existing inversion was closed (Phase 1 of docs/contribute/plans/duplication-and-convergence-assessment.md, the rest deleted with scan) — so any engine-layer click/cli_* import fails outright |
fact-detector-misuse |
ERROR | ADR-063 Phase 0 (docs/contribute/plans/one-semantic-pipeline.md): no direct ==/!= comparison of a Fact[T]-typed value (a <attr>_fact field access, or a Fact(...)/Fact.<classmethod>(...) constructor call) anywhere under abicheck/ — a detector must unwrap via .status first, never compare two Fact[...]s (or a Fact[...] against a bare value) directly, since Fact[T] deliberately doesn't override __eq__ and a direct comparison silently falls back to structural dataclass equality over status/value/diagnostics together. Real, repo-wide AST scan (scripts/fact_detector_misuse.py + fact_detector_misuse_aliases.py/fact_detector_misuse_scope.py), resolving same-function local aliases, annotated parameters, constructor-classmethod aliases, and closure-scope shadowing — not a naive textual match. No baseline: any match is an unconditional error |
fact-field-readers |
ERROR | ADR-063 Phase 0 (docs/contribute/plans/one-semantic-pipeline.md): no function outside EXEMPT_FUNCTIONS reads a Fact[T]-bridged legacy field (RecordType.bases/virtual_bases/vtable/vptr_offset_bits, Param.is_va_list) directly — via a plain attribute access, a getattr(obj, "name", ...) call (including a resolved getattr/builtins alias, excluding one locally shadowed by a parameter), an operator.attrgetter(...) call or a bound/unbound __getattribute__ call (each through a resolved alias too), an ast.AugAssign target (rec.bases += x, an implicit read before the write), or a case RecordType(bases=[]): structural-pattern match (keyword or positional) — without first consulting its Fact[...] sibling's .status, which would collapse "confirmed empty/false" and "no evidence" onto the same value. Real, repo-wide AST scan, not a diff_*.py glob. KNOWN_UNMIGRATED_READERS records every currently-known reader site the same allowlist-and-shrink way IMPORT_CYCLE_ALLOWLIST does, keyed by enclosing function, attribute, the read's own outermost containing expression, its own exact source text, and a per-site occurrence rank — a new, unlisted site fails outright |
import-cycle-growth |
ERROR | No unapproved strongly-connected-component growth within abicheck/ — not literally "no import cycles": a large, deliberately-baselined CLI-registration SCC already exists and is allowed (IMPORT_CYCLE_ALLOWLIST). The invariant is that no new module joins it and no new separate SCC forms; extending the allowlist to unblock a fresh cycle needs an ADR or explicit architectural sign-off, not a routine edit (CLAUDE.md "M1-3") |
mypy-baseline |
ERROR if drifted up | mypy error count ≤ documented baseline |
mypy-override-targets |
ERROR | Every first-party (abicheck.*) [[tool.mypy.overrides]] target still resolves — an exact target naming neither a module nor a package, or a wildcard matching nothing, fails. mypy silently ignores an override whose target does not exist, so a deleted module otherwise leaves its override and the comment explaining it behind with no signal anywhere (eleven such entries had accumulated when this gate was added). Module resolution and wildcard matching follow mypy's own rules — stub-only (.pyi) modules count, a PEP 420 namespace directory containing a module is a module, and a * component matches zero or more components (ported from mypy.options.Options.compile_glob, not approximated with fnmatch). Third-party targets are out of scope: whether yaml or click resolves depends on the environment mypy runs in, not the tree. Lives in scripts/mypy_override_targets.py, a sibling leaf module, since check_ai_readiness.py is already past the 2000-line hard cap |
examples-ground-truth |
ERROR | Every examples/case*/ has a README.md and an entry in ground_truth.json |
examples-readme-sync |
ERROR | examples/README.md headline count, verdict distribution, and case-index rows match ground_truth.json (catches missing/stale catalog rows) |
mkdocs-nav-coverage |
WARN | Every docs/**/*.md is in mkdocs.yml nav or linked from another doc |
adr-index-nav-sync |
ERROR | Every docs/contribute/adr/*.md is linked from adr/index.md, and the ADR index page itself (not each individual ADR — relaxed, since that overloaded top-level nav with 50+ flat entries for no reader benefit) is listed in mkdocs.yml's nav, so every ADR stays reachable from published navigation (this is what originally caught ADR-041 going missing from nav despite being accepted). Also requires every ADR to carry a Status metadata line/heading, and an ADR whose status leads with "Superseded" to link to its replacement |
adr-status-sync |
ERROR on contradiction / bad receipt, WARN on staleness | An ADR's own **Status:** line and its row in adr/index.md may not contradict each other — one claiming nothing is implemented while the other claims something is (how ADR-056's row went stale), or disagreeing on the decision word. Paraphrase is explicitly allowed: the index cell is an abridgement, and a stricter prototype flagged 15 of 56 ADRs, nearly all false positives. Separately validates the optional **Verified:** <ref>@<sha> on <YYYY-MM-DD> receipt (see adr/index.md's convention section): exactly one per ADR, well-formed, a real non-future date, and naming a commit reachable from the default branch — a receipt anchored to the branch that adds it vanishes on merge and then fails this required job on main permanently. It then WARNs when commits after that sha touched a first-party file the Status paragraph names, which is the only mechanism here that catches document-vs-code drift (ADR-049's status claimed its evaluator was unwired for five merged PRs after it wasn't). A file is watched only when the Status names it by full repo-relative path (any FIRST_PARTY_PY_ROOTS tree, not just abicheck/); a bare x.py is accepted only when it resolves to abicheck/x.py, and family shorthand (_resolver.py) is deliberately not guessed at — see adr/index.md for why. Lives in scripts/adr_status_sync.py, a sibling leaf module, since check_ai_readiness.py is already past the 2000-line hard cap |
perf-antipatterns |
ERROR on growth, WARN on a stale baseline | No new performance anti-pattern inside a loop or comprehension under abicheck/: membership/index/count on a function-local list, re.compile, json.loads/deepcopy, self-copying accumulation (acc = acc + [...], [*acc, x], {**acc, ...}), a subprocess call, re-sorting or copying a loop-invariant collection, str += concatenation, quadratic self-dedup ([x for i, x in enumerate(s) if s.index(x) == i], x not in s[:i]; s a name or attribute chain such as self.s), pickle.loads/model_copy(deep=True) per item, or blocking network I/O / time.sleep per iteration (error paths inside raise are exempt). Every site in the tree has been triaged: fixed, or exempted where it stands by a # perf-ok: <reason> comment (trailing the statement, or on its own line above it; no reason, no exemption) -- for shapes that are the work itself, such as one json.loads per JSON-lines record or deepcopy inside __deepcopy__. A string a loop body rebinds unconditionally each iteration, and a module-scope comprehension (runs once, at import), are not flagged. scripts/perf_antipatterns_baseline.json (per-(file, function, rule) counts) is empty and stays the ratchet for untriaged debt: a count above it is an error, one below a warning to shrink it. Lives in scripts/perf_antipatterns.py |
banned-imports |
ERROR | No print(...) outside CLI/reporter modules; no subprocess(..., shell=True) |
project-snapshot-dto-no-asdict |
ERROR | No dataclasses.asdict()/asdict() call in a ProjectSnapshot DTO file (abicheck/storage/dto.py, abicheck/storage/import_v1.py, abicheck/project_snapshot_store.py, abicheck/storage/semantic_ir_codec.py) — ADR-063 Phase 8's D8 constraint, made mechanical |
test-change-symbol-typed |
ERROR | No Change(..., symbol=None) or make_change(symbol=None) anywhere under tests/. mypy runs over abicheck/ only, so a fixture could construct a Change in a state its own annotation (symbol: str) forbids and nothing would say so — which is how a known-gaps.md entry came to record a production defect that did not exist, from a None a test had fabricated. Typechecking the (unannotated) suite is not an available alternative; this is the narrow structural stand-in |
license-header |
WARN | Every abicheck/**/*.py carries the Apache-2.0 header / SPDX identifier |
usecase-complete-has-runs |
ERROR | Every use case the registry marks complete has at least one automated scenario (automated: true under tests/scenarios/) or one scripts/usecase_flows.yaml flow. Zero-run complete entries must be listed, each with a reason, in scripts/usecase_zero_run_grandfather.json; a listed entry that gains a run, stops being complete or no longer exists is stale and fails, so the list only shrinks (ADR-076) |
test-assertion-density |
WARN | Every test_* function asserts something (directly or via a same-file helper) — flags zero-assertion smoke tests so coverage isn't "filled" without verification |
Run locally: python scripts/check_ai_readiness.py. Errors fail; warnings print and pass.
Usage ratchet (test-only code, cross-module clones)¶
The 80% line-coverage floor counts a test as a caller, so a function whose
last production caller was deleted stays covered -- and green -- by its own
unit test. scripts/check_usage_ratchet.py (verify.py's usage-ratchet
step, pr profile, CI ai-readiness job) reads the tree statically (stdlib
ast; no import, no recording) and reports three finding families as stable
keys:
| Key family | Shape | Meaning |
|---|---|---|
test_only_functions |
abicheck.mod#Class.method |
Defined in abicheck/, named by tests/, with no live production reference. The rule is production_references.py's (docs/contribute/plans/dead-code-and-single-owner.md): production is abicheck/, scripts/, action/, actions/, .github/, pyproject.toml; a reference inside another dead function's body does not count; documented API and functions an ADR/plan names are roots; dunders, registered and framework-called methods are never reported |
test_only_modules |
abicheck.mod |
A non-package module tests/ import but no live production module imports or names (import statements, "abicheck.x" strings, entry points, workflow text; docstrings excluded). A module imported only by test-only modules is one too |
cross_module_exact_clones |
a#f = b#g |
Functions in different modules whose AST (docstring dropped, positions and the function's own name ignored) is identical and at least 40 nodes large |
Keys carry no line numbers. scripts/usage_ratchet_baseline.json only
shrinks: a finding missing from it fails (new debt), and a baselined key no
longer found fails too until python scripts/check_usage_ratchet.py --update
removes it. With --base REF (default $ARCHITECTURE_BASE, which CI sets)
a baseline key the base revision's baseline lacks fails, so a branch cannot
baseline its own new finding. A finding that is legitimately test-only or
duplicated (public Python API for library users, an entry point loaded by
name from outside the repo) goes in scripts/usage_exceptions.yaml with a
reason; an exception that matches nothing fails as stale.
When it fails on your change: wire the function into its production
consumer, delete it (and its test), or merge the clone into one owner --
in that order of preference. --json prints every current finding.
scripts/usecase_paths.py remains the dynamic, report-only counterpart.
Optional-tool inventory (default-install facts)¶
Every lookup of something outside abicheck is registered in
tests/optional_tool_inventory.py with its role and what a default install
must still produce without it. tests/test_optional_tool_inventory_gate.py
(repo_scan) fails on an unregistered or stale site. It scans for
shutil.which, find_*_bin resolvers, ABICHECK_* environment names,
optional third-party imports, and a literal program as argv[0] of a list or
tuple display; a program bound to a variable first is not resolved. An
optional_enrichment entry must name the fact families it leaves intact and
a proof in tests/test_default_install_fact_invariants.py (integration),
which hides every optional tool and environment variable and dumps real
libraries through the CLI with both header frontends against a compiled
sizeof/offsetof oracle. When the gate fails, add the site to the entry
for the same tool, or add an entry: role, without, preserved/marked,
and a proof.
Test-quality ratchet (tautological tests)¶
Coverage counts a line as tested once a test runs it, whatever the test then
checks. scripts/audit_test_quality.py --check (verify.py's test-quality
step, pr profile, CI ai-readiness job) reads every test_* function
statically and flags the ones whose asserts cannot fail for a wrong
behaviour, only for a renamed attribute or a removed call:
| Flag | Shape | Why it is low-value |
|---|---|---|
type_only |
every assert is is not None, callable, hasattr, isinstance(x, <builtin>) or len(x) > 0 |
any non-empty result passes |
mock_echo |
patches something and only checks that a mock was called | proves the wiring, not the outcome |
set_then_read |
x = C(attr=LIT) then assert x.attr == LIT, nothing else |
the dataclass echoes its constructor |
constant_mirror |
pins an abicheck constant or enum .value to a literal, nothing else |
restates the source |
no_assert |
no assert, pytest.raises, assert* call or asserting helper |
checks nothing |
Not flagged, on purpose: is None, bare truthiness (assert result.ok,
assert not offenders), negations (not hasattr), isinstance against a
project class (the class a dispatcher picked), and mock checks that read the
arguments (assert_called_with, call_args) -- each is a real outcome.
scripts/test_quality_baseline.json holds the findings that existed when the
gate was adopted, keyed file::Class.test with no line numbers, and only
shrinks: a finding absent from it fails, a baselined key that is no longer
found fails until python scripts/audit_test_quality.py --check --update
removes it, and with $ARCHITECTURE_BASE (CI sets it) a key the base
revision's baseline lacks fails, so a branch cannot baseline its own finding.
When it fails on your change, in order of preference: make the test check the
behaviour it exists for (the value, the error, the chosen branch); delete it
if another test already covers that behaviour; or, when the shape is
deliberate (a serialized-format spelling pin, a must-not-raise smoke test),
put # test-quality: ok <reason> on its def or a decorator line. Without
--check the script prints a ranked report (--json PATH for every row),
which is the work queue for paying the baseline down.
Test-quality gates (beyond line coverage)¶
Line coverage measures reach, not whether a test actually checks the result. Several mechanisms guard test quality so coverage can't be "filled" without verifying behaviour:
- Unique-coverage report (review queue, not a gate) —
scripts/test_unique_coverage.py, run weekly by.github/workflows/test-unique-coverage.yml. It reads the per-test coverage contexts and lists each test's unique line coverage: zero-unique tests (ranked by lines covered, and by runtime with--durations), files whose tests are mostly zero-unique, and lines only one test covers. It is a review queue, never a deletion list: a zero-unique test can still assert a value no other test checks, and a line covered by one test is a single point of protection, not a defect. Decide per test with the test-assertion-density gate and the mutation lane (which test actually kills a mutant), and never remove a test on this report alone. The script always exits 0. - FP-rate gate —
scripts/check_fp_rate.py(mirrored intests/test_fp_rate_gate.py). A labelled corpus of(old, new)snapshot pairs run under public-surface scoping: internal-noise cases must stay non-breaking (no false positives), real-break cases must stay breaking (no false negatives). Both baselines are 0; grow the corpus only with cases the correct implementation already passes. Cases carry a scoping axis tag (CASE_CATEGORY);--markdown/--jsonemit a per-axis FP/FN breakdown for trend tracking. - Per-tier accuracy gate —
scripts/check_tier_accuracy.py(mirrored intests/test_tier_accuracy_gate.py). Complements the FP-rate gate by measuring what each evidence level buys: one labelled change per case is projected down to what each tier observes (L0 symbols → L1 debug → L2 headers → L3 build) and run throughcompare; verdicts collapse to a 3-band ordinal (non-breaking/risk/breaking). It records, per tier, over-calls (false positives) vs under-calls (false negatives) — encoding the principle that adding a layer reduces both (L1 sees layout but over-calls internal churn; L2 scoping removes it; L0/L1 under-call breaks only headers/build see). Gates on top-tier correctness + under-call monotonicity (more evidence never hides a break an earlier tier caught — authority rule). CI posts the matrix to the step summary. User docs:docs/learn/evidence-and-detectability.md§ "What each layer buys". - Mutation testing —
scripts/mutation_results.py(parser/attribution) +scripts/check_mutation_score.py(gate) +.github/workflows/mutation.yml.mutmutmutates the detector core;[tool.mutmut].only_mutateis the list, and it now covers identity, suppression and serialization alongsidediff_*/checker_policy. A surviving mutant is a covered-but-unverified line. Three lanes, because one cannot serve both purposes: - PR — auto-runs on a diff touching a mutated module or that module's own tests
(path-filtered; the
mutationlabel still forces a run the filter misses), gating--diff-scoped: any survivor in a function this branch changed fails. Absolute — there is no baseline to be under. Lines the branch removed are resolved against the merge base, since that is the only revision they exist in. - Weekly — per-module drift against the committed
mutation-baseline.json, so one module's regression cannot be paid for by an unrelated module's improvement. - Dispatch (
write_baseline: true) — records that file. Deliberately manual: accepting the current survivor set is a review decision, not something a cron does silently.
SURVIVOR_BASELINE (one global total) remains as a fallback and is the weaker gate —
it cannot express the per-module invariant. --require-baseline is what stops a run
that gated nothing from exiting 0, and an unresolved run (suspicious/no-tests/segfault)
is a failed measurement, not zero survivors. A timeout counts as detected (as in
PIT/Stryker): every timeout the first complete run produced was a mutation that made
the code loop forever, and timeouts are still reported separately. mutation-baseline.json is not
recorded yet; until it is committed, the PR lane gates only changed functions and
warns Mutation drift not checked (failing every detector-test PR in two minutes
measured nothing), and the weekly run records the baseline instead of drifting
against it. Run cost is scoped to what a gate reads: with no baseline, a PR
run executes only the changed functions' mutants (scripts/mutation_scope.py), and a
full-population run is split across 12 shard jobs by function (mutation_scope.
shard_assignment; module-level shards could not fit diff_platform.py under the job
ceiling), and a weekly run with no committed
baseline records one (artifact mutation-baseline) instead of failing. Per-lane trigger detail lives in
.github/AGENTS.md's workflow table rather than being copied here.
- Mirror-test churn — scripts/test_refactor_churn.py (report-only, not wired into a
gate; tests in tests/test_test_refactor_churn.py). Ranks each test_* function by the
edits that behaviour-preserving commits (refactor:/perf:/style:) made to it, assertion
edits first: an assertion edit in a commit claiming no behaviour change may indicate a
test mirrors the implementation, and is a common reason a refactor breaks tests. Read a
candidate's commits before changing the test; the assertion/setup labels are syntactic.
- Metamorphic property tests — tests/test_detector_properties.py (slow).
Hypothesis-generated snapshot pairs checked against invariants that hold for any
input (idempotence, determinism, direction-symmetry of touched symbols, emitted-kind
partition, additive monotonicity) — generalization guards, not example-shaped tests.
- Primitive-level property tests — a narrower sibling of the metamorphic suite
above, for a reusable, general-purpose helper rather than a whole detector.
test_diff_namespaces.py::TestPairedStableIndicesProperties tests
_paired_stable_indices (the evidence-gated connected-components merge behind
EXPERIMENTAL_REMOVED_WITHOUT_REPLACEMENT's versioned-inline-namespace alias
handling) directly, not only through its highest-level caller. It exists because
fixing that one double-report bug took six independent review rounds against the
same ~150-line function, and five of the six findings were bugs in the generic
merge primitive itself (order-dependence, side-membership asymmetry, an empty
string silently accepted as identity, parameter-signature text leaking into the
grouping key, a merged key's string representation coincidentally colliding with
an unrelated singleton's own key) — none of which any hand-written example test
caught, because every one of those tests was written to confirm the fix just made,
which by construction only encodes the bug the fix's author already thought of. A
hand-written test only forecloses the specific input it names; only property
tests stating the primitive's actual contract — "no merge without shared identity
evidence," "the result never depends on input order," "a real alias merges
regardless of which side holds which spelling" — search the input space the way an
adversarial reviewer does. When adding a new reusable merge/dedupe/grouping
primitive anywhere in this codebase, give it this same treatment: a small,
standalone property-test class stating its contract as invariants, decoupled from
any one caller's domain logic, before or alongside the domain-level example tests.
Two of the two-round-falsified identity sources the same incident produced
(constants' value-equality, types' structural-fingerprint-then-source_location)
are the companion lesson: once a proposed identity heuristic has been individually
falsified by a concrete counterexample twice, the correct response is to stop
proposing a third and accept the double-report as a documented limitation (see
_type_index_items's and _diff_constants's docstrings) — the same
"attempted twice, reverted twice" discipline the linkage-blind-removal and
type_base_changed entries above already establish, not a heuristic that keeps
finding one more counterexample.
- Silent-skip guard — tests/conftest.py. A marker lane can export
ABICHECK_MIN_EXECUTED=<n>; the session fails unless at least <n> tests actually ran,
so a missing external tool can't turn a lane green with zero work done. Wired into the
abicc, libabigail, and integration CI lanes.
- Third-party-boundary tests must exercise the real public API at realistic scale, not
just internal arithmetic. Lesson from a real incident (ADR-059 §12: snapshot_io.py's
zstd max_window_size was silently computed in the wrong unit for months): one test
asserted a value's own formula was self-consistent (a tautology against the bug's own
wrong formula), and a second used a toy-shaped fixture (small, highly-compressible input
at a large nominal parameter) whose actual required behavior collapsed to something
trivial — both passed identically before and after the regression. When a module's job is
"honor an external library's/format's contract," every supported algorithm needs at
least one test that goes through the module's actual public entry point, at a content
scale realistic enough to trigger the condition being defended against where one is known
— never only a hand-constructed shortcut into the dependency's lower-level API. This
applies per algorithm even when only one of them has a known incident to defend against: a
principle that silently excludes the algorithm nobody has broken yet isn't a principle, and
a review round caught exactly that gap here (gzip had none). See
tests/test_snapshot_compression.py's test_zstd_round_trip_at_production_scale_and_level
(real AbiSnapshot → real write_snapshot_bytes/read_snapshot_bytes chokepoints → scaled
past the threshold where the KiB/bytes regression actually reproduces) and its gzip sibling
test_gzip_round_trip_at_production_scale (same chokepoints/scale, no known incident to
reproduce, added purely to keep this bullet true for every supported algorithm) for the
pattern to follow for the next storage/serialization boundary.
- A differential test must prove both of its configurations actually ran. A
test whose claim is "configuration A and configuration B agree" (pruning
off vs. on, one backend vs. another, cache cold vs. warm) asserts nothing
if B was served A's cached result — it then compares A with itself and
passes no matter what B would have done. This is not hypothetical: both
double-dump() tests in tests/test_clang_header_backend_integration.py
derived their "fresh" AST-cache root from the same tmp_path, so the
second run hit the first's on-disk cache, the streaming pruner never
parsed anything, and the equivalence and method-count assertions were
vacuously true. A sibling test proving the mechanism can engage on the
same repro does not repair this — it says nothing about whether this
comparison engaged it. So: give each configuration a genuinely distinct
cache root (and clear any in-process memo alongside it — a disk-cache miss
alone does not force a reparse), and assert within the same test that
the path under comparison executed, by observing the mechanism rather than
its output (_PruneSpy there wraps the real loader and records its call
count and reported prune count). The same rule applies before sharing an
expensive fixture between two configurations: sharing immutable inputs is
fine, sharing the output whose equivalence is the claim is the bug above.
- An autouse fixture's cost is charged to every test, so its allocation
must be O(1). tests/conftest.py's _isolate_snapshot_cache is autouse;
it originally allocated a pytest numbered directory, which enumerates
every existing sibling to choose the next number — so a worker that had run
N tests paid a scan of N entries to start test N+1, roughly quadratic over
a session, charged even to tests that only compare two enum values. Measured
two ways: the allocator alone costs 5.8ms vs. 0.07ms per call against a
directory holding 8000 siblings, and end to end a 1107-test subset runs in
1.7-2.2s instead of 2.3-2.9s (0/8000/20000 pre-existing siblings) — the
allocator's own margin is larger than the end-to-end one, so read the
end-to-end figure as the claim. It now uses tempfile.mkdtemp inside
pytest's own base temp dir: the same guarantee (a distinct, empty,
test-owned directory, under pytest's retention policy) from an atomic
random name. The isolation itself is not the thing to economize on —
tests/test_conftest_cache_isolation.py states that contract as
invariants specifically so the next round of "make this faster" cannot
reach for a shared session-wide cache directory, whose cross-test cache
hits would surface as unrelated mystery failures.
- A matrix test needs an oracle, not just a type check. A parametrized
sweep asserting only that the result is one of the valid enum members
pins nothing: TestExhaustiveMatrix in
tests/test_policy_override_matrix.py emitted 1,608 such cases that an
implementation returning COMPATIBLE for every input — and one returning
BREAKING for every input — both passed in full (verified by
substitution). Nor is a test that asserts A & B ⊆ A about policy; it is
set algebra, true for any two sets including two wrong ones (four such
tests were removed). Write the expectation as an independent second
derivation of the documented behavior (_expected_verdict there derives
from the intrinsic *_KINDS partitions and the two named downgrade sets,
deliberately not from policy_kind_sets, which is what the function
under test folds over), batch the sweep so a failure names every
disagreeing case at once, and add a vacuity guard on the oracle itself —
an oracle accidentally reduced to a constant makes the whole matrix pass
while asserting nothing, which is the original failure in a new place.
- Don't re-run the whole repository to test argument dispatch. A check
that scans every first-party file has exactly one owner — for the
readiness gate, the dedicated ai-readiness CI job, which runs
verify.py --profile pr --only ai-readiness with no skips. A unit test
that drove nearly that whole registry over the live tree in order to
assert main() returns 0 cost ~5m in a measured run and added no signal
the owning job did not already have. tests/test_ai_readiness_main_dispatch.py
keeps main()'s own contract (selection, --only/--skip composition,
error-vs-warning exit codes, JSON agreeing with the human report) against
the real main() over a small instrumented registry, and each check's
own live-tree test stays in tests/test_ai_readiness.py, where it belongs.
Two sibling live-tree assertions were examined and deliberately kept
in the unit lane: test_fact_detector_misuse.py's
test_no_violation_in_real_repo and test_fact_field_readers.py's
test_no_unlisted_violation_in_real_repo. Unlike the main() case they
assert something substantive (the tree is clean; the baseline holds no
stale entry), so relocating them would stop a contributor learning
locally that they introduced a violation. Their cost was attacked at its
cause instead — see the next bullet. Note also what measurement ruled
out: sharing one parsed-AST inventory across the eleven test modules that
each walk abicheck/**/*.py sounds like the win and is not. Reading and
parsing all 787 files costs ~1.1s in total against ~43s for those two
tests — the scan logic dominates by roughly 40x, so a shared parse would
have bought ~2s of 43s.
- When a live-tree gate is slow, profile it before relocating the test
that runs it. fact-detector-misuse's scan took 25.5s over 787 files,
and profiling said why: fact_equality_misuse_sites computes
_def_containing_qualnames, _locally_bound_constructor_shadow_names
and _lexical_function_parents, then calls _fact_aliases, which
computes all three again — four, two and two full ast.walks per file,
and the bulk of the scan's 13.7M walk calls. _memoize_per_tree in
scripts/fact_detector_misuse_scope.py caches each on the tree node's
own __dict__ (not a module-level id(tree) dict, which would leak for
the life of the process and could serve a stale entry once an address is
reused), taking the scan to 19.0s with byte-identical output across
all 787 files. Prefer that to moving or deleting the test: the unit lane
and the ai-readiness job both get faster, no coverage moves, and no
lane-policy decision is needed. Two conditions make such a cache safe and
both were checked rather than assumed — every decorated helper is pure,
and no caller mutates a returned mapping. One caution, recorded because
it caught a real gap in the first version of the accompanying test:
tests/test_fact_detector_misuse_memoization.py initially had 77 tests
that a key = () mutation — dropping the second argument from the cache
key — passed in full, because every real caller happens to pass the one
memoized spans object per tree. An untested key is not an unnecessary
key: test_cache_key_includes_the_second_argument now calls the helper
twice on one tree with two genuinely different span arguments, and a
cache-that-caches-nothing mutation is caught separately, since output
equivalence alone cannot distinguish a correct cache from an absent one.
-
A duplicate test body is a review queue, not a deletion list. An audit of this suite reported 61 same-module clone groups; re-screening with
scripts/find_duplicate_tests.py(body + parameters + decorators) found 29, and the count is not the point — the kind of clone is. Clones across two differently-named classes are usually intentional: each class states a distinct claim and the body coincides, andtest_signature_normalization.pyhas two such pairs that each already name their counterpart in a comment, so removing them would trade a stated regression guard for no measurable time. The category worth reading is same class or module scope with different names, because a test whose name promises input X while its body tests input Y is worse than a duplicate — it makes a gap look filled. All nine such groups were worked through; four were one assertion under two names, and the other five each hid something:_strip_param_signature's "pointer parameter is not mistaken for a wrapper" asserted an input the function's own docstring says never reaches that branch (now a function-pointer parameter, which no other case in the file supplied); abaseline_generationtest never had a manifest that declared one;test_sc_offline_snapshotcould not be removed at all, becausetests/test_scenarios.pyseparately asserts onetest_sc_*per automated catalog scenario, so it was strengthened to assert the offline property instead of inheriting it from the helper; anl3l4l5clone claimed the header/build pass-name alias while exercising no alias; and aclassify_perf_pathsclone named a workflow-wiring claim no CLI argument can express, which turned out to be genuinely untested —performance.ymlsourcing the PR's whole current label set rather than the delivered event's is now asserted, and both regressions it guards against were confirmed by mutating the workflow. Two cautions from that pass. Mutate before claiming a gap: one group looked like a missing one-sided-evidence case in the ELF alignment detector, and a mutation test showedtest_declared_alignment_known_one_side_only_ falls_backalready covered it — the speculative test was withdrawn and the clone folded instead. And when asserting against workflow text, strip comments first: the first version of theperformance.ymlassertion failed because the file documents the rejectedgithub.event.label.namespelling in a comment, so a raw substring search reported the very thing it was checking for absent. -
Test redundancy report —
scripts/test_redundancy.py(report only, not a gate;.github/workflows/test-redundancy.yml, manual). Reads the per-test coverage contexts (pytest --cov-context=test) and classifies each test case and function asunique,coverage-redundant(every line it covers is also covered by another test;subsumed_bynames each test that covers all of its lines by itself, and "covered by several tests together" means only a union of tests covers them),fully-redundant(also kills no mutant no other test kills), orunknown(no covered line recorded). Coverage alone never makes a testfully-redundant: mutmut 3.7.0 does not record which tests killed each mutant, so kill uniqueness needs a--killsfile from a recorder that does not exist yet, and without one every redundancy iscoverage-redundant. Coverage uniqueness is relative to the run measured: a subset run can mark a testuniquebecause the test covering its lines sits outside that run, which does not prove uniqueness across the full suite. Mutate before deleting: a clone group is a review queue, not a verdict.
Line-coverage floor¶
The pr profile's unit-pr step (scripts/verify.py) enforces a 95%
line+branch coverage floor (--cov-fail-under=80) — the fast profile does
not, since it's the everyday inner loop and deliberately skips coverage
instrumentation. This floor applies only on the canonical Linux/Python-3.13
unit-test lane in .github/workflows/ci.yml — that's where the full unit
suite runs under coverage. In CI that lane runs as three concurrent
pytest --shard=K/3 jobs (tests/pytest_shards.py: whole files, balanced by
test count) that only collect coverage data; unit-tests-coverage combines
them and enforces the floor once. Locally, verify.py's unit-pr step runs
the same selection unsharded, in one process.
python-compat.yml runs the same full fast suite, uncovered and required (no continue-on-error), on
3.11 (the requires-python floor), 3.15 and free-threaded 3.15t on every PR:
interpreter behavior changes (3.15's json serializing a str subclass via
str(), 3.15t threads inheriting the parent context) break tests no smoke
subset selects. 3.12/3.14 keep the wheel-install smoke lane.
macOS/Windows skip the Linux-only ELF/DWARF parsing tests, which structurally lowers
their coverage (~93% on macOS), so those lanes run the same tests without the
fail-under gate — and, since a CI audit found the reports had no reader, without
coverage instrumentation at all. The macOS lane wrote a coverage.xml that the
Codecov upload (gated to Linux/3.13) never took and no gate consulted; the slow
lane wrote a coverage-slow.xml that nothing anywhere read. Both were dropped and
every test kept: instrumentation costs ~60% wall time, so collecting a measurement
with no consumer is the one kind of coverage work that is pure loss. If you add
coverage collection to a lane, give it a consumer in the same change — an upload,
an artifact, or a gate.
COVERAGE_CORE=sysmon is requested on the unit-test job and in scripts/verify.py's
unit-pr step, but it is inert: branch = true applies to every lane and
sys.monitoring cannot measure branches before Python 3.14, so coverage.py warns and
falls back to CTracer. It is left in place because it becomes live unchanged if the
coverage lane moves to 3.14; tests/test_coverage_core_effectiveness.py fails if that
disagreement stops being stated where the setting is. Moving the canonical lane to
3.14 to make it live is a separate decision — it also moves repo_facts.json's
canonical_python and the ai-readiness job's pin.
If the macOS lane ever fails on coverage, the fix is to keep the gate Linux-scoped — do not lower the global 80% floor to make another platform pass.
scripts/verify.py — full contract (M0-3)¶
The fast profile is the everyday inner loop, but it is not
the definition of "ready for PR" — the canonical CI unit lane runs golden
tests and enforces a 80% coverage floor that the fast profile
deliberately skips. scripts/verify.py is the single executable
orchestrator every consumer (pixi, pre-commit, CI, this file) calls through,
so the local and CI definitions of done cannot silently diverge again:
python scripts/verify.py --profile fast # everyday inner loop (lint, format, mypy, fast unit tests)
python scripts/verify.py --profile pr # exact CI-equivalent PR gate (incl. golden + coverage floor + ai-readiness)
python scripts/verify.py --profile full # + external-tool/parity/performance lanes, skipped where the environment lacks the tool
python scripts/verify.py --profile pr --list # show the steps a profile runs, without running them
python scripts/verify.py --profile pr --only lint,typecheck # run a subset
python scripts/verify.py --profile pr --json receipt.json # machine-readable pass/fail/skip receipt
Before opening a PR, run --profile pr (or pixi run check, which calls
the identical command) — not just the fast profile.
tests/test_verify_profiles.py asserts that pixi run check,
.pre-commit-config.yaml, and .github/workflows/ci.yml all route through
scripts/verify.py's step catalog rather than keeping independent copies of
these commands; if you change a check, change it in scripts/verify.py and
let that test tell you what else needs updating.
The bugfix-test-contract step is the one gate CI can run more of than a
local shell can: its declared half reads the pull request's body. A local run
without BUGFIX_CONTRACT_BODY_FILE set still performs the structural half and
then exits 2, which verify.py records as a skip — so the pr profile
marks the run incomplete rather than letting it claim parity with a CI job
that can still fail on the body afterwards. A real structural finding is
still exit 1, so it can never be laundered into "partial". Point that variable at a file holding the PR
description to run the whole gate locally.
pip install -e ".[dev]" alone is not full pr-profile parity. The
docs-build step needs mkdocs (pip install -e ".[dev,docs]") and the
distribution-build step needs build/twine (pip install -e ".[dev,dist]")
— neither is in bare [dev], matching the CI lint-and-types/fair-metadata
jobs' separate installs. Run pip install -e ".[dev,docs,dist]" for full
parity. verify.py never silently claims success when its own step is
skipped for a missing tool: a pr-profile run with any step-level skip
prints an explicit WARNING: this pr-profile run is INCOMPLETE line and
sets "complete": false in the --json receipt — don't treat a
skip-containing run as equivalent to a clean CI pass.
The pr profile also runs complexity-bench (scripts/complexity_bench.py
--strict): an empirical time-exponent ceiling per hot path, run in CI's
ai-readiness job. A failure there, or in the unit lane's whole-package
repeat-call ratchet (tests/test_compare_repeat_audit.py), is triaged as
described in performance.md.
pixi is also supported (pixi install && pixi run test,
pixi run check) and additionally manages the castxml/compiler/libabigail/
abi-compliance-checker system tools for the integration/libabigail/abicc
marker lanes below — see [tool.pixi.*] in pyproject.toml and
CONTRIBUTING.md. Unlike bare pip install -e ".[dev]", pixi's default
environment includes the docs and dist features too, so pixi run check
is complete out of the box. Prefer pip install -e ".[dev]" above when pixi
isn't available in your environment (add ,docs,dist for full parity).
Toolchain canaries (toolchain-canary.yml)¶
The required lanes pin every external tool to a version CI installs today, so a
new release of a tool abicheck parses output from is first noticed by a field
report. The canary workflow runs the integration marker suite (the same
scripts/verify.py --profile full --only integration step integration.yml
runs) against the newest release of one tool at a time:
| Leg | Newest tool under test | Runner | Baseline for the other tools |
|---|---|---|---|
castxml |
Newest CastXML Superbuild release, resolved from the GitHub API (authenticated with github.token) and verified by the asset's reported SHA-256 digest; an asset with no digest, or a non-sha256 one, fails the leg with its own error |
ubuntu-24.04, 2 shards |
runner's default GCC; no pinned castxml needed |
gcc |
Newest GCC release on conda-forge (gcc/gxx, checked against conda-forge's index), installed with the pinned micromamba setup_dev_env.sh uses |
ubuntu-24.04, 2 shards |
pinned castxml via setup-castxml |
xcode |
Newest released Xcode installed on the runner (sort -V over /Applications/Xcode_<ver>.app; _beta and _Release_Candidate bundles excluded) and its Apple clang |
macos-26, the newest GA label (named explicitly, not macos-latest) |
the conda-forge castxml 0.8.0 build integration.yml pins |
Each leg changes one tool, so a red leg points at that tool. The step summary
records the versions each leg actually ran, and the leg fails if its own tool
is not the one actually used: the castxml leg checks PATH; the gcc leg checks
that CC/CXX (exported via $GITHUB_ENV) and gcc, cc, g++, c++ on
PATH all resolve to the conda-forge GCC and report its exact version; the
xcode leg checks xcode-select -p, DEVELOPER_DIR, and that xcrun resolves
clang, clang++, cc and c++ inside the selected Xcode. Every leg,
including xcode, runs with ABICHECK_MIN_EXECUTED=20, so a leg that silently
skips the suite fails.
Why betas and RCs are excluded from the xcode leg. A beta Xcode is not
what abicheck's users build releases with, its breakage is often fixed before
GA, and a red leg from it would be noise to triage. The leg picks the newest
released Xcode the image carries; when a newer macOS runner label goes GA, bump
os: in the matrix.
Non-blocking, by construction. The workflow triggers only on
schedule (Tuesday 05:23 UTC) and workflow_dispatch. It has no
pull_request or push trigger, so it is never a PR check and cannot become a
required one. Failing legs stay red so they show in the Actions tab; there is no
continue-on-error. Each failing leg uploads its verify.py log
(canary-<tool>[-shardN].log, 30-day retention). The canary jobs use
contents: read and github.token only, no secrets. A failing scheduled run
opens one tracking issue titled Toolchain canary failing, or comments on it
if it is already open; the notify job that does this is the only job with
issues: write. A failing manual dispatch opens nothing: whoever started it is
watching. Runs share one concurrency group per ref and queue rather than cancel
each other. Nothing here changes an existing lane, a required check, or an exit
code.
Known limits, so a red leg is read correctly:
- GCC is the newest conda-forge release, not trunk. conda-forge's GCC is a packaged release built against its own sysroot, not Ubuntu's toolchain; a red gcc leg that does not reproduce with the same GCC version built another way may be a packaging difference. GCC trunk is out of scope.
- The castxml leg gives two separate answers. The integration suite runs
with
ABICHECK_ALLOW_UNSUPPORTED_CASTXML=1, so a release pastMAX_CASTXML(abicheck/extract/headers/castxml/policy.py, currently>=0.6.11,<0.9.0) still shows output-format drift. A separate step runs without the override and asserts the version gate's answer: refused withUnsupportedCastxmlVersionErrorwhen the release is outside the range, accepted when inside, with the expected answer computed from the bare version numbers. A red integration step is drift; a red policy step is the gate answering wrongly. - The digest is the only check on a "newest" artifact. Pinned lanes compare a SHA-256 written into the repo. The canary can only check the digest GitHub reports for the asset, so a compromised release would pass the digest check. The leg is non-blocking and runs against released assets only.
Triage: who looks and what to do. The owner is the maintainers: the tracking issue a failing scheduled run opens is theirs to triage, and a failed manual dispatch belongs to whoever ran it.
- Classify the leg. Read the step summary for the versions that ran, and the
canary-*.logartifact for the first failing test. Rerun the failed leg once. A red rerun is a real failure. A green rerun is a flake: note it in the PR or issue that follows, and stop. - Reproduce locally with the tool version the leg ran, first on
PATH. Then runpython scripts/verify.py --profile full --only integration. For castxml, use the tarball named in the summary. For GCC, put the samegcc-N/g++-Nfirst onPATH. For Xcode,xcode-select -sthe Xcode the summary names. Confirm the same test fails with the same message. - Decide what the failure is, and fix the cause, not the test:
- abicheck reads the new output wrongly (a changed AST shape, a changed
--versionstring, a layout that moved): fix it in the owning module with a regression test that covers the bug class, not only the reported input (AGENTS.md "Test the bug class"), and add a changelog fragment. Model it on the clang 22 fixes (#1921, #1929). - a tool release changed a behaviour abicheck relies on, on purpose: adapt the code, and note the new supported range in the code and docs that name it.
- the newest CastXML is outside the supported range: this is a policy
decision, not a bug. Open it as a plan or ADR (
docs/contribute/adr/) that movesMAX_CASTXML, with a canary run as the evidence. Do not widen the range in a drive-by PR. - the runner image or the leg's setup changed: fix
toolchain-canary.yml. - If it cannot be fixed in the same pass, record it in
known-gaps.mdwith a status line (OPEN/PARTIAL), and aknown_gap_canarytest that asserts the current answer, which theknown-gap-canariesgate requires. The entry names the run that found it. Do not reach forxfailto hide the leg. - Close it when a fix merges and a later canary run is green on that leg.
Move the entry to the archive with a CLOSED status line, and turn the canary
into a regression test. Close the
Toolchain canary failingissue once a scheduled run is green on every leg; the next red scheduled run opens a new one.
The canary is never the only evidence for a fix. Reproduce it in the normal PR
gate first, and do not add a pull_request trigger to this workflow to make
triage easier: a PR-triggered run would make a weekly signal a merge gate.
Reading CodeFactor findings on a PR¶
CodeFactor's check run links to https://www.codefactor.io/repository/github/abicheck/abicheck/pull/<N>.
The page is public, but CodeFactor answers 403 to curl's default User-Agent.
That 403 comes from CodeFactor, not the agent proxy, so do not reconfigure the
environment. Send a browser User-Agent instead. The findings are embedded in
the page as JSON in app.value('model', {...}), under Issues.List (an empty
list means no new issues):
UA='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0 Safari/537.36'
curl -sS -A "$UA" https://www.codefactor.io/repository/github/abicheck/abicheck/pull/<N> -o pr.html
python3 -I - pr.html <<'PY'
import json, sys
t = open(sys.argv[1]).read()
i = t.index("app.value('model', ") + len("app.value('model', ")
model, _ = json.JSONDecoder().raw_decode(t, i)
print(json.dumps(model["Issues"]["List"], indent=1))
PY
Issues fixed by the PR are listed at .../pull/fixed/<N> (FixedIssuesUrl).
Known mypy issues¶
CI runs mypy abicheck/ as a required gate. The baseline is currently 0 errors — the previously-documented 26 errors were all unused-ignore / no-any-return / misc warnings on third-party calls (pyelftools, click). They are suppressed in pyproject.toml via per-module disable_error_code overrides, which keeps the file portable across mypy releases without churning the underlying # type: ignore comments.
Your responsibility: run mypy abicheck/ after your changes and ensure it stays clean. If a new third-party suppression is needed, extend the existing disable_error_code override for that module rather than scattering ad-hoc # type: ignore comments. If you legitimately reduce a real error to zero, leave MYPY_ERROR_BASELINE = 0 in scripts/check_ai_readiness.py — it now warns on drift in either direction.
ADR surface traceability (adr-surfaces)¶
ADR-076:
scripts/check_adr_surfaces.py (a verify.py pr step, CI ai-readiness
job) keeps docs/contribute/adr/adr-surface-registry.yaml honest. Update it
in the same PR when you:
- add an ADR — add its entry (
surfaced/partial/gapwithmissing, orinternalwithreason), and theuse_casesit serves; - add, rename or remove a CLI flag, Action input, API symbol or report field an ADR cites — the gate resolves every surface against the code and fails where a cited one no longer exists;
- change a use case — each UC carries
user_task:(pr_review,local_check,release,audit) andadrs:, which must mirror the registry; - add a scenario — declare the
surfaces:itsflowcommand actually exercises (checked against that command line) and, for a use case reachable from cli+api+action, a sharedfamily:.
The gate ratchets against docs/contribute/adr/adr_surface_baseline.json: a
disposition downgrade, a lost surface or use case, a newly untraced ADR
surface, or a newly uncovered multi-channel use case fails. If the change is
deliberate, run python scripts/check_adr_surfaces.py --write-baseline and
commit the rewritten baseline in the same PR so review sees it. The generated
coverage report is docs/contribute/generated/adr-surface-coverage.md
(--write-report).