Problem/Motivation

docs/metrics.md is a snapshot of the project's own size, regenerated by hand with scripts/generate-metrics.php. Nothing re-measures it when a release is cut, so the page drifts until somebody remembers.

The opposite mistake is worth naming, because a sibling project made it: kessai had a unit test that read the published hook count back out of the page and compared it against the source, so every merge request adding a hook had to regenerate the page or go red. That turns a once-per-release question into a tax on every contributor. Neither extreme is wanted here.

Proposed resolution

Port the metrics job audit_trail already runs: rules: - if: $CI_COMMIT_TAG, so it exists on a tag and sits the rest of the time out, and allow_failure: true, because the tag exists by the time the job runs and there is nothing left to prevent. It prints a diff for a maintainer to read rather than gating anything.

Two details carried over with it. It measures from git archive into /tmp rather than in place, because the pipeline builds a whole Drupal underneath the project directory and cloc run there would count core as well. And the diff is not evidence of staleness on its own: the page counts the file it writes, so even a page a maintainer correctly regenerated and committed does not reproduce byte for byte.

The generator gains METRICS_DATE, which audit_trail's already had, so the re-measurement reproduces the committed page's date instead of reporting the day it ran as the only difference.

Remaining tasks

None. The two existing metrics tests are deliberately left alone: MetricsTestCountingTest and MetricsWriteTest exercise the generator, how it counts a class's test methods and that a refused write is reported non-zero, rather than whether the published page is current. That is the distinction kessai got wrong.

User interface changes

None.

API changes

None.

Data model changes

None.

AI-Generated: Yes (Claude Code was used to help draft this issue summary and to write the code on the merge request. I reviewed and ran the work myself before posting it.)

Issue fork orchestra-3622851

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed df96d29f on 1.x
    task: #3622851 Measure the codebase on a tag
    
    By: mably
    
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.