Repository navigation
test: gate the Justfile test recipe against tests/ — tests/test_suite_registration.bats - #1166
Conversation
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
Danathar
left a comment
There was a problem hiding this comment.
Reviewed at head 7ed073d. This adds a bats gate that checks every tests/test_.bats and tests/test_.py file is either named in the Justfile test recipe or declared excluded with a reason, and it registers the two suites that were missing (test_image_repo.bats and the gate itself). I diffed the tests/ directory against the recipe on main and got exactly the four unregistered files the PR accounts for: test_image_repo.bats and test_suite_registration.bats are now in the recipe, test_libvirt_helper.bats and test_shared_just.bats are excluded with reasons. I confirmed the test_shared_just.bats reason is true: at this head, bats tests/test_shared_just.bats fails its two bctl delegation cases (tests 2 and 3) and passes the rest. I ran bats tests/test_suite_registration.bats (7/7 pass) and bats tests/test_image_repo.bats (12/12 pass), and tried two negative cases: an unregistered tests/test_zzz_fake.bats makes test 2 fail with the file named, and stripping the reason from the exclusion comment makes test 5 fail. Every other bats line in the recipe also passes locally at this head; the only red one is test_setup_scripts.bats, which fails identically on main in my environment and passes in CI, and this PR does not touch it. One note for later, not a blocker: .github/workflows/unit-tests.yml lists suites by hand and does not call this gate, so it only protects just test until CI is switched to it (issue #1105 covers that drift).
|
Hold removed: this was the Hive's ACMM level gate, which I operate, and the PR has a human approval with CI green. Ready for a maintainer to merge. |
There was a problem hiding this comment.
style
recipe_block(tests/test_suite_registration.bats:20-28) collects every top-of-column#comment that appears anywhere abovetest:in the Justfile, not just the contiguous block over the recipe. It works today only becausetest:is the first recipe (Justfile:8); if a documented recipe or file-header comment mentioningtest_*.bats is excludedis ever added above it, that text silently feeds the exclusion list. Anchoring the awk to the contiguous comment block directly abovetest:would remove the trap. (low)present_suites(tests/test_suite_registration.bats:38-40) uses GNUfind -printf, so the gate errors on BSD/macOS find. Repo tooling is Linux-oriented, so info only.
Verified at head 7ed073d: the gate passes 7/7 and the newly-registered tests/test_image_repo.bats — never previously executed by any runner — passes 12/12 with bats 1.12, so registering it does not break just test. All 41 tests/test_* files are accounted for (39 registered, 2 excluded with reasons, Justfile:3-4). The # Run unit tests… docstring stays immediately above test: (Justfile:7), preserving just --list output.
No findings from: correctness, security, intent-alignment, docs-currency.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78
…_registration.bats tests/test_image_repo.bats (12 assertions over ublue-image-repo, the image-name/tag to upstream-repo resolver consumed by bonedigger-report) is named in neither the Justfile test recipe nor any workflow, so no runner ever executes it. The recipe is maintained by hand with nothing checking it against the contents of tests/, so the next suite can be orphaned the same way. Register test_image_repo.bats, and add a drift gate that asserts every tests/test_*.bats and tests/test_*.py is either named in the test recipe or declared excluded above it as '# <file> is excluded — <reason>'. The gate also rejects a recipe entry with no file on disk, an exclusion naming a file that no longer exists, and an exclusion with no stated reason. The two intentional omissions are moved into that machine-checkable form: test_libvirt_helper.bats (requires a running libvirtd session) and test_shared_just.bats (bctl delegation cases are red; repair tracked separately). Verified at 44b4b9f with bats 1.14.0: 7/7 gate assertions and 12/12 test_image_repo assertions pass, and the gate was confirmed to fail on each of the three drift modes it claims to catch. Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
7ed073d to
5dfabbc
Compare
castrojo
left a comment
There was a problem hiding this comment.
LGTM. Rebased cleanly onto main, registered test_shared_just.bats alongside test_image_repo.bats and verified test_suite_registration.bats passes 7/7.
## What does this change? Run all 44 maintained unit suites in CI by registering the 18 currently missing suites, installing `jsonschema` and `just`, and triggering tests for all script changes and changes to the workflow itself. Keep script/config pytest execution separate from the unchanged Bazaar coverage gate. Update the testing contract and workflow skill with the registration requirements. ## Why? Closes projectbluefin#1167. Both prerequisite PRs projectbluefin#1106 and projectbluefin#1166 are merged, so this includes `ujust` and `ublue-image-repo`; the registration gate was already wired into CI. It also includes suites added since the issue was filed. `test_bazaar_hook.py` was removed in projectbluefin#1155 and is intentionally not referenced. ## Validation - All 44 on-disk suites match the workflow registrations; no dangling references. - Added Python suites: 42 passed. - Added Bats suites plus registration gate: 172 passed, 1 skipped because local `zsh` is unavailable (CI installs it). - Existing coverage command: 73 passed, 94.37% coverage (80% required). - `just check`, `pre-commit run --all-files`, and `actionlint .github/workflows/*.yml` passed. - Skill and testing documentation updated; internal links validated by pre-commit. CI results will be reviewed after the PR opens; no image content changed. — hive: backend=codex model=gpt-6-astra effort=medium --- 🐝 **Hive Agent**: `contributor` | **SHA:** `b7965a6` --------- Signed-off-by: arteeh <arteeh@users.noreply.github.com> Co-authored-by: arteeh <arteeh@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: castrojo <castrojo@users.noreply.github.com>
Test Improvement
Claimed ground:
Justfile(thetestrecipe and its comment block only) and the newtests/test_suite_registration.bats. No other file is touched.The hole
tests/test_image_repo.bats— 93 lines, 12 assertions oversystem_files/shared/usr/libexec/ublue-image-repo, the single source of truth for image-name/tag → upstream GitHub repository routing consumed bybonedigger-report— is named in neither theJustfiletestrecipe nor any workflow. No runner has ever executed it. It is green; it just never runs.The recipe is maintained by hand and nothing compares it against
tests/, so the next suite can be orphaned the same way.The change
tests/test_image_repo.batsin thetestrecipe.tests/test_suite_registration.bats(7 assertions), which fails when:tests/test_*.batsortests/test_*.pyis neither registered in the recipe nor declared excluded,test_image_repo.batsfalls out of the recipe.# <file> is excluded — <reason>:test_libvirt_helper.bats(requires a running libvirtd session) andtest_shared_just.bats(its bctl delegation cases are red).Verification (at
44b4b9f, bats 1.14.0)Each drift mode was confirmed to actually fail the gate, not merely pass vacuously:
test_image_repo.batsfrom the recipenot ok 2—suite never runs — add it to the Justfile test recipe or declare it excluded: test_image_repo.batsbats tests/test_nonexistent.batsnot ok 3—Justfile test recipe names a suite that does not existnot ok 5—exclusion without a reasonjust checkpasses, andjust --liststill shows thetestrecipe's original summary line.Deliberately out of scope
tests/test_shared_just.batsis not repaired here. Its two redbctldelegation cases are test: repair broken-at-birth bats suites (test_ujust mock brew, powerwash bctl) #1106's ground; this PR only records the omission with a reason so the gate is green without silently hiding it. When test: repair broken-at-birth bats suites (test_ujust mock brew, powerwash bctl) #1106 lands, the exclusion can be swapped for a registration and the gate keeps passing either way..github/workflows/unit-tests.ymlruns 27 of the 40 suites intests/and never invokesjust test, so 13 maintained suites never execute in CI. That fix lives inside.github/workflows/, which this agent cannot push, and is filed separately.Related Issue
Closes #1165
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5