Skip to content

Add build-time catalog validation for existing interface templates - #8456

Open
somethingwithproof wants to merge 4 commits into
developfrom
feature/interface-catalog-foundation
Open

somethingwithproof wants to merge 4 commits into
developfrom
feature/interface-catalog-foundation

Conversation

@somethingwithproof

@somethingwithproof somethingwithproof commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

This change adds automatic build-time checks for Cacti 1.3’s existing interface templates. A catalog and schema describe the shipped fields, identities and dependencies, and tests compare them with the existing query and signed package while preserving their output. This prepares a safer foundation for template maintenance; it does not add new vendor templates or monitoring metrics.

Why

The #7354 audit found 12 of the 30 bundled template packages at risk of drift and 2 likely stale. Aruba OSCX also ships 32-bit traffic graphs on 10G ports, which wrap within seconds at line rate. Fixing these means editing or replacing shipped templates. Today nothing checks that an edit is safe, and the mistakes are silent:

  • A changed template hash makes the importer create a second copy of a query or graph template on upgrade, instead of updating the existing one.
  • A data source bound to ifInOctets instead of ifHCInOctets still graphs, but wraps and under-reports on fast links.
  • A re-import can overwrite suggested values an administrator added.
  • A dropped dependency leaves graph templates pointing at data templates that no longer exist.

This PR adds those checks for the interface family, which nearly every Cacti install uses. It doesn't change its output. Later template fixes from #7354 can then be checked the same way before they ship.

What changes

Add a build-time catalog and strict schema for the existing IF-MIB/IF-X-MIB interface family on develop (Cacti 1.3). The renderer reproduces all 42 shipped query fields byte for byte. Explicit native query/data/graph hashes, 66 dependency references and traffic-counter contracts are checked against the existing signed package.

The standalone query and package-embedded query already differ upstream, so their fingerprints are preserved independently. The tool does not rewrite or re-sign either artifact.

Related to #7354.

Verification

PHP fixtures were verified at 9304e7543 and the Python suite at a49d2ac0f, using Python 3.12.12, PHP 8.5.12, RRDtool 1.11.0 and a disposable MariaDB 13.0.2 schema:

  • Python maintenance-tool suite: 76 passed, including 23 catalog tests.
  • Native query-import and real-RRD regressions: 2 passed, 42 assertions, zero skips.
  • Changed executable Python coverage: 158/172 statements, 91.86%; existing 80% gate retained.
  • Configured PHPStan: 465 files, no errors.
  • Required full formatter: 0 of 437 files changed; authored PHP formatting, normal commit hooks, workflow policy, changelog and diff checks passed.
python -m unittest discover -s tests/tools -p 'test_*.py'
# Native run uses disposable CACTI_TEST_DB_* settings, explicit DB opt-in and RRDTOOL_TEST_BINARY:
mise exec php@8.5 -- php include/vendor/bin/pest --configuration=tests/phpunit-interface-catalog.xml --fail-on-skipped --fail-on-empty-test-suite

The native tests use the actual query importer and SQL helpers, canonical tables, repeated imports, administrator-added suggested values, and temporary RRD updates covering counter precision, wraps, resets and outages. Mutation tests reject unrelated existing graphs and invalid metric bindings. Native CI is registered for MariaDB 10.11/MySQL 8.4 at PHP 8.3. See the revision-specific check snapshot below.

Known upstream CI failure: the Deepness multiselect palette assertion also fails on the unchanged develop base a9c73cfc4 (base run, PR run). This PR changes neither the theme files nor those browser tests. See the revision-specific check snapshot below.

Compatibility and limits

Runtime behavior, database schemas, installer interfaces and PHP/Spine protocols remain unchanged. Existing query XML, signed packages and runtime source have no diff. This PR targets Cacti 1.3 only.

The fixture uses controlled dependency IDs and does not establish full installed graph creation, an installer/upgrade rehearsal or hardware validation. Existing COUNTER reset/wrap ambiguity is preserved and documented.

Revision and checks

Description scope: target develop, 12 changed files, head a49d2ac0f. Checked 2026-10-23 03:06:04 UTC.

GitHub check snapshot: 44 passed, 1 failed, 2 skipped. Checks needing attention: chromium. 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.

@somethingwithproof somethingwithproof added the enhancement General tag for an enhancement label Oct 22, 2026
@somethingwithproof
somethingwithproof requested a review from a team as a code owner October 22, 2026 21:44
@somethingwithproof somethingwithproof added snmp Issue related to SNMP data collection develop Bug in the development branch area:templates Namespaced Cacti workflow label release:1.3 Namespaced Cacti workflow label labels Oct 22, 2026
@somethingwithproof
somethingwithproof requested review from cigamit and removed request for a team October 22, 2026 21:44
@somethingwithproof somethingwithproof added enhancement General tag for an enhancement snmp Issue related to SNMP data collection develop Bug in the development branch area:templates Namespaced Cacti workflow label release:1.3 Namespaced Cacti workflow label labels Oct 22, 2026
@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch 4 times, most recently from 1a5ba19 to ade0d70 Compare October 27, 2026 20:46
@somethingwithproof
somethingwithproof force-pushed the feature/interface-catalog-foundation branch 2 times, most recently from 9ac5cc0 to 87ea49a Compare November 9, 2026 05:24
@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch 4 times, most recently from bfc2d11 to a22360b Compare November 11, 2026 21:10
@somethingwithproof somethingwithproof added this to the v1.3.0 milestone Nov 13, 2026
@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch 4 times, most recently from 81baba6 to d386f61 Compare November 17, 2026 08:49

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

This requires a design review and agreement by the team.

@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch from d386f61 to 983d7a2 Compare November 17, 2026 20:48
@somethingwithproof

Copy link
Copy Markdown
Member Author

This requires a design review and agreement by the team.

Understood. I'll hold this until the team has looked at the approach. The open questions are:

  • whether a JSON catalog should be the source of truth for templates at all
  • whether the extra CI job (a database service plus RRDtool) and the pinned Python dependencies (jsonschema, defusedxml) are acceptable
  • whether resource/catalogs/ is the right place for it

It changes no runtime files, only build-time validation. I'm happy to move the discussion to #7354, and to cut this down or close it depending on what the team prefers.

@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch 8 times, most recently from 8d348e4 to 076130a Compare November 25, 2026 20:50
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ters

The binding check only proved that each declared field fed its RRD item
somewhere, so a regenerated package that also bound a field to the other
direction, or bound one RRD item twice in a graph, still passed. Require
each declared field to be bound exactly once and only to its own RRD item.

The width check accepted any ifXTable column as 64-bit, but the multicast
and broadcast packet columns there are Counter32. Pin the four IF-MIB
octet counter OIDs by direction and width instead.

Document how to update the pinned fingerprints after a template package
or query regeneration.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@github-actions
github-actions Bot force-pushed the feature/interface-catalog-foundation branch from 076130a to 25ae181 Compare November 26, 2026 08:51
@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:templates Namespaced Cacti workflow label develop Bug in the development branch enhancement General tag for an enhancement release:1.3 Namespaced Cacti workflow label snmp Issue related to SNMP data collection

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants