Skip to content

test: gate the Justfile test recipe against tests/ — tests/test_suite_registration.bats - #1166

Merged
castrojo merged 1 commit into
mainfrom
quality/test-suite-registration-gate
Sep 23, 2026
Merged

castrojo merged 1 commit into
mainfrom
quality/test-suite-registration-gate

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Claimed ground: Justfile (the test recipe and its comment block only) and the new tests/test_suite_registration.bats. No other file is touched.

The hole

tests/test_image_repo.bats — 93 lines, 12 assertions over system_files/shared/usr/libexec/ublue-image-repo, the single source of truth for image-name/tag → upstream GitHub repository routing consumed by bonedigger-report — is named in neither the Justfile test recipe 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

  • Register tests/test_image_repo.bats in the test recipe.
  • Add tests/test_suite_registration.bats (7 assertions), which fails when:
    • a tests/test_*.bats or tests/test_*.py is neither registered in the recipe nor declared excluded,
    • the recipe names a suite that does not exist on disk,
    • an exclusion comment names a suite that no longer exists,
    • an exclusion states no reason,
    • the gate or test_image_repo.bats falls out of the recipe.
  • Move the two intentional omissions into that machine-checkable form, # <file> is excluded — <reason>: test_libvirt_helper.bats (requires a running libvirtd session) and test_shared_just.bats (its bctl delegation cases are red).
  • Register the gate itself.

Verification (at 44b4b9f, bats 1.14.0)

$ bats tests/test_suite_registration.bats tests/test_image_repo.bats
1..19
ok 1 registration: the Justfile test recipe is parseable and non-empty
...
ok 19 image-repo: consumers do not hardcode upstream repo routing

Each drift mode was confirmed to actually fail the gate, not merely pass vacuously:

injected drift result
drop test_image_repo.bats from the recipe not ok 2 — suite never runs — add it to the Justfile test recipe or declare it excluded: test_image_repo.bats
add bats tests/test_nonexistent.bats not ok 3 — Justfile test recipe names a suite that does not exist
strip the reason from an exclusion not ok 5 — exclusion without a reason

just check passes, and just --list still shows the test recipe's original summary line.

Deliberately out of scope

Related Issue

Closes #1165


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5

@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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 outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@Danathar Danathar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Danathar Danathar removed the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2026
@Danathar

Copy link
Copy Markdown
Contributor

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.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style

  • recipe_block (tests/test_suite_registration.bats:20-28) collects every top-of-column # comment that appears anywhere above test: in the Justfile, not just the contiguous block over the recipe. It works today only because test: is the first recipe (Justfile:8); if a documented recipe or file-header comment mentioning test_*.bats is excluded is ever added above it, that text silently feeds the exclusion list. Anchoring the awk to the contiguous comment block directly above test: would remove the trap. (low)
  • present_suites (tests/test_suite_registration.bats:38-40) uses GNU find -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>
@castrojo
castrojo force-pushed the quality/test-suite-registration-gate branch from 7ed073d to 5dfabbc Compare September 23, 2026 01:42

@castrojo castrojo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Rebased cleanly onto main, registered test_shared_just.bats alongside test_image_repo.bats and verified test_suite_registration.bats passes 7/7.

@castrojo
castrojo enabled auto-merge September 23, 2026 01:42
@castrojo
castrojo added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit fd5d23e Sep 23, 2026
10 checks passed
@castrojo
castrojo deleted the quality/test-suite-registration-gate branch September 23, 2026 01:55
pull Bot pushed a commit to joshyorko/common that referenced this pull request Sep 26, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] test-infrastructure: tests/test_image_repo.bats runs in no runner, and nothing detects the next unregistered suite

2 participants