[architect] refactor: self-enforcing Python test gate — new tests/test_catalog_gate_coverage.py, delete obsolete tests/test_renovate_atomic.py - #227
Open
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…ing; drop obsolete tests/test_renovate_atomic.py image-catalog.yml is the only Python test gate and it enumerates filename patterns rather than discovering tests/. A module matching none of them is silently never run and nothing reports the gap. tests/test_renovate_atomic.py lived in that gap since 2afc250. Run in isolation all three of its assertions fail: they describe the superseded buildah-only git-refs Renovate manager, not the generalised annotation manager renovate.json now implements. Remove it as dead code. tests/test_catalog_gate_coverage.py closes the hole from inside the gate: it collects every 'unittest discover -s tests -p' pattern invoked by the Justfile and the workflows and asserts the union reaches every tests/test_*.py, and that CI coverage is never narrower than local. Refs #226 Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
Claimed ground — exactly two files, both under
tests/:tests/test_catalog_gate_coverage.pytests/test_renovate_atomic.pyNo workflow, no
Justfile, noelements/, noscripts/, nocatalog/file is touched.Cluster: the Python test-gate reachability cluster (issue #226).
Disjointness against every open hold-gated PR on this repo:
tests/test_catalog_conformance.py,elements/targets.jsonimage_pathsownership. Different file, different invariant.tests/test_catalog_load_record.py,tests/test_generated_elements_cli.py.Different files; both already match committed patterns, so this PR asserts nothing new
about them.
Justfile,tests/test_donate_clanker_bootstrap.py.Justfile,tests/test_skill_index.py.Both add a new
Justfilerecipe; this PR edits noJustfileline, so there is notextual or semantic conflict in either direction.
The structural problem
.github/workflows/image-catalog.ymlis the only workflow that runs Python tests, andit does not discover them. It enumerates three filename patterns, one
unittest discover -pstep each, and restates the same three in itspaths:filter twice and in thecatalog-checkJustfilerecipe — nine restatements of one list.Suite membership is therefore decided by how a file is spelled, not by the fact that it
lives in
tests/. A module matching none of the three is silently never executed andnothing reports the gap. That is a fail-open gate.
tests/test_renovate_atomic.pywas already in the gap:Why the file is deleted rather than repaired
Added in
2afc250and never run since. Executed in isolation, all three assertions fail— and each one fails because it describes a design that no longer exists:
managerFilePatterns == ["/(^|/)elements/buildah/buildah\\.bst$/"]["/\\.bst$/", "/^Justfile$/"]matchStrings[0]has acurrentDigestgroup;datasourceTemplate == "git-refs"IndexError: no such groupkind: remotesource may not carry# renovate:elements/falco/falco.bstlegitimately doesrenovate.jsonwas deliberately generalised from a buildah-onlygit-refsmanager toone covering any
# renovate:-annotated value in any.bstor theJustfile. Theguard did not catch that generalisation — it could not — and has carried a false green
since. It is dead code for a superseded design, not a stale test of a live one.
Why enforcement lives in
tests/and not in the workflowThe correct fix is one total
discover -s tests -p 'test_*.py'inimage-catalog.yml.This agent's App token has no
workflowspermission, so that push is rejected at theremote. Rather than leave the hole open,
tests/test_catalog_gate_coverage.pyclosesit from inside the gate: it is named to fall under the existing
test_catalog*.pypattern, so it runs today, unmodified workflow and all.
It parses every
unittest discover -s tests -p '<glob>'invocation out of theJustfileand every
.github/workflows/*.yml, unions the patterns, and asserts:tests/test_*.pyon disk is matched by at least one committed pattern —an unreachable module now fails CI instead of disappearing into it;
Justfilerecipe but by no workflow — a green local runcan never be broader than the merge gate;
test_renovate_atomic.pyis ever restored, it must be restored reachable, so aplain revert cannot quietly recreate a dead test. (Skips while absent.)
Assertion 1 also converts the recurrence risk into a build failure: the allowlist has
been growing one pattern per PR, and a PR that forgets is currently invisible.
The workflow simplification in recommendation 1 of #226, and the
Justfilecatalog-checkdivergence in recommendation 4, remain open for a human or an agent withworkflowsscope. #226 also records recommendation 3 — nothing now proves thecustom.regexmanager matches a committed element, which is genuine lost coverage andwarrants a replacement conformance test written against the current contract.
Verification
Mutation-checked — each assertion confirmed to actually fail:
tests/test_renovate_atomic.pyverbatim →"tests/ modules matched by no discovery pattern...
['test_renovate_atomic.py']"and "it is back but still matches no discovery pattern; it would not run, exactly as
before" (2 failures)
Justfile-only recipe-p 'test_localonly*.py'plus a matching module →"modules run by a Justfile recipe but by no workflow: they gate nothing on a pull
request" (1 failure)
Both mutations were reverted; the diff is the two files above.
One stale prose reference to the deleted file survives in
docs/superpowers/plans/2026-08-21-image-catalog-generation.md, a dated historical planartifact. It is left untouched deliberately so this PR claims no ground outside
tests/.Refs #226
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-opus-5