Skip to content

ci: check manual statements against the Cacti source - #257

Open
somethingwithproof wants to merge 4 commits into
docs/manuals-release-assetsfrom
docs/code-claims-check
Open

somethingwithproof wants to merge 4 commits into
docs/manuals-release-assetsfrom
docs/code-claims-check

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Stacked on #256.

Follow-ups from checking #248 against the Cacti source.

Check source-derived statements in CI. bin/check_code_claims.py compares the manual with a Cacti develop checkout:

  • the Galera ALTER TABLE ... ENGINE=InnoDB list against the ENGINE=MEMORY tables in cacti.sql;
  • the PHP floor in Requirements.md against composer.json and CACTI_PHP_VERSION_MINIMUM;
  • the PHP extension list against the ext-* requirements in composer.json;
  • the config.php example (names and literal types) and the remote-poller $rdatabase_* names against include/config.php.dist.

The new Source-derived statements workflow runs the checker on pull requests, on develop and weekly, so a Cacti change that makes these pages stale is reported. The checker uses only the standard library, and its tests reach 100% branch coverage.

The first run flagged data_source_stats_hourly_cache in the Galera list. install/upgrades/1_3_0.php converts it to InnoDB and cacti.sql creates it as InnoDB, so that line is removed.

Container build matching CI. Host builds embed the host's fonts: a macOS build embeds Arial and Andale Mono, while CI embeds DejaVu. The documented macOS workaround also fails, because env and uv run do not pass DYLD_FALLBACK_LIBRARY_PATH to Python. bin/build_manuals_in_container.sh runs the locked build in Ubuntu 24.04 (image pinned by digest) with the CI font and library packages and a checksum-verified uv. It also works from a Git worktree.

Apache example. Cacti ships .htaccess files for bin, cli, contrib, log, mibs, rra, scripts, tests and the private cache directories, but none for service/, include/config.php, include/config_local.php or PHP files under include/vendor. The nginx guides deny those paths. The Enterprise Linux LAMP example now denies them too.

Validation:

  • The checker passes against Cacti develop 9235426, and its 10 tests pass with 100% branch coverage.
  • All Python tests, the navigation check, codespell, shellcheck and actionlint pass.
  • The container build completed from a worktree and produced a PDF with DejaVu fonts embedded.
  • The Apache rules were tested on httpd 2.4. service/, include/config.php, include/config_local.php and include/vendor/**/*.php return 403. index.php, include/js assets and non-PHP vendor assets return 200.

Comment thread .github/workflows/code-claims.yml Fixed
The Galera table list drifted from cacti.sql because nothing compared
them. Add a checker that compares the manual with a Cacti develop
checkout: the Galera conversions against the MEMORY tables in cacti.sql,
the PHP floor against composer.json and CACTI_PHP_VERSION_MINIMUM, the
extension list against composer.json, and the configuration examples
against include/config.php.dist. Run it on pull requests, on develop and
weekly so Cacti changes that make the manual stale are reported.

The first run found data_source_stats_hourly_cache in the Galera list.
The 1.3.0 upgrade converts it to InnoDB, and new installs create it as
InnoDB, so it no longer needs converting.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Host builds embed the host's fonts, so a macOS build produces Arial and
Andale Mono PDFs while CI embeds DejaVu. The documented macOS workaround
also fails: env and uv run do not pass DYLD_FALLBACK_LIBRARY_PATH to
Python, so WeasyPrint cannot load Homebrew's Pango.

Add a script that runs the locked build in Ubuntu 24.04 with the CI font
and library packages and a checksum-verified uv, and document it in
place of the macOS workaround.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Cacti ships .htaccess files for bin, cli, contrib, log, mibs, rra,
scripts, tests and the private cache directories, but none for
service/, include/config.php, include/config_local.php or PHP files
under include/vendor. The nginx guides deny those paths; the Apache
example relied on .htaccess alone. Deny them explicitly, matching the
nginx rules.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Use [[ for the argument test, and install coverage from a wheel only so
pip cannot run a source distribution's build scripts.

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

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants