Skip to content

Split library files into includes/, add the file manifest + upgrade prune, set compat to 1.2.29 - #32

Merged
cigamit merged 10 commits into
mainfrom
chore/compat-1.2.32
Oct 1, 2026
Merged

cigamit merged 10 commits into
mainfrom
chore/compat-1.2.32

Conversation

@TheWitness

@TheWitness TheWitness commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Split library files into includes/, add the file manifest + upgrade-time prune, set compat to 1.2.29

Two fleet-wide consistency changes for plugin_quicktree.

File relocations (repointed at the entry points)

  • quicktree_security.php → includes/security.php
  • ui_helpers.php → includes/helpers.php

File manifest + upgrade-time pruning

  • New root manifest.json: tombstones (quicktree_security.php, ui_helpers.php), expected (the current top-level tree, directories with a trailing /), and whitelist (empty — no user-writable runtime tree).
  • quicktree_prune_files() (in setup.php, called from the version-change branch of quicktree_check_upgrade()) removes the tombstoned paths, the dev-only tests/ tree, and phpunit.xml; leaves whitelist, .git*, and .md* files alone; and logs — without removing — any unaccounted top-level entry.
  • Tamper-hardened: 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. Warns in the Cacti log on anything it cannot remove.
  • tests/bin/validate-manifest.php (wired into plugin-ci-workflow.yml) fails on drift between expected and the real top-level tree (it ignores tests/, phpunit.xml, .git*, .md*, and whitelisted paths).

Compatibility

  • INFO compat floor set to 1.2.29.

Docs & tests

  • Added tests/Unit/PruneFilesTest.php (tombstone/tests//phpunit.xml removal, whitelist & .git protection, traversal-segment and symlink-escape refusal, whitelist-ancestor protection), using the full standard GPL v2 header.
  • QuicktreeCheckUpgradeTest and the config_arrays cases sandbox base_path (a temp tree with a copy of INFO and no manifest) so the prune is a no-op there while the new call line stays covered.
  • Aligned the Project Structure block in .github/copilot-instructions.md to the new layout.

Validation

php -l clean on all changed PHP files; full Pest suite green; patch-coverage passes at 100% of changed measured lines; manifest drift-check passes and the translation template is up to date.

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

The new minimum version conflicts with the repository’s documented Cacti 1.2.17+ compatibility baseline.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates QuickTree’s declared minimum Cacti version from 1.2.17 to 1.2.32.

Changes:

  • Raises the compat metadata value to Cacti 1.2.32.
File Description
INFO Updates the minimum compatible Cacti version.

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

Comment thread INFO Outdated
Copilot added 5 commits September 30, 2026 10:53
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 QuickTree UI form-wrapper library moves into a new includes/ directory as
helpers.php; quicktree.php and the unit test load it from there. The old path
is tombstoned so existing installs drop the stale top-level copy on upgrade.
The request-sanitizing library moves into includes/ as security.php;
quicktree.php and the unit/integration tests load it from there. The old path
is tombstoned so existing installs drop the stale top-level copy on upgrade.

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

The unchanged plugin version prevents pruning on existing installations, and nested whitelisted data can be deleted.

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

Open (4)
Resolved since last review (1)

Comment thread setup.php Outdated
Comment thread INFO
Comment thread manifest.json
Comment thread setup.php Outdated
Copilot added 4 commits September 30, 2026 22:18
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.
@TheWitness TheWitness changed the title INFO: set compat to 1.2.32 Split library files into includes/, add the file manifest + upgrade prune, set compat to 1.2.29 Oct 1, 2026
@cigamit
cigamit merged commit 44de7d4 into main Oct 1, 2026
5 checks passed
@cigamit
cigamit deleted the chore/compat-1.2.32 branch October 1, 2026 06:52
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