fix(hopper): verify lease cleanup and repair the macOS test lane (#1111)

* fix(hopper): distinguish shared lease roots from leaked sessions

* fix(ci): follow the moved process CLI regression tests
This commit is contained in:
Ysopwnable
2026-10-09 02:41:34 +08:00
committed by GitHub
parent ec6db0f063
commit b743bd20a0
6 changed files with 253 additions and 46 deletions
+48 -14
View File
@@ -4,23 +4,48 @@ import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { parse } from "yaml";
import { z } from "zod";
const WORKFLOW = join(".github", "workflows", "ci.yml");
const curatedPaths = async (): Promise<string[]> => {
const workflow = parse(await readFile(WORKFLOW, "utf8")) as {
jobs?: Record<string, { steps?: { run?: string }[] }>;
};
const run = workflow.jobs?.["windows-curated"]?.steps
?.map((step) => step.run)
.find((value) => value?.includes("npx vitest run"));
expect(run, "expected a curated Windows vitest invocation").toBeDefined();
return (
run
?.split(/\s+/)
.filter((token) => token.endsWith(".test.ts"))
.sort() ?? []
const workflowSchema = z.object({
jobs: z.record(
z.string(),
z.object({
steps: z.array(z.object({ run: z.string().optional() })).optional(),
}),
),
});
const explicitPaths = async (
lane: "windows" | "focused",
): Promise<string[]> => {
const workflow = workflowSchema.parse(
parse(await readFile(WORKFLOW, "utf8")),
);
const runs =
lane === "windows"
? (workflow.jobs["windows-curated"]?.steps
?.map((step) => step.run)
.filter((value) => value?.includes("npx vitest run")) ?? [])
: Object.values(workflow.jobs)
.flatMap((job) => job.steps ?? [])
.map((step) => step.run)
.filter((value) =>
value?.trim().startsWith("npm run test:focused -- "),
);
expect(
runs.length,
`expected explicit ${lane} CI test invocations`,
).toBeGreaterThan(0);
return [
...new Set(
runs.flatMap(
(run) =>
run?.split(/\s+/).filter((token) => token.endsWith(".test.ts")) ?? [],
),
),
].sort();
};
const exists = async (path: string): Promise<boolean> =>
@@ -31,7 +56,7 @@ const exists = async (path: string): Promise<boolean> =>
describe("curated Windows test lane", () => {
it("references only test files that exist", async () => {
const paths = await curatedPaths();
const paths = await explicitPaths("windows");
expect(paths.length).toBeGreaterThan(0);
const missing = await Promise.all(
paths.map(async (path) => ((await exists(path)) ? undefined : path)),
@@ -39,3 +64,12 @@ describe("curated Windows test lane", () => {
expect(missing.filter((path) => path !== undefined)).toEqual([]);
}, 10_000);
});
it("keeps every explicit focused CI test path executable after file moves", async () => {
const paths = await explicitPaths("focused");
expect(paths.length).toBeGreaterThan(0);
const missing = await Promise.all(
paths.map(async (path) => ((await exists(path)) ? undefined : path)),
);
expect(missing.filter((path) => path !== undefined)).toEqual([]);
}, 10_000);