Issue #3624605: Let the metrics job fail when the page is stale, and refresh the page it watched drift by 5,344 lines
The metrics job could not fail: the comparison of docs/metrics.md against a re-measurement of the tagged tree ended in || true under allow_failure: true. Issue #3624605.
The page was dated 2026-09-02 and claimed 1,342 files and 150,883 lines of code, against 1,358 files and 155,879 in the tree.
What changes
- The page counted itself. Writing it changed the tree it had just measured. On this tree two regenerations happened to agree, because the page they replaced had the same number of lines — luck, not a property: any change to the page's own length makes the next regeneration irreproducible.
mg_excluded_files()leavesdocs/metrics.mdout, so one regeneration is a fixed point whatever the page's length does. - cloc counts differently per version. The page records the version that measured it, read from the
cloc_versionthe JSON header already carries, and the job installs exactly that release instead of whateveraptoffers. - The walk is sorted, so two rows with the same count cannot swap places between one machine and another.
|| trueandallow_failureare gone, and the job also runs on a merge request touching the page or the generator, so this merge request's own pipeline exercises it.
Verification
- Regenerating twice produces identical pages.
- The page written on macOS (PHP 8.4) reproduces byte for byte in a Debian container (PHP 8.5) with the cloc the page names.
phpcs --standard=Drupal,DrupalPracticeclean onscripts/.
This carries across the fix made in orchestra #3624570.