Skip to content

test: unit coverage for the desktop contract gates — scripts/verify-desktop-contract.py + scripts/verify-gnome-extensions.py, new tests/test_desktop_contract.py [quality] - #96

Merged
hanthor merged 2 commits into
mainfrom
quality/test-desktop-contract-gates
Sep 18, 2026
Merged

hanthor merged 2 commits into
mainfrom
quality/test-desktop-contract-gates

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #95

Test Improvement

Adds tests/test_desktop_contract.py — 25 cases, the first coverage of either
desktop contract gate.

Claimed ground (files/functions), so the next comparison is mechanical:

What the tests pin down:

  • validate_contract names every missing section, rejects relative contract paths, an empty Flatpak app list, duplicate Flatpak IDs and a relative Brewfile; the shipped contracts/bluefin-desktop.toml validates clean.
  • read_os_release handles quoting, comments, blank lines and values containing =.
  • verify_values reports exact mismatches and missing keys, and uses full-match (not prefix) pattern semantics.
  • parse_brewfile preserves order, ignores non-flatpak lines, accepts indentation, and does not accept flatpak "id", args: ... lines as a bare app.
  • unit_enabled accepts only enabled/enabled-runtime with exit 0 — static, masked and non-zero exits fail — and invokes systemctl is-enabled <unit>.
  • main(--check) accepts the shipped contract, rejects a truncated one, and reads no image path (read_os_release/unit_enabled asserted not called), which is what makes it safe in source-only CI.
  • The GNOME gate passes on a complete tree, and fails on a missing extension, a shell-version without 51, or invalid metadata JSON — failing rather than raising. shell_versions substitutes the GSConnect @PACKAGE_VERSION@ placeholder and rejects metadata missing the key.

Discovery is the existing python3 -m unittest discover -s tests -p "test_*.py", so no runner or CI change is needed.

Verification: python3 -m unittest discover -s tests -p "test_*.py" — 52 tests, OK (27 pre-existing + 25 new).


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

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

…tract gates

scripts/verify-desktop-contract.py and scripts/verify-gnome-extensions.py
both gate builds -- the first from `just check` (--check) and from the
Containerfile against a composed image, the second for the bundled GNOME
extension set -- and neither had any unit coverage. A gate that stopped
rejecting anything would still have reported success.

tests/test_desktop_contract.py adds 25 cases over validate_contract,
read_os_release, verify_values, parse_brewfile, unit_enabled, the --check
path of verify-desktop-contract.main(), and verify-gnome-extensions
shell_versions()/main() driven through --root against a temporary tree.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

contract is red here for a repository-wide reason, not because of this PR's diff.

This PR adds one file, tests/test_desktop_contract.py. In the failing run those
tests pass — the job log shows Ran 52 tests in 0.299s ... OK, and the contract
gates it covers report desktop contract syntax is valid and
GNOME extension contract passed: 9 extensions declare GNOME 51.

The job then fails several steps later in just check-parity, on a diff against
packages/bluefin.toml that this branch never touches:

error: recipe `check-parity` failed with exit code 1
--- /tmp/tmp.2kXnzwmicZ
+++ packages/bluefin.toml
@@ -46,6 +46,7 @@
      "firewall-config",

That is the same parity drift tracked by the open PR #110
("fix(packages): restore bluefin.toml parity"). Nothing on this branch can turn
contract green while packages/bluefin.toml is out of parity on the base, so
this PR is deferred until that lands rather than retried here.

Run: https://github.com/projectbluefin/utah/actions/runs/35187193245/job/105091684090

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

@hanthor

hanthor commented Sep 18, 2026

Copy link
Copy Markdown
Member

@castrojo could you review/approve? Test-only addition (no production code touched); the ruleset needs an approval from someone other than the last pusher before it can be merged.


Generated by Claude Code

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed. Test-only: one new file, no production code, discovered by the existing runner. Ran it locally against the current tree — 29 tests pass — and read the contract job log: its 52 tests were OK; the only red was just check-parity, which is the main drift #110 just fixed. Updating the branch so CI re-runs on the repaired base, then merging.


Generated by Claude Code

@hanthor
hanthor merged commit aea0844 into main Sep 18, 2026
10 checks passed
@hanthor
hanthor deleted the quality/test-desktop-contract-gates branch September 18, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Filed or owned by the quality agent. hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] coverage-gap: both desktop contract gates (verify-desktop-contract.py, verify-gnome-extensions.py) have zero unit coverage

1 participant