Skip to content

fix(installer): [develop] preflight dependencies and verify populated upgrades - #8306

Open
somethingwithproof wants to merge 2 commits into
Cacti:developfrom
somethingwithproof:fix/installer-completion-contracts
Open

somethingwithproof wants to merge 2 commits into
Cacti:developfrom
somethingwithproof:fix/installer-completion-contracts

Conversation

@somethingwithproof

@somethingwithproof somethingwithproof commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

This change makes Cacti installation and upgrades check their prerequisites and results before reporting completion. Shared web and CLI components perform an offline dependency preflight, prepare an upgrade plan, verify required schema and authentication state, and retain a bounded diagnostic report. This makes partial upgrades easier to detect and recover from while keeping database restoration a separate operator action.

Implementation details

An incomplete dependency tree or partially applied upgrade could reach database changes before an actionable failure. This adds a shared offline preflight for web and CLI entry points, an explicit source-checkout preparation command, a reviewable upgrade plan with backup/recovery guidance, and schema/authentication postconditions before recording the target version.

The installer retains an administrator-downloadable report containing controlled operation names, migration versions, timings and outcomes. It excludes credentials, commands, SQL and exception text. Collector synchronization now visits every collector, preserves incomplete outcomes as completion warnings, and propagates unexpected failures to CLI exit status. A missing 1.3 template column migration and nullable collector TLS arguments were found by populated upgrade tests and corrected.

This follows #8266 and includes its current head. The installer-only formatting changes in #8302 have been removed from that PR to keep ownership clear. Security baseline entries are placed to merge with #7790 without changing queue behavior.

Recorded local validation:

  • All nine new installer components: 100% line coverage; 26 tests and 63 assertions, with success/failure/timeout/invalid-input branches exercised.
  • Focused installer unit/integration suite: 83 tests and 368 assertions, including real HTTP session/CSRF recovery.
  • PHPStan level 8, PHP lint and project formatting checks; security sink and architectural guards; actionlint for changed workflows.
  • New components parse with PHP 8.2; Cacti's PHP >=8.3 requirement remains enforced.
  • The recorded PR-head snapshot passed 572 ordered pair merge checks and twenty cumulative merge simulations across develop and 1.2.x.
  • The preparation command succeeds on a clean source checkout and repairs a deliberately missing dependency entry point.

Complete local Docker suites pass for 1.2.22 on MariaDB 11.8 and 1.2.31 on MariaDB 10.11, including all four Chromium checks in each run, repeated upgrades, failure injection and lock exclusion. The recorded validation reported passing required GitHub checks, including the four tagged release/database jobs and the PHP 8.3/8.4/8.5 component coverage gates. Each local complete suite passes 22 scenarios. CI adds tagged 1.2.22 and 1.2.31 fixtures on MariaDB 10.11 and 11.8, containing LDAP users/providers, compatible and missing plugins, two collector databases, customized templates, an existing RRD file and 100,000 buffered samples. Tests verify preservation, real local/LDAP login, key pages/assets, sessions/CSRF, diagnostics authorization, repeat execution, and injected failure paths.

The report retains the latest run and supports diagnosis/manual recovery. It does not implement automatic migration replay or transactional DDL rollback. Synthetic fixtures are preservation tests, not production-scale polling benchmarks. The component gate enforces 100% line coverage for new components; it does not claim 100% coverage of the legacy installer.

Fixes #7885. Related / partial implementation: #3816, #7285.

Release notes are consolidated in #8320. Review and merge this child before that final documentation PR.

Conflict resolution against develop 9899fdf preserves #8317’s LDAP-table guard and prevents intermediate version downgrades during forced replays, while retaining dependency preflight, schema/authentication postconditions, run diagnostics and the shared CommandRunner. The preflight design continues to replace runtime Composer installs; its dependency-failure tests remain, and the obsolete refreshVendorDependencies fixture is not restored. Regenerated security baselines contain three substantive changes relative to develop (two controlled dependency-loader entries added and the old inline process launch removed), plus indentation changes. Both inventory verifiers pass.

