mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(release): accept explicit provenance mappings (#120842)
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
githubApiWithSnapshot,
|
||||
highlightCountError,
|
||||
isEligibleHandle,
|
||||
parseArgs,
|
||||
persistGithubSnapshot,
|
||||
pullRequestTitleFromCommitSubject,
|
||||
releaseNoteReferences,
|
||||
@@ -275,6 +276,74 @@ describe("release-note verification", () => {
|
||||
).toThrow(`conflicting release provenance markers for ${releaseCommit}`);
|
||||
});
|
||||
|
||||
it("accepts repeatable CLI provenance without metadata commits", () => {
|
||||
const mappings: Array<[string, number]> = [
|
||||
["bdde3d1c6dd7cc415588a72cf27ebe27f83bfe47", 120085],
|
||||
["5090cae6d0cc3f2ec272b2448970c6238f525610", 120479],
|
||||
["8ff1724067c1dcfb9a63574e6f3771261033ffae", 120479],
|
||||
["0cd3075adf7cd201e17d25c95cbe190991f8aab1", 120538],
|
||||
];
|
||||
const payloads = mappings.map(([commit, pullRequest]) => `${commit} -> #${pullRequest}`);
|
||||
const options = parseArgs([
|
||||
"--base",
|
||||
"base",
|
||||
"--target",
|
||||
"target",
|
||||
"--version",
|
||||
"2026.8.1",
|
||||
...payloads.flatMap((payload) => ["--release-provenance", payload]),
|
||||
]);
|
||||
|
||||
expect(options.releaseProvenance).toEqual(payloads);
|
||||
expect(
|
||||
collectReleaseProvenanceOverrides(
|
||||
mappings.map(([hash]) => ({ body: "", hash })),
|
||||
options.releaseProvenance,
|
||||
),
|
||||
).toEqual(new Map(mappings.map(([commit, pullRequest]) => [commit, [pullRequest]])));
|
||||
});
|
||||
|
||||
it("validates CLI provenance through the exact marker merge path", () => {
|
||||
const activeCommit = "a".repeat(40);
|
||||
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides([{ body: "", hash: activeCommit }], ["short -> #1"]),
|
||||
).toThrow("invalid release provenance marker");
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides(
|
||||
[{ body: "", hash: activeCommit }],
|
||||
[`${activeCommit} -> #1 trailing`],
|
||||
),
|
||||
).toThrow("invalid release provenance marker");
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides(
|
||||
[{ body: "", hash: activeCommit }],
|
||||
[`${activeCommit} -> #1\nRelease provenance: ${activeCommit} -> #2`],
|
||||
),
|
||||
).toThrow("invalid release provenance marker");
|
||||
for (const payload of [
|
||||
`${activeCommit} -> #1\n`,
|
||||
`${activeCommit} -> #1,\n#2`,
|
||||
`${activeCommit} -> #1\r\n`,
|
||||
]) {
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides([{ body: "", hash: activeCommit }], [payload]),
|
||||
).toThrow("invalid release provenance marker");
|
||||
}
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides(
|
||||
[{ body: "", hash: activeCommit }],
|
||||
[`${"b".repeat(40)} -> #1`],
|
||||
),
|
||||
).toThrow("release provenance marker targets commit outside the active range");
|
||||
expect(() =>
|
||||
collectReleaseProvenanceOverrides(
|
||||
[{ body: `Release provenance: ${activeCommit} -> #1`, hash: activeCommit }],
|
||||
[`${activeCommit} -> #2`],
|
||||
),
|
||||
).toThrow(`conflicting release provenance markers for ${activeCommit}`);
|
||||
});
|
||||
|
||||
it("requires release provenance PRs to be merged into current main", () => {
|
||||
const releaseCommit = "a".repeat(40);
|
||||
const mainCommit = "b".repeat(40);
|
||||
|
||||
Reference in New Issue
Block a user