Repository navigation
fix(installer): [develop] preflight dependencies and verify populated upgrades - #8306
somethingwithproof wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
🟡 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.
TheWitness
left a comment
There was a problem hiding this comment.
It's a nit but put in the full copyright header
somethingwithproof
left a comment
There was a problem hiding this comment.
Added the full project copyright and license header to the new PHP files in 5bd7a6e, as requested in your review.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
196bb36 to
94cb034
Compare
fe597f6 to
095c00b
Compare
…ented PRs Cacti#8012 and Cacti#8340 closed without merging; their successors Cacti#8513 and Cacti#8512 carry their own work, and Cacti#8513 already adds its own fragment. Cacti#8306 now adds changelog.d/8306.issue itself, so this copy would collide with it. Cacti#8302 is now formatting-only after its defect fixes moved to Cacti#8810, which carries changelog.d/8809.issue. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ented PRs Cacti#8012 and Cacti#8340 closed without merging; their successors Cacti#8513 and Cacti#8512 carry their own work, and Cacti#8513 already adds its own fragment. Cacti#8306 now adds changelog.d/8306.issue itself, so this copy would collide with it. Cacti#8302 is now formatting-only after its defect fixes moved to Cacti#8810, which carries changelog.d/8809.issue. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ented PRs Cacti#8012 and Cacti#8340 closed without merging; their successors Cacti#8513 and Cacti#8512 carry their own work, and Cacti#8513 already adds its own fragment. Cacti#8306 now adds changelog.d/8306.issue itself, so this copy would collide with it. Cacti#8302 is now formatting-only after its defect fixes moved to Cacti#8810, which carries changelog.d/8809.issue. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
cc94dd4 to
251c63e
Compare
…ented PRs Cacti#8012 and Cacti#8340 closed without merging; their successors Cacti#8513 and Cacti#8512 carry their own work, and Cacti#8513 already adds its own fragment. Cacti#8306 now adds changelog.d/8306.issue itself, so this copy would collide with it. Cacti#8302 is now formatting-only after its defect fixes moved to Cacti#8810, which carries changelog.d/8809.issue. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
251c63e to
1e25641
Compare
…ented PRs Cacti#8012 and Cacti#8340 closed without merging; their successors Cacti#8513 and Cacti#8512 carry their own work, and Cacti#8513 already adds its own fragment. Cacti#8306 now adds changelog.d/8306.issue itself, so this copy would collide with it. Cacti#8302 is now formatting-only after its defect fixes moved to Cacti#8810, which carries changelog.d/8809.issue. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
… 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>
The web upgrade wrote the target version at the end of upgradeDatabase(), before validateRequiredSchema() and install_verify_authentication() ran. When either check failed the run was reported as failed, but the database already claimed to be current, so a retry skipped the migrations. upgradeDatabase() now advances the version only through intermediate steps, and writeInstalledVersion() stays the only writer of the target version, after both checks pass. This matches cli/upgrade_database.php. Also add PHPDoc to getUpgradePlan(), getCompletionWarnings() and runOperation(), drop is_array() checks getUpgradePlan() had already enforced, and add a changelog fragment for the data_template.templates column the 1.3.0 upgrade now adds. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
upgradeDatabase() compares get_cacti_db_version() before writing intermediate versions. The upgrade-report fixture updated version to 1.2.28 but left the static cache on the running tree, so PHP 8.4 MariaDB jobs never recorded 1.2.30 and exited 255. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The 100% changed-code job never loaded installer or poller sources, so every touched file stayed instrumented:false. Run InstallerChangedCoverage and the installer component clover report, and teach the gate to read Clover XML. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The do/while (true) loop left an implicit return after the loop that no path could reach. Loop while the encoded report is oversized and return it afterwards; trimming and the storage-limit exception are unchanged. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Exercise the remaining changed installer lines with checked outcomes: collector inventory and replication failures, unreadable or incomplete schema metadata, unreadable providers, plugin compatibility and an unreadable upgrade plan, an intermediate migration that succeeds before the target fails, a failed background install, the empty report 404, and the missing, verified, failed-verification and thrown migration paths of cli/upgrade_database.php. Load the global API stand-ins from a fixture file instead of eval(). Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The two changed-coverage fixtures carried a one-line notice. Use the standard Cacti Group license block that the other new PHP files in this change already carry. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…nged lines Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
The web installer entry points rejected any web SAPI without pcntl, although pcntl only builds for the CLI SAPI. Composer's generated platform check and the installer's own module table already treat it as not applicable to the web server. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
… test files Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
An enabled LDAP provider with no server, or an enabled user whose realm has no provider, failed the upgrade after its migrations had run and left the version unadvanced. Both already deny those logins, and 1.2 leaves such users behind when a domain is deleted, so a working installation could not upgrade without editing user_auth by hand. Report them as completion warnings on the web completion page, in the CLI output and in the run report instead. Unreadable provider parameters still stop the upgrade: every provider would then run without its stored settings, including any group restriction. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
New installations also showed an empty upgrade plan and the pre-upgrade backup advice, in both the web confirmation step and the CLI. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
1e25641 to
da20098
Compare
|




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:
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, head4dd8a15b2. 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.
Update: the web upgrade path now records the new database version only after the schema and authentication checks pass, matching the CLI path, so a failed check no longer leaves the database marked as upgraded.
Merge order: this PR and #8302, #8451, #8540, #8673, #8704, #8730 change .github/workflows/pr-changed-coverage.yml. Suggested order for that file: #8540, #8704, then this PR, then #8730, #8673, #8451, #8302. This PR and #8302, #8461, #8475 change tests/Helpers/SourceSlice.php. Suggested order for that file: #8461, then this PR, then #8475, #8302. This PR and #8730 change the same lines of install/functions.php, lib/installer.php and the installer tests under tests/e2e/ and tests/integration/ in different ways, so no order is suggested between them; they need to be reconciled. Whichever merges later will be rebased.