mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 04:11:36 +00:00
fix(scripts): keep hosted-gate run queries under the gh relay response cap (#110540)
This commit is contained in:
committed by
GitHub
parent
78b4a4afed
commit
bbb45cde9d
@@ -17,7 +17,10 @@ const ARTIFACT_FALLBACK_REQUIRED_WORKFLOWS = [
|
||||
"Blacksmith ARM Testbox",
|
||||
"Workflow Sanity",
|
||||
];
|
||||
const WORKFLOW_RUNS_PAGE_SIZE = 100;
|
||||
// Full workflow-run objects are large enough for a 100-row response to exceed
|
||||
// the Octopool relay cap on busy SHAs. Keep each REST page bounded and retain
|
||||
// the existing 1,000-result search window through pagination.
|
||||
const WORKFLOW_RUNS_PAGE_SIZE = 30;
|
||||
const MAX_WORKFLOW_RUN_SEARCH_RESULTS = 1_000;
|
||||
const COMPARE_COMMITS_PAGE_SIZE = 100;
|
||||
export const HOSTED_GATE_MAX_AGE_HOURS = 24;
|
||||
@@ -333,7 +336,7 @@ export function parseWorkflowRunPage(raw) {
|
||||
export function workflowRunPageCount(totalCount) {
|
||||
return Math.min(
|
||||
Math.ceil(totalCount / WORKFLOW_RUNS_PAGE_SIZE),
|
||||
MAX_WORKFLOW_RUN_SEARCH_RESULTS / WORKFLOW_RUNS_PAGE_SIZE,
|
||||
Math.ceil(MAX_WORKFLOW_RUN_SEARCH_RESULTS / WORKFLOW_RUNS_PAGE_SIZE),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -925,8 +925,8 @@ describe("verify-pr-hosted-gates", () => {
|
||||
recentSha: previousSha,
|
||||
}),
|
||||
).toEqual([
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${sha}&per_page=100&page=1`,
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${previousSha}&per_page=100&page=1`,
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${sha}&per_page=30&page=1`,
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${previousSha}&per_page=30&page=1`,
|
||||
]);
|
||||
expect(HOSTED_GATE_MAX_AGE_HOURS).toBe(24);
|
||||
});
|
||||
@@ -939,14 +939,17 @@ describe("verify-pr-hosted-gates", () => {
|
||||
headBranch: "codex/relax hosted gates",
|
||||
}),
|
||||
).toEqual([
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${sha}&per_page=100&page=1`,
|
||||
"repos/openclaw/openclaw/actions/runs?branch=codex%2Frelax%20hosted%20gates&event=pull_request&per_page=100&page=1",
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${sha}&per_page=30&page=1`,
|
||||
"repos/openclaw/openclaw/actions/runs?branch=codex%2Frelax%20hosted%20gates&event=pull_request&per_page=30&page=1",
|
||||
]);
|
||||
});
|
||||
|
||||
it("bounds workflow-run pagination to GitHub's search result limit", () => {
|
||||
it("uses relay-safe pages and bounds pagination to GitHub's search result limit", () => {
|
||||
expect(workflowRunPageCount(0)).toBe(0);
|
||||
expect(workflowRunPageCount(101)).toBe(2);
|
||||
expect(workflowRunPageCount(10_000)).toBe(10);
|
||||
expect(workflowRunPageCount(101)).toBe(4);
|
||||
expect(workflowRunPageCount(10_000)).toBe(34);
|
||||
expect(workflowRunQueryPaths("openclaw/openclaw", { sha, recentSha: "" }, 34)).toEqual([
|
||||
`repos/openclaw/openclaw/actions/runs?head_sha=${sha}&per_page=30&page=34`,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user