INFO: set compat to 1.2.29 - #838
Merged
Merged
Conversation
TheWitness
requested review from
bmfmancini,
browniebraun,
cigamit and
xmacan
and
a balanced review from Copilot
September 30, 2026 02:50
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused metadata change matches the stated purpose and introduces no unresolved issues.
Review effort: Balanced
Findings: None
What changed in this PR
Raises the plugin’s minimum supported Cacti version to 1.2.32.
Changes:
- Updates the
compatmetadata from 1.2.25 to 1.2.32.
| File | Description |
|---|---|
INFO |
Updates minimum Cacti compatibility metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
browniebraun
previously approved these changes
Sep 30, 2026
added 3 commits
September 30, 2026 19:58
phpunit.xml ships in the repo for CI but is a dev-only test artifact, so it is removed from manifest.json 'expected', pruned from installs on upgrade (like tests/), and excluded from the manifest drift check. The retired markdown-lint configs (.mdlrc, .md_style.rb) are deleted, and .md* is now ignored like .git*: protected from pruning and excluded from drift if it reappears.
… css The main threshold library becomes includes/functions.php and the web API helper becomes includes/webapi.php; every caller (setup.php, includes/*, the CLI/poller/notify entry points and the test suite) loads them from includes/. Each per-theme stylesheet css/<theme>/main.css becomes css/<theme>.css so users can drop their own css/<theme>.css into the css base, and the page_head hook looks there. Old paths are tombstoned so existing installs drop the stale copies on upgrade.
Moving the plugin's library files into includes/ changed the source-reference lines in the translation template; regenerate it so the 'Verify translation template' CI check passes.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The compatibility floor is inconsistent and the prune guard can permit recursive deletion of the plugin root.
Review effort: Balanced
Findings: 1
Open (6)
Reject plugin-root paths during recursive deletion · New Update compatibility floor to 1.2.32 · New Update project tree from themes to css · New Update project map for relocated includes files · New Update alerting implementation documentation path · New Document upgrade and compatibility changes in changelog · New
added 6 commits
September 30, 2026 21:51
The HookFunctionsIncludeTest invokes real hooks with placeholder input purely to execute their relocated include_once lines; it now swallows engine notices/warnings/deprecations during those calls (and restores the error handler and config afterward) so it cannot trip the suite's failOnDeprecation or leak state into other tests. The RPN % and ^ operators now cast their operands to int explicitly, matching their long-standing integer-truncation behaviour while silencing the implicit float-to-int conversion deprecation.
The upgrade-time prune now rejects any tombstone containing '.'/'..' segments (which could escape the plugin directory or resolve to its root) and treats ancestors of whitelist entries as protected, so a tombstone on a parent directory can no longer delete a whitelisted file beneath it.
Point the structure tree at the relocated files (libraries now under includes/, data files under docs/, stylesheets under css/) and align the trailing '# ...' comments to a single column so they no longer drift right.
- Use the full license header (from the plugin's own setup.php) in tests/Unit/PruneFilesTest.php instead of the abbreviated copyright banner. - Document that the manifest drift check and the upgrade-time prune also handle phpunit.xml and .md* files, matching the implemented behavior.
The repository naming contract reserves the plugin_<name>_ prefix for plugin lifecycle / hook-registration functions; all other functions use the plain <name>_ prefix. Rename the internal upgrade helpers accordingly: plugin_<name>_prune_files() -> <name>_prune_files() plugin_<name>_rmtree() -> <name>_rmtree() The call site, unit tests, and the copilot-instructions.md references are updated to match. No behavioral change.
Align the compat metadata (and the contributor-guide references) with the team decision to standardize the minimum supported Cacti version at 1.2.29; the previously proposed 1.2.32 floor was not adopted.
cigamit
approved these changes
Oct 1, 2026
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.



Summary
Two changes for this plugin:
compat(minimum supported Cacti version) inINFOto1.2.29.manifest.json+ prune mechanism, and consolidates the per-themethemes/directory into the conventionalcss/directory.themes/→css/The per-theme
themes/<theme>/main.cssfiles are relocated tocss/<theme>/main.css(git mv, history preserved) to match the fleet convention, andthold_page_head()'s stylesheet reference is repointed tocss/. The retiredthemes/directory is recorded as a manifest tombstone so it is removed from an upgrading install. (TheSetupCspHooksTestfixture tree and assertion were updated to the newcss/path.)File manifest + upgrade pruning
manifest.jsonwithtombstones=["themes/"],expected(the current top-level tree; directories carry a trailing/), andwhitelist(empty — thold stores its data in the database, not under the plugin directory).thold_prune_files()(insetup.php, called from the version-change branch ofplugin_thold_upgrade()afterplugin_thold_install(true)) removes the tombstonedthemes/tree plus the dev-onlytests/tree on upgrade, refuses any path resolving outside the plugin directory (a tamperedmanifest.json), warns in the Cacti log on any file/directory it cannot remove, leaveswhitelist/.git*alone, and logs — without removing — any unaccounted top-level entry.tests/bin/validate-manifest.php(wired intoplugin-ci-workflow.yml) fails on drift betweenexpectedand the real top-level tree.tests/Unit/PruneFilesTest.phpplus an Integration case that drives the version-drift branch with the full reinstall short-circuited (via the install version guard) andbase_pathsandboxed to a throwaway tree, so the new prune call line is covered without needing a live Cactiinclude/database.php.Docs
README.md: extended the Threshold Daemon section with an upgrade note — restart thethold_daemonsystemd service after a file upgrade so the long-lived process picks up the new code; also notes the upgrade-time prune of bundled dev-only files.Validation
php -lclean on all changed PHP files; full Pest suite green (530 passed; the pre-existing deprecations/warnings are unrelated) and patch-coverage passes at 100% (68/68 changed measured lines); manifest drift-check passes and the translation template is up to date.Revision: hardening & fleet cleanup
Since the initial description, this PR also:
phpunit.xmlon upgrade (alongside the dev-onlytests/tree) and leaves.md*lint configs in place — the drift check now ignorestests/,phpunit.xml,.git*,.md*, and whitelisted paths../..traversal segment or resolves outside the plugin directory (including via a symlinked directory), and protects a directory when a whitelisted entry lives beneath it — each with added unit coverage.thold_prune_files()/thold_rmtree()(theplugin_thold_prefix is reserved for lifecycle/hook-registration functions).tests/Unit/PruneFilesTest.phpthe full standard GPL v2 header and aligns the Project Structure block in.github/copilot-instructions.md.