fix(ci): reject deleted package changelogs - #3946
Conversation
The released-heading guard caught emptied files but treated a deleted head file as exempt. A deleted package changelog loses the same released history and must fail through the existing violation contract. Tested: bun test scripts/changelog-history-guard.test.ts
1600040 to
96a1e80
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1600040c7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (headText === undefined) { | ||
| if (before.length === 0) return undefined; | ||
| return { file, removed: before, baseHeadingCount: before.length, headHeadingCount: 0 }; |
There was a problem hiding this comment.
Disable rename detection while enumerating changelogs
When a package changelog is moved and edited but remains similar enough for Git to classify it as a rename, this deletion branch is never reached. In the dev-ci.yml guard, Git 2.43 reports such a change as R072 packages/a/CHANGELOG.md packages/b/CHANGELOG.md, while the current git diff --name-only returns only the destination; collectViolations then finds no file at that destination in the base and exempts it, allowing removed released headings to pass CI. Enumerate with --no-renames or process both sides of rename records so the source deletion is checked.
AGENTS.md reference: AGENTS.md:L178-L178
Useful? React with 👍 / 👎.
What
Makes the released CHANGELOG history guard fail closed when a package CHANGELOG existed at the base but is deleted at the PR head. Files absent at the base remain exempt.
Why
#3941 catches emptied CHANGELOGs but its
headText === undefinedexemption allows complete deletion to bypass the same append-only history contract.Verification
bun test scripts/changelog-history-guard.test.ts(12 pass)Follow-up to #3941 and #3942.