Skip to content

Commit 57ae43a

Browse files
committed
fix(ci): harden full release validation
1 parent e322edc commit 57ae43a

3 files changed

Lines changed: 19 additions & 89 deletions

File tree

‎.github/workflows/openclaw-performance.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ env:
7171
OCM_LINUX_X64_SHA256: 57530199d21eb5bfa29695749928b40fd2869484c7edff69b7c65bfc84f2f1aa
7272
KOVA_REPOSITORY: openclaw/Kova
7373
PERFORMANCE_MODEL_ID: gpt-5.6-luna
74-
KOVA_SCENARIO_TIMEOUT_MS: "300000"
74+
# Release matrices cold-build the candidate runtime before measurement.
75+
KOVA_SCENARIO_TIMEOUT_MS: ${{ inputs.profile == 'release' && '900000' || '300000' }}
7576

7677
jobs:
7778
resolve_target:

‎scripts/full-release-validation-at-sha.mjs‎

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,6 @@ const DEFAULT_INPUTS = {
1616
rerun_group: "all",
1717
reuse_evidence: "true",
1818
};
19-
const WORKFLOW_RUN_CHECK_SUITE_QUERY = `
20-
query($owner: String!, $repo: String!, $oid: GitObjectID!, $after: String) {
21-
repository(owner: $owner, name: $repo) {
22-
object(oid: $oid) {
23-
... on Commit {
24-
checkSuites(first: 100, after: $after) {
25-
nodes {
26-
status
27-
conclusion
28-
workflowRun {
29-
url
30-
}
31-
}
32-
pageInfo {
33-
hasNextPage
34-
endCursor
35-
}
36-
}
37-
}
38-
}
39-
}
40-
}`;
4119