Validation on mise-selected PHP 8.5.11: all 2,482 Unit tests pass (four skips), 69 installer Unit/Integration cases pass, PHP-CS-Fixer and full level-8 PHPStan pass. The complete disposable PHP 8.4 Docker installer matrix passes for release 1.2.22/MariaDB 11.8 and release 1.2.31/MariaDB 10.11, including populated LDAP/plugin/template/collector state, four browser scenarios per run, repeated forced repairs and failed-replay version/lock protection. No live databases were modified and no changelog entries were added to this child.

Review fixes: installer reports preserve valid JSON within the 4096-byte settings column, retain the newest operation and disclose omitted entries. Web and CLI installation now record each migration version, including failures. Native successful and failed upgrade checks pass; the component suite passes 29 tests at 100% coverage on PHP 8.3.35. New PHP files carry the full project copyright and license header.

Revision and checks

Description scope: target develop, 44 changed files, head 4dd8a15b2. Checked 2026-10-23 03:06:04 UTC.

GitHub check snapshot: 2 passed. Local test figures and earlier CI runs above are recorded evidence for their stated revisions and environments; they do not assert that every check passes at this head.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Downloadable reports omit web migration versions and can exceed the database column used to persist them.

2 open findings
What changed in this PR

Adds installer dependency preflight, upgrade diagnostics, postcondition checks, collector synchronization reporting, and populated upgrade validation.

Changes:

  • Adds offline dependency checks and preparation tooling.
  • Adds upgrade plans, reports, schema/authentication verification, and collector warnings.
  • Expands upgrade coverage across release, database, LDAP, plugin, and browser fixtures.
File Description
.github/​workflows/​installer-components-coverage.yml Adds component coverage matrix.
.github/​workflows/​installer-coverage.yml Expands installer integration matrix.
.github/​workflows/​release-artifact.yml Validates packaged dependencies.
cli/​install_cacti.php Displays plans and warnings.
cli/​prepare_install.sh Prepares source dependencies.
cli/​upgrade_database.php Adds postconditions and reporting.
docs/​INSTALLER_RECOVERY.md Documents upgrade recovery.
include/​global_arrays.php Registers report authorization.
install/​background.php Adds dependency preflight.
install/​functions.php Adds synchronization and verification helpers.
install/​install.php Adds dependency preflight.
install/​preflight.php Implements shared entry-point guard.
install/​report.php Serves authorized diagnostics.
install/​step_json.php Adds dependency preflight.
install/​upgrades/​1_3_0.php Adds missing template column.
lib/​Installer/​AuthenticationRequirements.php Validates authentication mappings.
lib/​Installer/​CollectorSynchronizer.php Classifies collector outcomes.
lib/​Installer/​CommandRunner.php Runs bounded subprocesses.
lib/​Installer/​CompletionWarnings.php Serializes completion warnings.
lib/​Installer/​DependencyPreflight.php Checks runtime dependencies and assets.
lib/​Installer/​RunReport.php Models installer diagnostics.
lib/​Installer/​RunState.php Defines report states.
lib/​Installer/​SchemaRequirements.php Parses required schema columns.
lib/​Installer/​UpgradePlan.php Models planned upgrade effects.
lib/​installer.php Integrates plans, reports, and postconditions.
lib/​poller.php Handles nullable collector TLS fields.
locales/​po/​cacti.pot Updates translation messages.
phpunit-installer-components.xml Configures component coverage.
tests/​e2e/​installer_application_check.sh Verifies upgraded application behavior.
tests/​e2e/​installer_failure_paths.php Adds failure-injection scenarios.
tests/​e2e/​installer_populated_fixture.sql Provides populated upgrade data.
tests/​e2e/​installer_resilience_docker.sh Expands Docker upgrade scenarios.
tests/​e2e/​tests/​installer-upgrade.spec.ts Adds browser upgrade checks.
tests/​fixtures/​InstallerPlugin/​INFO Defines fixture plugin metadata.
tests/​fixtures/​InstallerPlugin/​setup.php Implements fixture plugin hooks.
tests/​integration/​InstallerVendorRefreshContractTest.php Verifies preflight ordering.
tests/​security/​baselines/​architectural_hotspots.baseline.tsv Updates architectural inventory.
tests/​security/​baselines/​sink_inventory.baseline.tsv Updates security sink inventory.
tests/​Unit/​Installer/​InstallerComponentsTest.php Tests new installer components.
tests/​Unit/​Installer/​InstallerResilienceTest.php Updates resilience contracts.
tests/​Unit/​Installer/​VendorBootGuardTest.php Removes obsolete refresh tests.
tests/​Unit/​Security/​Csrf/​ItemActionPostOnlyTest.php Normalizes test quoting.

