Skip to content

Commit c2b4ac0

Browse files
committed
fix(release): align correction sections, retries, and merged ledger semantics
Codex review + test findings on the pipeline convergence: - candidate changelog provenance now validates the same section the renderer publishes (correction tags may carry their own heading) via a shared correctionVersionForTag helper - guard_existing_public_release accepts a canonical proofless body with intact dependency evidence, matching the renderer's documented proof-omitted-at-limit state; retries re-append the proof - ledgerFor regains main's noteReferences threading so prose-cited PRs keep their contribution-record rows, and the ledger/verify tests pin the merged entry shape (externalReferences) and highlight gate
1 parent 336e43c commit c2b4ac0

7 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,7 @@ export function ledgerFor(
13571357
priorRecord,
13581358
sourcePullRequests,
13591359
sourceReferences,
1360+
noteReferences,
13601361
legacyIssuePullRequests,
13611362
revertedReferences,
13621363
shippedBaselines,
@@ -1381,6 +1382,7 @@ export function ledgerFor(
13811382
const recordedPullRequests = new Set([
13821383
...sourcePullRequests,
13831384
...sourceReferences,
1385+
...noteReferences,
13841386
...legacyIssuePullRequests,
13851387
...priorRecord.pullRequests.keys(),
13861388
]);
@@ -1853,6 +1855,7 @@ function main() {
18531855
priorRecord,
18541856
source.pullRequests,
18551857
source.references,
1858+
noteReferences,
18561859
legacyIssuePullRequests,
18571860
source.revertedReferences,
18581861
source.shippedBaselines,

‎.github/workflows/openclaw-release-publish.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,16 @@ jobs:
898898
return 0
899899
fi
900900
901+
# The renderer omits the verification tail when the canonical body
902+
# already reaches GitHub's limit. A canonical proofless body with
903+
# intact dependency evidence is retry-safe: postpublish re-attempts
904+
# the proof append on this run.
905+
if [[ "${has_asset}" == "true" &&
906+
"${has_canonical_body}" == "true" &&
907+
"${has_proof}" != "true" ]]; then
908+
return 0
909+
fi
910+
901911
{
902912
echo "Release ${RELEASE_TAG} already has a public GitHub release page without complete postpublish evidence for ${TARGET_SHA}."
903913
echo "Refusing to reuse a public prerelease tag after publication started: ${release_url}"

‎scripts/release-candidate-checklist.mjs‎

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
88
import { stripLeadingPackageManagerSeparator } from "./lib/arg-utils.mjs";
99
import { readBoundedResponseText } from "./lib/bounded-response.mjs";
1010
import {
11+
correctionVersionForTag,
1112
extractChangelogReleaseSections,
1213
extractChangelogSection,
1314
formatShippedBaselineExclusions,
@@ -488,16 +489,30 @@ export function validateCandidateChangelogProvenance({
488489
isAncestor = gitIsAncestor,
489490
loadShippedBaseline = loadCandidateShippedBaseline,
490491
}) {
492+
// Validate the same section the renderer publishes: correction tags may
493+
// carry their own heading, and alpha tags may fall back to Unreleased.
491494
let section;
495+
let sectionVersion = version;
492496
let usesAlphaUnreleasedFallback = false;
493-
try {
494-
section = extractChangelogSection(changelog, version);
495-
} catch (error) {
496-
if (!/-alpha\.[1-9][0-9]*$/u.test(tag)) {
497-
throw error;
497+
const correctionVersion = correctionVersionForTag(tag);
498+
if (correctionVersion && correctionVersion !== version) {
499+
try {
500+
section = extractChangelogSection(changelog, correctionVersion);
501+
sectionVersion = correctionVersion;
502+
} catch {
503+
// The correction has no dedicated section; validate the base section.
504+
}
505+
}
506+
if (section === undefined) {
507+
try {
508+
section = extractChangelogSection(changelog, version);
509+
} catch (error) {
510+
if (!/-alpha\.[1-9][0-9]*$/u.test(tag)) {
511+
throw error;
512+
}
513+
section = releaseNotesSectionForTag(changelog, version, tag);
514+
usesAlphaUnreleasedFallback = true;
498515
}
499-
section = releaseNotesSectionForTag(changelog, version, tag);
500-
usesAlphaUnreleasedFallback = true;
501516
}
502517
const recordStart = section.search(/\n### Complete contribution record\r?$/m);
503518
if (recordStart < 0) {
@@ -508,12 +523,14 @@ export function validateCandidateChangelogProvenance({
508523
shippedBaselines: [],
509524
};
510525
}
511-
throw new Error(`CHANGELOG.md ## ${version} is missing ### Complete contribution record`);
526+
throw new Error(
527+
`CHANGELOG.md ## ${sectionVersion} is missing ### Complete contribution record`,
528+
);
512529
}
513530
const record = section.slice(recordStart);
514531
const recordedPullRequests = candidateContributionRecordPullRequests(
515532
section,
516-
`CHANGELOG.md ## ${version}`,
533+
`CHANGELOG.md ## ${sectionVersion}`,
517534
);
518535
const provenance = record.match(
519536
/^This audited record covers the complete (?<base>\S+)\.\.(?<target>[0-9a-f]{40}) history:/mu,
@@ -522,7 +539,7 @@ export function validateCandidateChangelogProvenance({
522539
const recordedTarget = provenance?.groups?.target;
523540
if (!base || !recordedTarget) {
524541
throw new Error(
525-
`CHANGELOG.md ## ${version} is missing exact complete contribution record provenance`,
542+
`CHANGELOG.md ## ${sectionVersion} is missing exact complete contribution record provenance`,
526543
);
527544
}
528545
const shippedBaselines = parseShippedBaselineExclusions(record);

‎scripts/render-github-release-notes.mjs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,22 @@ function compactReleaseNotes(section, repository, tag) {
230230
].join("\n");
231231
}
232232

233-
export function releaseNotesSectionForTag(changelog, version, tag) {
234-
// Numeric-correction tags (vX-N) prefer their own exact heading when the
235-
// changelog carries one; otherwise they fall back to the base version.
233+
export function correctionVersionForTag(tag) {
234+
// Numeric-correction tags (vX-N) may carry their own changelog heading;
235+
// alpha/beta prerelease tags never do.
236236
const taggedVersion = tag.replace(/^v/u, "");
237237
const isCorrection =
238238
/-[1-9][0-9]*$/u.test(taggedVersion) && !/-(?:alpha|beta)\.[1-9][0-9]*$/u.test(taggedVersion);
239-
if (isCorrection && taggedVersion !== version) {
239+
return isCorrection ? taggedVersion : undefined;
240+
}
241+
242+
export function releaseNotesSectionForTag(changelog, version, tag) {
243+
// Correction tags prefer their own exact heading when the changelog carries
244+
// one; otherwise they fall back to the base version.
245+
const correctionVersion = correctionVersionForTag(tag);
246+
if (correctionVersion && correctionVersion !== version) {
240247
try {
241-
return extractChangelogSection(changelog, taggedVersion);
248+
return extractChangelogSection(changelog, correctionVersion);
242249
} catch {
243250
// The correction has no dedicated section; use the base version below.
244251
}

‎test/scripts/package-acceptance-workflow.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Package Acceptance Workflow tests cover package acceptance workflow script behavior.
2-
import { spawnSync } from "node:child_process";
2+
import { execFileSync, spawnSync } from "node:child_process";
33
import { readdirSync, readFileSync, statSync } from "node:fs";
44
import { describe, expect, it } from "vitest";
55
import { parse } from "yaml";
@@ -2639,9 +2639,12 @@ describe("package artifact reuse", () => {
26392639
expect(clawHubMetadataIndex).toBeGreaterThan(clawHubSetupIndex);
26402640
expect(releaseWorkflow).toContain("Plugin npm run ID");
26412641
expect(releaseWorkflow).toContain("Plugin ClawHub run ID");
2642-
expect(releaseWorkflow).toContain(
2642+
expect(releaseWorkflow).not.toContain(
26432643
"did not return an Actions run URL; refusing to guess from recent workflow_dispatch runs",
26442644
);
2645+
expect(releaseWorkflow).not.toContain("return_run_details: true");
2646+
expect(releaseWorkflow).toContain("'.workflow_run_id'");
2647+
expect(releaseWorkflow).toContain("'.html_url'");
26452648
expect(releaseWorkflow).not.toContain("BEFORE_IDS=");
26462649
expect(releaseWorkflow).not.toContain("before_json");
26472650
expect(releaseWorkflow).toContain("plugin-clawhub-new.yml");

‎test/scripts/release-notes-ledger.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ describe("renderContributionRecordEntry", () => {
113113
new Set(),
114114
new Set(),
115115
new Set(),
116+
[],
116117
Date.parse("2026-07-09T00:00:00Z"),
117118
);
118119

@@ -146,6 +147,12 @@ describe("renderContributionRecordEntry", () => {
146147
"",
147148
"### Highlights",
148149
"",
150+
"- Highlight one.",
151+
"- Highlight two.",
152+
"- Highlight three.",
153+
"- Highlight four.",
154+
"- Highlight five.",
155+
"",
149156
"### Changes",
150157
"",
151158
"### Fixes",
@@ -181,6 +188,12 @@ describe("renderContributionRecordEntry", () => {
181188
"",
182189
"### Highlights",
183190
"",
191+
"- Highlight one.",
192+
"- Highlight two.",
193+
"- Highlight three.",
194+
"- Highlight four.",
195+
"- Highlight five.",
196+
"",
184197
"### Changes",
185198
"",
186199
"### Fixes",

‎test/scripts/verify-release-notes.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ describe("release-note verification", () => {
143143

144144
const filtered = withoutExcludedContributionRecords(record, new Set([2, 10]));
145145

146-
expect([...filtered.pullRequests]).toEqual([[1, { references: [], thanks: [] }]]);
147-
expect([...filtered.legacyIssues]).toEqual([[11, { references: [], thanks: [] }]]);
146+
expect([...filtered.pullRequests]).toEqual([
147+
[1, { externalReferences: [], references: [], thanks: [] }],
148+
]);
149+
expect([...filtered.legacyIssues]).toEqual([
150+
[11, { externalReferences: [], references: [], thanks: [] }],
151+
]);
148152
});
149153

150154
it("does not treat the shipped baseline inventory as current release-note references", () => {

0 commit comments

Comments
 (0)