4220
function usage() {
4321
console.error(`Usage: node scripts/full-release-validation-at-sha.mjs [--sha <target-sha>] [--target-ref <canonical-release-branch-or-tag>] [--workflow-sha <trusted-main-ref>] [--keep-branch] [--dry-run] [-- -f key=value ...]
@@ -282,50 +260,19 @@ function findLatestRunId(branch, sha) {
282260
return match?.databaseId ? String(match.databaseId) : "";
283261
}
284262

285-
export function selectWorkflowRunCheckSuite(nodes, parentRunId) {
263+
function readWorkflowRun(parentRunId, workflowSha) {
286264
if (!/^[1-9][0-9]*$/u.test(String(parentRunId))) {
287265
throw new Error("parent run ID must be a positive decimal");
288266
}
289-
const expectedUrl = `https://github.com/openclaw/openclaw/actions/runs/${parentRunId}`;
290-
return nodes.find((node) => node?.workflowRun?.url === expectedUrl);
291-
}
292-
293-
function readWorkflowRunCheckSuite(parentRunId, workflowSha) {
294-
let after;
295-
for (let page = 0; page < 20; page += 1) {
296-
const queryArgs = [
297-
"api",
298-
"graphql",
299-
"-F",
300-
"owner=openclaw",
301-
"-F",
302-
"repo=openclaw",
303-
"-F",
304-
`oid=${workflowSha}`,
305-
"-f",
306-
`query=${WORKFLOW_RUN_CHECK_SUITE_QUERY}`,
307-
];
308-
if (after) {
309-
queryArgs.push("-F", `after=${after}`);
310-
}
311-
const response = JSON.parse(run("gh", queryArgs));
312-
const checkSuites = response?.data?.repository?.object?.checkSuites;
313-
if (!checkSuites || !Array.isArray(checkSuites.nodes)) {
314-
throw new Error("GraphQL response did not include commit check suites");
315-
}
316-
const match = selectWorkflowRunCheckSuite(checkSuites.nodes, parentRunId);
317-
if (match) {
318-
return match;
319-
}
320-
if (!checkSuites.pageInfo?.hasNextPage) {
321-
return undefined;
322-
}
323-
after = checkSuites.pageInfo.endCursor;
324-
if (!after) {
325-
throw new Error("GraphQL check-suite pagination omitted its end cursor");
326-
}
267+
const workflowRun = JSON.parse(
268+
run("gh", ["api", `repos/openclaw/openclaw/actions/runs/${parentRunId}`]),
269+
);
270+
if (workflowRun.head_sha !== workflowSha) {
271+
throw new Error(
272+
`Full Release Validation run ${parentRunId} head ${String(workflowRun.head_sha)} does not match trusted workflow SHA ${workflowSha}`,
273+
);
327274
}
328-
throw new Error("Full Release Validation check suite was not found within 20 pages");
275+
return workflowRun;
329276
}
330277

331278
function waitForWorkflowRun(parentRunId, workflowSha) {
@@ -334,7 +281,7 @@ function waitForWorkflowRun(parentRunId, workflowSha) {
334281
for (let attempt = 0; attempt < 480; attempt += 1) {
335282
let suite;
336283
try {
337-
suite = readWorkflowRunCheckSuite(parentRunId, workflowSha);
284+
suite = readWorkflowRun(parentRunId, workflowSha);
338285
consecutiveErrors = 0;
339286
} catch (error) {
340287
consecutiveErrors += 1;
@@ -345,15 +292,13 @@ function waitForWorkflowRun(parentRunId, workflowSha) {
345292
console.warn(`Parent run status query failed; retrying: ${message}`);
346293
}
347294

348-
const summary = suite
349-
? `${String(suite.status).toLowerCase()}/${String(suite.conclusion ?? "pending").toLowerCase()}`
350-
: "awaiting-check-suite";
295+
const summary = `${String(suite?.status ?? "pending").toLowerCase()}/${String(suite?.conclusion ?? "pending").toLowerCase()}`;
351296
if (summary !== lastSummary) {
352297
console.log(`Parent run status: ${summary}`);
353298
lastSummary = summary;
354299
}
355-
if (suite?.status === "COMPLETED") {
356-
if (suite.conclusion === "SUCCESS") {
300+
if (suite?.status === "completed") {
301+
if (suite.conclusion === "success") {
357302
return;
358303
}
359304
throw new Error(

‎test/scripts/full-release-validation-at-sha.test.ts‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
releaseEvidenceVerificationArgs,
99
releaseEvidenceVerifierPath,
1010
resolveRemoteTargetRefSha,
11-
selectWorkflowRunCheckSuite,
1211
} from "../../scripts/full-release-validation-at-sha.mjs";
1312

1413
describe("full-release-validation-at-sha", () => {
@@ -148,26 +147,11 @@ describe("full-release-validation-at-sha", () => {
148147
expect(() => releaseEvidenceVerificationArgs("")).toThrow("positive decimal");
149148
});
150149

151-
it("selects the exact workflow run through GraphQL check-suite metadata", () => {
152-
const nodes = [
153-
{
154-
status: "COMPLETED",
155-
conclusion: "SUCCESS",
156-
workflowRun: { url: "https://github.com/openclaw/openclaw/actions/runs/122" },
157-
},
158-
{
159-
status: "IN_PROGRESS",
160-
conclusion: null,
161-
workflowRun: { url: "https://github.com/openclaw/openclaw/actions/runs/123" },
162-
},
163-
];
164-
165-
expect(selectWorkflowRunCheckSuite(nodes, "123")).toEqual(nodes[1]);
166-
expect(selectWorkflowRunCheckSuite(nodes, "999")).toBeUndefined();
167-
expect(() => selectWorkflowRunCheckSuite(nodes, "")).toThrow("positive decimal");
168-
150+
it("polls the exact workflow run without GraphQL quota use", () => {
169151
const source = readFileSync("scripts/full-release-validation-at-sha.mjs", "utf8");
170-
expect(source).toContain("checkSuites(first: 100, after: $after)");
152+
expect(source).toContain("actions/runs/${parentRunId}");
153+
expect(source).toContain("workflowRun.head_sha !== workflowSha");
154+
expect(source).not.toContain('"graphql"');
171155
expect(source).not.toContain('["run", "watch"');
172156
});
173157

0 commit comments

Comments
 (0)