perf(ci): start source feedback early and diagnose stalled runs (#3013)
* perf(ci): start source feedback early and diagnose stalled runs * fix(ci): verify workflow identities before main comparison limits * fix(ci): preserve diagnostics across passing checks and install failures * fix(ci): preserve ambiguous workflow run ordering * fix(ci): preserve failure-report candidate and request budgets * fix(ci): retain candidate errors while checking later main evidence * fix(ci): retain partial reports and require complete health scans * test(ci): prune stale fixtures and duplicated assumptions
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { expect, it } from "vitest";
|
||||
import { normalizeWorkflowRun } from "../../../scripts/ci/workflow-run.mjs";
|
||||
|
||||
it.each([
|
||||
[".github/workflows/ci.yml", ".github/workflows/ci.yml", null],
|
||||
[".github/workflows/ci.yml@main", ".github/workflows/ci.yml", "main"],
|
||||
[
|
||||
".github/workflows/ci.yml@refs/heads/release/v1",
|
||||
".github/workflows/ci.yml",
|
||||
"refs/heads/release/v1",
|
||||
],
|
||||
[
|
||||
".github/workflows/ci.yml@feature@v1",
|
||||
".github/workflows/ci.yml",
|
||||
"feature@v1",
|
||||
],
|
||||
[
|
||||
".github/workflows/release.yaml@main",
|
||||
".github/workflows/release.yaml",
|
||||
"main",
|
||||
],
|
||||
])(
|
||||
"preserves API path %s while separating its file identity and ref",
|
||||
(path, file, ref) => {
|
||||
const raw = { id: 10, path, head_sha: "a".repeat(40) };
|
||||
const parsed = normalizeWorkflowRun(raw);
|
||||
expect(parsed).toEqual({ ...raw, workflowPath: { file, ref } });
|
||||
expect(raw).not.toHaveProperty("workflowPath");
|
||||
},
|
||||
);
|
||||
|
||||
it.each([
|
||||
undefined,
|
||||
null,
|
||||
42,
|
||||
"",
|
||||
".github/workflows/ci.yml@",
|
||||
".github/workflows/ci.yml@main\n",
|
||||
".github/workflows/ci.yml@main\0",
|
||||
"../.github/workflows/ci.yml",
|
||||
".github/workflows/../ci.yml@main",
|
||||
".github/workflows/ci.yml-extra@main",
|
||||
"https://example.test/ci.yml@main",
|
||||
])(
|
||||
"keeps malformed workflow path %s unknown instead of inventing a file identity",
|
||||
(path) => {
|
||||
const parsed = normalizeWorkflowRun({
|
||||
path,
|
||||
workflowPath: { file: ".github/workflows/ci.yml", ref: "main" },
|
||||
});
|
||||
expect(parsed.path).toBe(path);
|
||||
expect(parsed.workflowPath).toBeNull();
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user