Skip to content

S5: two proofs that prove nothing — a tautology, and the untested reason a module exists #246

Description

@Polichinel

Part of the #241 epic. Registers C-90. Related to #245.

Problem

Two guards in this arc are defended by proofs that cannot fail.

1. The partition's mutation proof is a tautology. tests/test_env_declaration.py:890:

base = {name: {} for name in _TABLE_ROLE}
...
assert not _unclassified_tables(base), "the real registry's tables must all classify"

_unclassified_tables is sorted(set(registry) - set(_TABLE_ROLE)), and base is built from _TABLE_ROLE. The expression reduces to the empty set for every possible value of _TABLE_ROLE and every possible upstream registry. Mutation-proven: deleting "edition": "IGNORED" from _TABLE_ROLE — the live registry does carry an [edition] table — failed test_every_table_in_the_registry_is_classified_here while this assertion passed.

Its message compounds it: "the real registry's tables must all classify" asserts a fact about a file this test never opens. A maintainer reading it believes the live registry is validated here. The only thing that validates it skips whenever the sibling is absent. This is decoration inside the test whose own docstring is about removing decoration (ADR-014 §2).

2. registry_current has no test. tests/seam_registry.py:113. The module was extracted for exactly one reason: two copies of the reader disagreed about whether to read the sibling's main or its working tree, and reading the working tree is issue #196 verbatim — the case that cost this platform a withdrawn pull request. The function that settles it is called by five tests and is the subject of none.

Mutation-proven with coverage: replacing its body with rev-parse HEADregistry_at(repo, sha) — the defect it exists to prevent — leaves the suite at its exact baseline. Lines 86-90 (git show non-zero), 99-103 (the tomllib except) and 135-139 (if not head) are executed by nothing; deleting the try/except and deleting the returncode guard both stay green. test_the_pinned_reader_refuses_every_way_a_baseline_can_be_wrong only ever calls registry_at, and its scratch repo writes valid TOML at every commit, so git show cannot fail and only valid TOML is ever parsed.

Work

  1. Replace the tautology with an assertion that actually varies, or delete it and let test_every_table_in_the_registry_is_classified_here carry the guarantee alone — with its gating stated honestly (it skips without the sibling; say so where the reader will look).
  2. Give registry_current its own test against a scratch repository with a main, an origin/main, and a working tree that differs from both. Assert it reads main, not the checkout's current ref.
  3. Extend the scratch-repo scenarios so registry_at's unreached branches are reached: a commit where the registry path is absent (git show non-zero), a commit where it is not valid TOML, and a repository with neither main nor origin/main.
  4. Record coverage of tests/seam_registry.py before and after in the pull request.

Acceptance criteria

  • Every assertion in test_the_partition_is_directional_and_bites fails under at least one mutation of the function it names.
  • Replacing registry_current with a working-tree or HEAD read fails at least one test, demonstrated.
  • Every raise RegistryReadError branch in seam_registry.py is executed by at least one test.
  • No assertion message claims a fact about a file the test does not open.

Implementation notes

Story #245 may change what the partition asserts. Sequence this after it, or coordinate — the tautology sits directly on the code S4 touches.

The scratch-repo helper needs the hardening from #247 before it grows more scenarios; check whether that has landed first.

Testing

pytest -q tests/test_env_declaration.py. Coverage via sys.settrace or coverage run --include='tests/seam_registry.py'.

Labels

story, testing

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyA single reviewable unit of an epictestingTest/parity/validation work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions