Skip to content

INFO: back off compat to 1.2.29 - #21

Merged
cigamit merged 8 commits into
developfrom
chore/compat-1.2.29
Oct 1, 2026
Merged

cigamit merged 8 commits into
developfrom
chore/compat-1.2.29

Conversation

@TheWitness

@TheWitness TheWitness commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Two fleet-wide consistency changes for this plugin:

  1. INFO compat floor — backs off the INFO minimum Cacti compat from 1.2.32 → 1.2.29, per developer feedback on the compat rollout.
  2. File manifest + upgrade-time pruning — adds the fleet manifest.json + prune mechanism, and consolidates the single-file themes/ directory into the conventional css/ directory.

Unique-key assessment

This plugin is not affected by the Cacti 1.2.29–1.2.31 db_update_table() unique-key drop: it does not call db_update_table(), so no re-introduction helper is required.

themes/ → css/

themes/common.css is relocated to css/common.css (git mv, history preserved) to match the fleet convention, and plugin_tags_page_head()'s stylesheet reference is repointed. The retired themes/ directory is recorded as a manifest tombstone so it is removed from an upgrading install.

File manifest + upgrade pruning

  • New root manifest.json with tombstones = ["themes/"], expected (the current top-level tree; directories carry a trailing /), and whitelist (empty — no user-writable runtime tree).
  • tags_prune_files() (appended to setup.php, called from the version-change branch of plugin_tags_upgrade() in include/database.php, gated on if ($new != $old)) removes the tombstoned themes/ tree plus the dev-only tests/ tree on upgrade, refuses any path resolving outside the plugin directory (a tampered manifest.json), warns in the Cacti log on any file/directory it cannot remove, leaves whitelist/.git* alone, and logs — without removing — any unaccounted top-level entry.
  • tests/bin/validate-manifest.php (wired into plugin-ci-workflow.yml) fails on drift between expected and the real top-level tree.
  • Added tests/Unit/PruneFilesTest.php. include/database.php is added to the coverage source set (its new gated prune call is exercised by the drift-path tests). TagsCheckConfigTest and the relevant TagsConfigAndNavigationTest case sandbox base_path (a temp tree with a copy of INFO, empty include/ stubs, and no manifest) so the prune is a no-op there while the new call line stays covered.

Validation

php -l clean on all changed PHP files; full Pest suite green (46 passed) 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:

  • Prunes phpunit.xml on upgrade (alongside the dev-only tests/ tree) and leaves .md* lint configs in place — the drift check now ignores tests/, phpunit.xml, .git*, .md*, and whitelisted paths.
  • Hardens the prune against tampered manifests: refuses any tombstone whose normalized path contains a ./.. 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.
  • Renames the prune helpers to the documented naming convention: tags_prune_files() / tags_rmtree() (the plugin_tags_ prefix is reserved for lifecycle/hook-registration functions).
  • Gives tests/Unit/PruneFilesTest.php the full standard GPL v2 header and aligns the Project Structure block in .github/copilot-instructions.md.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Repository compatibility guidance and the changelog must be updated to match the new minimum version.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Lowers the plugin’s minimum supported Cacti version from 1.2.32 to 1.2.29.

Changes:

  • Updates the INFO compatibility floor.
File Description
INFO Sets minimum Cacti compatibility to 1.2.29.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread INFO
Comment thread INFO
Copilot added 7 commits September 30, 2026 16:01
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.
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.
The trailing '# ...' comments in the Project Structure block drifted further
right down the tree; align them all to a single column.
- 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
cigamit merged commit a20a723 into develop Oct 1, 2026
3 checks passed
@cigamit
cigamit deleted the chore/compat-1.2.29 branch October 1, 2026 06:42
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.

3 participants