Skip to content

test(harness): add a release gate that gives one verdict per commit - #937

Merged
TheWitness merged 11 commits into
Cacti:developfrom
somethingwithproof:chore/release-gate-harness
Dec 4, 2026
Merged

TheWitness merged 11 commits into
Cacti:developfrom
somethingwithproof:chore/release-gate-harness

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Problem

There is no single check that a plugin commit is ready to release. Defects have reached tags that only an install, an upgrade, a page crawl or a translation run on PHP 8 would have shown.

Fix

Adds a release gate in tests/harness/: a runner (gate.py), a manifest of 13 suites in seven tiers, the scripts they run, and a manual workflow in its own commit so it can be dropped. No production code changes; the only existing file touched is .gitignore. The gate follows the design proposed for Cacti core and leaves out core-only tiers and checks.

Verification

Not covered: JavaScript errors, nginx or Apache (the web container is PHP's built-in server), SNMP devices, alert delivery, remote pollers, non-admin users, upgrades from tags older than the latest one. The workflow file has not been run on GitHub.

Fixes #936

…ommit

Runs the suites a manifest lists, keeps a log per suite and writes
report.json and report.html with one verdict: pass, fail or incomplete.
A suite that did not run never counts as a pass. The release profile
refuses a tree with uncommitted changes. --tree judges another checkout,
such as a worktree of a release tag.

The runner follows the one in Cacti core so the two are recognisably one
design; its tiers are the ones a plugin release needs.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…crawl

package.py compares the INFO version with the CHANGELOG top entry and lists
the development files a release archive would hold. i18n.py compares the
committed template with a regenerated one, checks that each translation keeps
its source string's format specifiers, and lists every format string to run
through sprintf. live.py logs in to a running Cacti, crawls the pages the
plugin registers, checks that its source's tables, hooks and realms are in
the database, and reads cacti.log for errors.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
… containers

Pest runs on every PHP in the plugin's CI matrix with the locked harness and
Cacti 1.2.x that CI uses; php -l runs on the oldest and newest. The template
is regenerated with the xgettext command from build_gettext.sh, and every
format string runs through sprintf on PHP 8, where a trailing or unpaired
percent sign throws. Nothing is installed on the machine running the gate.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…1.2.x

Starts MariaDB and Cacti in containers named tholdgate-*, with passwords
generated into files at run time. Installs the plugin from the tree and checks
what it registers; upgrades a database installed from the latest earlier
release tag and compares the plugin's schema with a fresh install's; crawls
every plugin page and tab and draws a graph with a percentage threshold's
HRULE colour.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Thirteen suites in seven tiers: static, unit, i18n, integration, upgrade, ui
and package. A test checks that every tier has a blocking suite, so a release
verdict can pass, and that every script the manifest names exists.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
workflow_dispatch only, with read-only permissions, pinned actions and no
secrets. Kept in its own commit so it can be dropped.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ler before an upgrade

The PHP 8.6 image has no mbstring, which Pest's output needs. The upgrade
suite replaced plugin files while the poller's background processes were
loading them, which logged errors no administrator could reproduce; it now
waits for them and turns off the installer's network discovery. A tag from
before the plugin had a CI workflow is judged on today's PHP matrix.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
… unit suite

The plugin's file permission test skips itself as root, so the container user
hid it. A tag with no phpunit.xml now fails with a message instead of a Pest
usage error.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Comment thread tests/harness/docker/Dockerfile Fixed
somethingwithproof and others added 2 commits December 4, 2026 02:23
- discard the sprintf result explicitly; only whether it throws matters
- default the image to an ordinary user and start only the live web
  container as root
- use [[ ]] in the bash suites
- keep the harness cache and results out of php -l, and report every
  file that fails to parse instead of stopping at the first
- stop macOS tar adding ._ metadata files to the plugin copy
- make the work directory that holds the generated passwords private
- document that the log check is deliberately broad and that missing
  realm files are a note

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Judging an older release (--tree <worktree of v1.8.1>) listed every v* tag,
so the upgrade suite could start from a newer release and test a downgrade.
List only the tags merged into HEAD.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

@TheWitness TheWitness 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. The workflow is workflow_dispatch only, with contents: read, no secrets and no pull_request_target; inputs reach run: only through quoted env:. All three actions are pinned by SHA at their latest releases (checkout v7.0.1, setup-python v7.1.0, upload-artifact v7.0.2). gate.py never uses shell=True. A suite that times out, fails to start or doesn't run never counts as a pass, and any old report is cleared before a run. One fix pushed as b647e38: from-tag listed every v* tag, so judging an older release (--tree of v1.8.1) would have 'upgraded' from v1.8.2. It now uses git tag --merged HEAD. The 65 harness tests pass, and the Pest suite passes merged with current develop.

@TheWitness

Copy link
Copy Markdown
Member

Reviewed: no blocking issues apart from one fix, which I pushed as b647e38. from-tag listed every v* tag, so judging an older release with --tree pointed at v1.8.1 would have 'upgraded' from v1.8.2. It now uses git tag --merged HEAD. Checked: for a v1.8.1 tree the newest merged tag is v1.8.1, and for develop it is v1.8.2. The 65 harness tests pass, and CI is green.

I can't merge it from here: the repo rules need an approval from someone other than the last pusher (me), and the merge adds .github/workflows/release-gate.yml, which needs a token with workflow scope. @somethingwithproof or @xmacan, please approve; it can then be merged from the web UI.

@TheWitness
TheWitness requested a review from xmacan December 4, 2026 12:33
@TheWitness
TheWitness merged commit edcde7e into Cacti:develop Dec 4, 2026
7 checks passed
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.

Add a release gate runner that gives one verdict per commit

4 participants