From b0ccced3d8420e4e11676d271d711e15ccf5ffd9 Mon Sep 17 00:00:00 2001 From: Vincent Koc <25068+vincentkoc@users.noreply.github.com> Date: Sat, 11 Jul 2026 19:36:43 -0700 Subject: [PATCH] fix(release): allow generated ledger repair (cherry picked from commit e4a939839646297abd9aca3424cf0d2fca06c7e8) --- .../scripts/verify-release-notes.mjs | 15 ++++++++++----- test/scripts/verify-release-notes.test.ts | 13 +++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs b/.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs index 17034ffa3958..2f51adfffc5a 100644 --- a/.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs +++ b/.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs @@ -707,6 +707,12 @@ function contributionRecordMetadataReferences(record) { return references; } +export function renderedContributionRecordReferences(record, writeLedger) { + // Write mode replaces the existing generated record. Validating stale record + // references here would make the verifier unable to repair its own output. + return writeLedger ? [] : contributionRecordMetadataReferences(record); +} + export function contaminatingPullRequestReferences({ noteReferences, recordedReferences, @@ -2103,11 +2109,10 @@ function main() { ...source.revertedReferences, ...shippedExclusions.pullRequests, ]); - const effectiveRenderedRecord = options.writeLedger - ? withoutExcludedContributionRecords(renderedRecord, excludedRecordedReferences) - : renderedRecord; - const effectiveRenderedRecordReferences = - contributionRecordMetadataReferences(effectiveRenderedRecord); + const effectiveRenderedRecordReferences = renderedContributionRecordReferences( + renderedRecord, + options.writeLedger, + ); let priorRecord = { legacyIssues: new Map(), pullRequests: new Map() }; if (options.seedRef) { const seedChangelog = git(["show", `${options.seedRef}:CHANGELOG.md`]); diff --git a/test/scripts/verify-release-notes.test.ts b/test/scripts/verify-release-notes.test.ts index 858005c729aa..0b3474bce2b5 100644 --- a/test/scripts/verify-release-notes.test.ts +++ b/test/scripts/verify-release-notes.test.ts @@ -15,6 +15,7 @@ import { highlightCountError, persistGithubSnapshot, releaseNoteReferences, + renderedContributionRecordReferences, standardRevertedHash, subtractShippedPullRequests, withoutExcludedContributionRecords, @@ -373,6 +374,18 @@ describe("release-note verification", () => { ).toEqual([]); }); + it("ignores the stale generated record while rewriting it", () => { + const record = { + pullRequests: new Map([ + [104732, { references: [102289], thanks: ["fuller-stack-dev"] }], + ]), + legacyIssues: new Map(), + }; + + expect(renderedContributionRecordReferences(record, true)).toEqual([]); + expect(renderedContributionRecordReferences(record, false)).toEqual([104732, 102289]); + }); + it("excludes Unreleased records from a cumulative shipped tag boundary", () => { const changelog = [ "# Changelog",