Skip to content

fix(changelog): break infinite regenerate self-trigger loop - #988

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/changelog-loop-20260922-154144
Sep 22, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/changelog-loop-20260922-154144

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Fixes the infinite-changelog-PR loop surfaced by maa-framework#219: merging one changelog PR added a new chore(changelog): regenerate from conventional commits (#NNN) commit that git-cliff picked up under Chores, producing a fresh diff and opening the next PR. maa-framework accumulated 21 such commits in its last 50 before being detected.

What changed

Two complementary guards:

  1. templates/cliff.toml — primary fix. Add a skip = true parser for the bot's own chore(changelog): regenerate from conventional commits subjects, placed before the generic ^chore matcher (commit_parsers is first-match-wins). The regex matches both the branch commit subject and the default GitHub squash-merge subject (... (#NNN)), which is essential because in pr-back mode the squash-merge subject — not the branch commit body — is what lands on main.

  2. .github/workflows/changelog-reusable.yml — defense-in-depth:

    • New guard job short-circuits the entire generate job when the triggering HEAD commit message already contains [skip changelog].
    • Every commit/PR body produced by the workflow now carries the [skip changelog] marker, so the guard fires on commit-back's direct push and (if the PR description is preserved) on squash-merge of pr-back PRs.
    • In pr-back mode, older open bot/changelog-* PRs against the same base are closed when a newer regeneration is pushed, preventing PR-spam when pushes land faster than merges.

Verification

Verified locally against current maa-framework main:

  • Before: 166-line CHANGELOG with 21 consecutive Regenerate from conventional commits bullets.
  • After patched cliff.toml: 145-line CHANGELOG with 0 such bullets.
  • Simulating the squash-merge of the final cleanup PR and re-running git-cliff produces zero diff — loop terminates.

Rollout

This fix is backward-compatible: because changelog-reusable.yml checks out cliff.toml from standards@main at runtime (not from the pinned SHA), merging this PR will immediately fix the loop for every caller (commit-back and pr-back) on their next run, with no caller-side SHA bump required.

Maa-framework PR #219 and any other currently-open bot/changelog-* PRs should be closed before this merges (they were opened by the buggy config and will produce spam if merged). After merge, the next push to any affected caller's main (or a manual workflow re-run) will produce one final cleanup PR with the spammy bullets stripped; merging that cleanup PR produces no further PRs.

Surfaced by maa-framework#219: the changelog-reusable workflow was opening
an unending chain of PRs (#199, #202–#219, ...) because each squash-merge
of a changelog PR added a new conventional commit
(`chore(changelog): regenerate from conventional commits (#NNN)`) which
git-cliff picked up under Chores, producing a fresh diff and opening the
next PR.

Two complementary guards added:

1. templates/cliff.toml — add a skip = true commit_parser for the bot's
   own `chore(changelog): regenerate ...` subjects, placed BEFORE the
   generic ^chore matcher (commit_parsers is first-match-wins). This is
   the primary fix because it survives GitHub's squash-merge (which uses
   the PR title as the new subject on main).

2. changelog-reusable.yml — add a `guard` job that short-circuits when
   the triggering HEAD commit already carries a [skip changelog] marker,
   and tag every commit/PR body the workflow produces with that marker.
   In pr-back mode, also close older open bot/changelog-* PRs against
   the same base to prevent duplicate-PR spam when pushes land between
   merges.

Verified end-to-end against maa-framework's current HEAD: after applying
the cliff.toml skip rule, re-running git-cliff produces zero diff even
after a simulated squash-merge of the cleanup PR.
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 6a36a40a-829d-4ce4-9580-2838a222b5f3

📥 Commits

Reviewing files that changed from the base of the PR and between f95130b and 3f50f55.

📒 Files selected for processing (2)
  • .github/workflows/changelog-reusable.yml
  • templates/cliff.toml
 __________________________________________________________________
< Engage! Making your code boldly go where no one has gone before. >
 ------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@hyperpolymath
hyperpolymath merged commit d1bd7f4 into main Sep 22, 2026
41 of 44 checks passed
@hyperpolymath
hyperpolymath deleted the fix/changelog-loop-20260922-154144 branch September 22, 2026 15:47
name: Check for self-trigger loop
runs-on: ${{ inputs.runs-on }}
outputs:
skip: ${{ steps.loopguard.outputs.skip }}
hyperpolymath added a commit to hyperpolymath/maa-framework that referenced this pull request Sep 22, 2026
#222)

One-line CHANGELOG update: adds the missing bullet for the loop-fix PR
(#221) itself.

## Why this PR exists

When #221 merged, its commit body contained the `[skip changelog]`
marker (added by the job-level `if:` guard that broke the infinite
loop), so the workflow run after merge correctly skipped itself rather
than opening a regeneration PR. That was the right call for
loop-prevention, but it means the fix commit itself was never recorded
in the changelog. This PR adds that one bullet.

## Why this is the LAST changelog PR

Merging this PR will NOT open another changelog PR, because:

1. The PR title matches the subject-matcher skip rule in the local
`cliff.toml` override (`^chore\\(changelog\\):\\s*regenerate from
conventional commits`), so git-cliff will skip this commit when
computing the next CHANGELOG.
2. The commit body (and this PR body) carry `[skip changelog]`, which
triggers both the caller's job-level `if:` guard and the body-matcher
skip rule in cliff.toml.

The canonical fix in
[standards#988](hyperpolymath/standards#988)
applies the same skip rules to all estate repos. Once that merges, the
local `cliff.toml` in this repo should be deleted in a follow-up.

[skip changelog]

Co-authored-by: hyperpolymath-bot <github-actions[bot]@users.noreply.github.com>
hyperpolymath added a commit to hyperpolymath/maa-framework that referenced this pull request Sep 22, 2026
…rged (#223)

## Summary

Follow-up to #221 / standards#988. The local `cliff.toml` was added as
an emergency hotfix for the infinite changelog loop. The canonical fix
has now landed in
[hyperpolymath/standards#988](hyperpolymath/standards#988):
the canonical `templates/cliff.toml` at `standards@main` contains the
same `chore(changelog): regenerate …` subject-matcher skip rule.

## Verification

- `git-cliff --config <canonical cliff.toml>` against current `main`
produces byte-identical `CHANGELOG.md` — no changelog drift, no
CHANGELOG.md update needed in this PR.
- Returns the repo to the documented convention stated in
`changelog.yml`: "no local cliff.toml by design — one config for the
estate".
- The reusable workflow checks out cliff.toml from `standards@main` at
runtime (not from the SHA-pinned reusable), so future canonical updates
continue to propagate immediately to this repo.

[skip changelog]

Co-authored-by: hyperpolymath-bot <github-actions[bot]@users.noreply.github.com>
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