Skip to content

rfc: native typed-settings and DeviceRepository conversions for the #8436 ADR - #8615

Open
somethingwithproof wants to merge 3 commits into
developfrom
rfc/form-validator-layer
Open

somethingwithproof wants to merge 3 commits into
developfrom
rfc/form-validator-layer

Conversation

@somethingwithproof

@somethingwithproof somethingwithproof commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Reference conversions in the native direction of ADR 0003/0004 (#8436). They add no new Symfony uses.

  • lib/config_api.php: typed setting accessors (cacti_setting_int/bool/string/enum) built on read_config_option(). Caching, remote-poller behaviour and the $force re-read are unchanged. Spikekill reads its defaults through them, with fallbacks that match the registered defaults.
  • Cacti\Repository\DeviceRepository: parameterized access to the host table, with bound values and allowlisted column names. update_host_status() reads its device through find(). A device deleted during a poll now returns early instead of being processed from an empty row.
  • The changed-line coverage gate measures both through a clover configuration and the DeviceRepositoryContracts probe.

The Symfony Validator form layer, the Console command and the Process helper that were in earlier revisions are removed. ADR 0004 proposes replacing those components with native code, so new uses of them would run against it.

Supersedes #8620, #8625.

@somethingwithproof
somethingwithproof marked this pull request as ready for review November 6, 2026 10:27
@somethingwithproof
somethingwithproof requested a review from a team as a code owner November 6, 2026 10:27
@somethingwithproof
somethingwithproof requested review from TheWitness and cigamit and removed request for a team November 6, 2026 10:27
@somethingwithproof
somethingwithproof force-pushed the rfc/form-validator-layer branch 2 times, most recently from 5fd68d6 to 05ddb76 Compare November 12, 2026 07:51
@somethingwithproof somethingwithproof changed the title rfc(form): symfony/validator-backed validation + inline errors for draw_edit_form() (reference impl on color.php) rfc: Symfony reference conversions for the #8436 ADR Nov 12, 2026
@somethingwithproof somethingwithproof added this to the v1.3.0 milestone Nov 13, 2026
@somethingwithproof somethingwithproof added the design Design issue that blocks resolution label Nov 13, 2026
@github-actions
github-actions Bot force-pushed the rfc/form-validator-layer branch 3 times, most recently from e30944f to 83cd5c9 Compare November 16, 2026 20:48
@somethingwithproof somethingwithproof added the release:1.3 Namespaced Cacti workflow label label Nov 17, 2026
@somethingwithproof
somethingwithproof force-pushed the rfc/form-validator-layer branch 2 times, most recently from 8ef561a to a7f643a Compare November 18, 2026 13:20
@somethingwithproof somethingwithproof changed the title rfc: Symfony reference conversions for the #8436 ADR rfc: native typed-settings and DeviceRepository conversions for the #8436 ADR Nov 18, 2026
@somethingwithproof

Copy link
Copy Markdown
Member Author

I've cut this PR to the conversions that match the corrected ADR in #8436 (7b2cf37). ADR 0004 proposes replacing Validator, Console and Process with native code, and ADR 0003 asks new code not to add Validator uses. So I removed the form-validation layer, the show_perms Console command and the Process helper. What's left is the typed settings accessors and DeviceRepository. The removed work is kept locally if the maintainers decide on the Symfony route instead.

@github-actions
github-actions Bot force-pushed the rfc/form-validator-layer branch from a7f643a to 6d7eb99 Compare November 19, 2026 20:50
@github-actions
github-actions Bot force-pushed the rfc/form-validator-layer branch from 6b111d5 to fc06d72 Compare November 25, 2026 20:48
Add cacti_setting_int(), cacti_setting_bool(), cacti_setting_string() and
cacti_setting_enum() in lib/config_api.php. Each builds on
read_config_option(), so caching, remote-poller behaviour and the $force
re-read are unchanged, and a missing or invalid value returns the
caller's typed default instead of a silent zero.

Spikekill reads its defaults through them. The fallbacks match the
registered setting defaults, and an empty or non-numeric stored value
now yields that default instead of a TypeError on the typed property.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…able

Cacti\Repository\DeviceRepository binds every value and allowlists every
column name before it reaches SQL. An update of a missing device fails
rather than inserting, and a null criterion matches IS NULL.

update_host_status() reads its device through find(). The query is the
same, but a device deleted during the poll now returns early instead of
being processed from an empty row.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…anged-line gate

Run ConfigApiTest and DeviceRepositoryTest under a clover coverage
configuration and the DeviceRepositoryContracts probe in the PR change
tests. The gate now reads clover reports and no longer counts a
declare(strict_types) directive as an executable statement.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@github-actions
github-actions Bot force-pushed the rfc/form-validator-layer branch from fc06d72 to 30654b4 Compare November 26, 2026 08:50
@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

design Design issue that blocks resolution release:1.3 Namespaced Cacti workflow label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant