mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-23 10:55:31 -06:00
fix(release): allow generated ledger repair
(cherry picked from commit e4a9398396)
This commit is contained in:
@@ -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`]);
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user