Repository navigation
Chore/extract setup modules - #388
Conversation
45f5b3e to
a0ed10f
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
MySQL-incompatible schema definitions and replication correctness issues can prevent installation or compromise reliable delivery.
Review effort: Balanced
Findings: 3
Open (5)
What changed in this PR
Refactors setup.php into focused modules while adding remote collector replication, recovery, schema updates, and supporting tests.
Changes:
- Extracts setup responsibilities into schema, processing, settings, navigation, installer, and utility modules.
- Adds durable remote replication, recovery workers, telemetry, and transactional failure handling.
- Updates schemas, documentation, translations, entry points, and regression coverage.
| File | Description |
|---|---|
.github/copilot-instructions.md |
Documents module ownership. |
AGENTS.md |
Adds graphify guidance. |
CHANGELOG.md |
Records new features and schema changes. |
INFO |
Bumps version to 4.6. |
README.md |
Documents storage and replication configuration. |
config.php.dist |
Adds Main Collector connection options. |
config_local.php.dist |
Adds remote delivery connection options. |
docs/setup-modules.md |
Defines setup module boundaries. |
includes/functions.php |
Implements replication, recovery, and transfer handling. |
includes/installer.php |
Extracts installer UI and engine validation. |
includes/navigation.php |
Extracts navigation callbacks. |
includes/processing.php |
Extracts poller and rule-replication callbacks. |
includes/schema.php |
Extracts schema logic and adds replication tables. |
includes/settings.php |
Extracts settings and permission configuration. |
includes/utilities.php |
Extracts utility callbacks. |
lib/syslog_dashboard.php |
Removes an unused height helper. |
locales/po/cacti.pot |
Updates translation strings and source paths. |
syslog.php |
Adds replication status and stable query projections. |
syslog_alerts.php |
Uses the setup compatibility bootstrap. |
syslog_batch_transfer.php |
Uses the setup compatibility bootstrap. |
syslog_counter.php |
Adds setup bootstrap and connection validation. |
syslog_device_rules.php |
Uses setup bootstrap and normalizes query failure. |
syslog_process.php |
Propagates worker failures and drives replication. |
syslog_recovery.php |
Adds the bounded recovery CLI worker. |
syslog_removal.php |
Uses the setup compatibility bootstrap. |
syslog_reports.php |
Uses the setup compatibility bootstrap. |
tests/bootstrap-unit.php |
Restores test globals and maps function ownership. |
tests/bin/patch-coverage.php |
Includes the recovery worker in coverage. |
tests/regression/panel_resize_test.php |
Updates dashboard helper expectations. |
tests/regression/rule_realm_upgrade_test.php |
Expands realm migration coverage. |
tests/Security/CsrfPurgeTest.php |
Stages extracted modules in its sandbox. |
tests/Security/IncludePathNormalizationTest.php |
Verifies setup-based entry-point loading. |
tests/Security/ItemShareVisibilityTest.php |
Tests share-table repair. |
tests/Security/LogicalMessageSearchTest.php |
Checks stable UNION projections. |
tests/Security/RemoteCollectorInstallOptionsTest.php |
Tests remote-option engine constraints. |
tests/Security/TraditionalTableDeprecationTest.php |
Uses function-owner source lookup. |
tests/Unit/CollectorHealthTest.php |
Updates extracted helper coverage. |
tests/Unit/DeviceRulePolicyTest.php |
Tests device-rule creation and replication. |
tests/Unit/MessageColumnTextTest.php |
Tests message-column migration. |
tests/Unit/PartitionPrecreateBoundaryTest.php |
Uses centralized source ownership. |
tests/Unit/ReplicationCoverageRegressionTest.php |
Covers replication failure and recovery branches. |
tests/Unit/ReplicationDeliveryTest.php |
Tests delivery, retention, and telemetry. |
tests/Unit/SetupModuleBoundaryTest.php |
Enforces module ownership boundaries. |
tests/Unit/SetupSmallHelpersTest.php |
Tests global configuration reset. |
tests/Unit/SyslogSettingsWorkersTest.php |
Reads worker settings from their new module. |
tests/Unit/SyslogWorkerAggregationTest.php |
Tests worker success aggregation. |
💡 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.
Use require() and require_only(). We shouldn't really be loading all of the syslog libraries for every page rendering that's kind of bad karma. I don't know if it's lazy load or not.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
Addressed the review in 176c29a:
Validated with the complete Pest suite: 197 passed, 961 assertions. |



This pull request refactors the Syslog plugin's setup and module structure, clarifies documentation, and introduces new logic to enforce storage engine compatibility when Remote Data Collector options are enabled. The changes aim to modularize the codebase, improve maintainability, and ensure correct storage engine selection during installation and configuration.
Key highlights:
Most important changes:
1. Setup and Module Structure Refactor
includes/, defining clear ownership for setup, schema, processing, settings, navigation, installer, and utilities modules. Updated documentation and developer instructions to reflect these boundaries. (.github/copilot-instructions.md,docs/setup-modules.md) [1] [2] [3]2. Storage Engine Enforcement for Remote Data Collector
syslog_remote_collector_requires_innodb,syslog_install_storage_engine, andsyslog_install_storage_engine_is_compatibleinincludes/functions.phpto require InnoDB when any Remote Data Collector option is enabled, logging a warning and overriding incompatible selections.README.md,.github/copilot-instructions.md) to clarify that enabling any Remote Data Collector option mandates InnoDB and that the setup advisor will enforce this automatically. [1] [2]3. Documentation and Changelog Updates
docs/setup-modules.mdfile, to explain the new module boundaries, hook ownership, and test rules. [1] [2] [3]4. Code Cleanup
syslog_check_changedfunction fromincludes/functions.phpas part of ongoing code cleanup.5. Miscellaneous Improvements
database.phpandfunctions.phpunderincludes/. [1] [2]These changes collectively enhance the plugin's maintainability, enforce correct storage engine usage, and provide clear guidance for both users and future contributors.