Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(e2e): clean up selection script and tests

Steven Enamakel3f03ac7f940b
diff --git a/app/scripts/e2e-web-selection.mjs b/app/scripts/e2e-web-selection.mjs
index f655b2eeac..0c530049be 100644
--- a/app/scripts/e2e-web-selection.mjs
+++ b/app/scripts/e2e-web-selection.mjs
@@ -7,9 +7,7 @@ import { fileURLToPath } from 'node:url';
const appRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const contractPath = path.join(appRoot, 'scripts/e2e-web-selection-contract.json');
-const allowedDiagnosticPaths = new Set([
- 'test/playwright/specs/aui-tool-result-elements.spec.ts',
-]);
+const allowedDiagnosticPaths = new Set(['test/playwright/specs/aui-tool-result-elements.spec.ts']);
function sortedUnique(paths, label) {
const sorted = [...paths].sort();
@@ -54,7 +52,8 @@ export function classifySpecFiles(discoveredPaths, contract) {
}
const overlap = diagnostic.filter(file => owners.includes(file));
- if (overlap.length) throw new Error(`diagnostic and required owner overlap: ${overlap.join(', ')}`);
+ if (overlap.length)
+ throw new Error(`diagnostic and required owner overlap: ${overlap.join(', ')}`);
const required = discovered.filter(file => !diagnostic.includes(file));
if (required.length === 0 || diagnostic.length === 0) {
throw new Error('required and diagnostic selections must both be non-empty');
@@ -127,9 +126,7 @@ function main(args) {
}
const contract = JSON.parse(readFileSync(contractPath, 'utf8'));
const result = resolveSelection(selection, { contract });
- process.stdout.write(
- asJson ? `${JSON.stringify(result)}\n` : `${result.files.join('\n')}\n`
- );
+ process.stdout.write(asJson ? `${JSON.stringify(result)}\n` : `${result.files.join('\n')}\n`);
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
diff --git a/scripts/__tests__/e2e-web-shards.test.mjs b/scripts/__tests__/e2e-web-shards.test.mjs
index 1758cbdba4..a8724a8fa4 100644
--- a/scripts/__tests__/e2e-web-shards.test.mjs
+++ b/scripts/__tests__/e2e-web-shards.test.mjs
@@ -99,17 +99,38 @@ test("strict and diagnostic selections partition discovered specs fail-closed",
assert.equal(diagnostic.files.length, 1);
assert.match(diagnostic.files[0], /aui-tool-result-elements\.spec\.ts$/);
- assert.ok(required.files.includes("test/playwright/specs/agent-review.spec.ts"));
- assert.ok(required.files.includes("test/playwright/specs/command-palette-keyboard.spec.ts"));
- assert.ok(required.files.includes("test/playwright/specs/skills-search-install.spec.ts"));
- assert.ok(required.files.includes("test/playwright/specs/connections-tab-deeplinks.spec.ts"));
- assert.ok(required.files.includes("test/playwright/specs/webhooks-tunnel-flow.spec.ts"));
+ assert.ok(
+ required.files.includes("test/playwright/specs/agent-review.spec.ts"),
+ );
+ assert.ok(
+ required.files.includes(
+ "test/playwright/specs/command-palette-keyboard.spec.ts",
+ ),
+ );
+ assert.ok(
+ required.files.includes(
+ "test/playwright/specs/skills-search-install.spec.ts",
+ ),
+ );
+ assert.ok(
+ required.files.includes(
+ "test/playwright/specs/connections-tab-deeplinks.spec.ts",
+ ),
+ );
+ assert.ok(
+ required.files.includes(
+ "test/playwright/specs/webhooks-tunnel-flow.spec.ts",
+ ),
+ );
assert.deepEqual(
[...required.files, ...diagnostic.files].sort(),
all.files,
"required and diagnostic must be disjoint and cover all discovered specs",
);
- assert.equal(new Set([...required.files, ...diagnostic.files]).size, all.files.length);
+ assert.equal(
+ new Set([...required.files, ...diagnostic.files]).size,
+ all.files.length,
+ );
});
test("selection classifier rejects unknown diagnostics and protected-owner demotion", () => {
@@ -133,7 +154,9 @@ test("selection classifier rejects unknown diagnostics and protected-owner demot
"test/playwright/specs/owner.spec.ts",
"test/playwright/specs/aui-tool-result-elements.spec.ts",
],
- diagnostics: [{ path: "test/playwright/specs/aui-tool-result-elements.spec.ts" }],
+ diagnostics: [
+ { path: "test/playwright/specs/aui-tool-result-elements.spec.ts" },
+ ],
},
),
/protected browser owners cannot be diagnostic/,
@@ -146,7 +169,10 @@ test("diagnostic source bytes are pinned to their reviewed baseline", () => {
verifyDiagnosticBytes(
{
diagnostics: [
- { path: "test/playwright/specs/legacy.spec.ts", sha256: "0".repeat(64) },
+ {
+ path: "test/playwright/specs/legacy.spec.ts",
+ sha256: "0".repeat(64),
+ },
],
},
() => Buffer.from("changed bytes"),
@@ -166,7 +192,10 @@ test("CI Full requires every Playwright lane and manual workflow shares the arti
);
const job = full.slice(
full.indexOf(" playwright-e2e:"),
- full.indexOf(" # Runs only the exact unchanged AUI", full.indexOf(" playwright-e2e:")),
+ full.indexOf(
+ " # Runs only the exact unchanged AUI",
+ full.indexOf(" playwright-e2e:"),
+ ),
);
assert.match(job, /fail-fast:\s*false/);
assert.match(job, /lane:\s*\[1, 2, 3, 4\]/);
@@ -185,11 +214,19 @@ test("CI Full requires every Playwright lane and manual workflow shares the arti
);
const diagnosticJob = full.slice(
full.indexOf(" playwright-legacy-diagnostic:"),
- full.indexOf(" # Full desktop E2E", full.indexOf(" playwright-legacy-diagnostic:")),
+ full.indexOf(
+ " # Full desktop E2E",
+ full.indexOf(" playwright-legacy-diagnostic:"),
+ ),
);
assert.match(diagnosticJob, /continue-on-error:\s*true/);
assert.match(diagnosticJob, /--selection=diagnostic/);
- assert.doesNotMatch(full.match(/needs:\s*\[[^\]]*playwright-legacy-diagnostic[^\]]*\]/g)?.join("\n") ?? "", /./);
+ assert.doesNotMatch(
+ full
+ .match(/needs:\s*\[[^\]]*playwright-legacy-diagnostic[^\]]*\]/g)
+ ?.join("\n") ?? "",
+ /./,
+ );
});
test("required selection forwards every healthy spec and never the diagnostic file", () => {
@@ -221,7 +258,9 @@ test("required selection forwards every healthy spec and never the diagnostic fi
]) {
assert.match(joined, new RegExp(required.replaceAll(".", "\\.")));
}
- assert.ok(calls.every((call) => call.includes("/selection-required/lane-4/")));
+ assert.ok(
+ calls.every((call) => call.includes("/selection-required/lane-4/")),
+ );
});
test("diagnostic selection is one file-atomic unit and propagates failure", () => {
@@ -247,7 +286,10 @@ test("diagnostic selection is one file-atomic unit and propagates failure", () =
assert.equal(
fs
.readFileSync(
- path.join(workspace, "selection-diagnostic/lane-1/receipts/diagnostic-0.exit"),
+ path.join(
+ workspace,
+ "selection-diagnostic/lane-1/receipts/diagnostic-0.exit",
+ ),
"utf8",
)
.trim(),
@@ -284,7 +326,11 @@ test("failure artifact names are unique across all four Playwright lanes", () =>
];
for (const [workflow, source] of workflows) {
- const matches = [...source.matchAll(/name: (e2e-playwright-[^\r\n]*failure-logs-[^\r\n]+)/g)];
+ const matches = [
+ ...source.matchAll(
+ /name: (e2e-playwright-[^\r\n]*failure-logs-[^\r\n]+)/g,
+ ),
+ ];
assert.ok(matches.length, `${workflow} must upload its failure artifact`);
const laneNames = matches.flatMap((match) =>
Array.from({ length: 4 }, (_, index) =>
@@ -339,18 +385,32 @@ fi
assert.equal(result.status, 1, result.stderr);
const calls = fs.readFileSync(callLog, "utf8").trim().split("\n");
- assert.equal(calls.length, 18, "later assigned units still run after failure");
+ assert.equal(
+ calls.length,
+ 18,
+ "later assigned units still run after failure",
+ );
const [, firstOutput] = calls[0].split("|");
const [, secondOutput] = calls[1].split("|");
assert.ok(path.isAbsolute(firstOutput));
assert.ok(fs.existsSync(path.join(firstOutput, "trace.zip")));
assert.notEqual(firstOutput, secondOutput);
assert.equal(
- fs.readFileSync(path.join(workspace, "selection-all/lane-4/receipts/special-3.exit"), "utf8").trim(),
+ fs
+ .readFileSync(
+ path.join(workspace, "selection-all/lane-4/receipts/special-3.exit"),
+ "utf8",
+ )
+ .trim(),
"1",
);
assert.equal(
- fs.readFileSync(path.join(workspace, "selection-all/lane-4/receipts/special-7.exit"), "utf8").trim(),
+ fs
+ .readFileSync(
+ path.join(workspace, "selection-all/lane-4/receipts/special-7.exit"),
+ "utf8",
+ )
+ .trim(),
"0",
);
});