🧠 Review effort: Balanced


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

Comment thread lib/Installer/RunReport.php Resolved
Comment thread lib/installer.php Resolved
@somethingwithproof somethingwithproof changed the title fix(installer): preflight dependencies and verify populated upgrades fix(installer): [develop] preflight dependencies and verify populated upgrades Oct 12, 2026
bmfmancini
bmfmancini previously approved these changes Oct 12, 2026

@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.

It's a nit but put in the full copyright header

@somethingwithproof somethingwithproof left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added the full project copyright and license header to the new PHP files in 5bd7a6e, as requested in your review.

somethingwithproof added a commit to somethingwithproof/cacti that referenced this pull request Oct 14, 2026
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the fix/installer-completion-contracts branch from 196bb36 to 94cb034 Compare October 17, 2026 06:08
Comment thread cli/prepare_install.sh Fixed
Comment thread tests/e2e/installer-coverage.sh Fixed
Comment thread tests/e2e/installer-coverage.sh Fixed
@somethingwithproof
somethingwithproof force-pushed the fix/installer-completion-contracts branch 3 times, most recently from fe597f6 to 095c00b Compare October 17, 2026 20:31
@somethingwithproof

Copy link
Copy Markdown
Member Author

The new PHP files now have the full project copyright and license header. The report-size and migration-version fixes remain in place at 095c00b, and current checks pass. Please take another look at the copyright request.

@github-actions
github-actions Bot force-pushed the fix/installer-completion-contracts branch 3 times, most recently from dca6fa8 to 2cbaa31 Compare October 20, 2026 08:53
@somethingwithproof

Copy link
Copy Markdown
Member Author

The full copyright and license headers are present in the new PHP files at 2cbaa31c7e35a084d3366741faa8215836426efe. All 54 reported checks have completed without failures, including the installer and coverage jobs. Ready for re-review of the header request.

@github-actions
github-actions Bot force-pushed the fix/installer-completion-contracts branch from 2cbaa31 to 2b87ff3 Compare October 20, 2026 20:49
@somethingwithproof

Copy link
Copy Markdown
Member Author

The copyright request is addressed at 2b87ff3: all 13 newly added PHP files have the full Cacti copyright and GPL header. Current-head CI is running; the earlier green results belong to the previous revision. @TheWitness, please re-review the header change.

@github-actions
github-actions Bot force-pushed the fix/installer-completion-contracts branch 2 times, most recently from 6622dc9 to 4dd8a15 Compare October 22, 2026 20:48
Comment thread cli/prepare_install.sh Resolved
@somethingwithproof
somethingwithproof force-pushed the fix/installer-completion-contracts branch from 9f7e161 to 0837db4 Compare October 24, 2026 03:21
@github-actions
github-actions Bot force-pushed the fix/installer-completion-contracts branch from 1d9ea53 to 192f79d Compare October 26, 2026 20:52
… upgrades

Adds a shared offline dependency preflight for web and CLI installs, schema and authentication postconditions before the target version is recorded, and a bounded run report that records each migration version. Fixes Cacti#7885.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@github-actions
github-actions Bot force-pushed the fix/installer-completion-contracts branch from 192f79d to df13ef1 Compare October 28, 2026 20:47
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:database Namespaced Cacti workflow label area:installer Namespaced Cacti workflow label release:1.3 Namespaced Cacti workflow label type:enhancement Namespaced Cacti workflow label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add release-to-release database and configuration upgrade fixture tests

5 participants