Skip to content

Commit 9dd0b75

Browse files
committed
fix(test-suite): fix CLI error handling, compat threshold, and dual-override builds
- Move parseCli inside try/catch so parse errors show clean messages instead of stack traces - Guard runContractTask against missing state (no stack running) - Revert compat threshold to v0.11.0 (v0.11.x binaries reject --coprocessor-api-key) - Filter maybeBuild services to those present in the component's compose file (fixes dual overrides)
1 parent debc0c0 commit 9dd0b75

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

test-suite/fhevm/src/artifacts.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,13 @@ const maybeBuild = async (
450450
) => {
451451
for (const override of state.overrides) {
452452
if (GROUP_BUILD_COMPONENTS[override.group].includes(component)) {
453+
const doc = YAML.parse(await fs.readFile(composePath(component), "utf8")) as ComposeDoc;
454+
const available = new Set(Object.keys(doc.services));
455+
const services = GROUP_BUILD_SERVICES[override.group].filter((s) => available.has(s));
456+
if (!services.length) {
457+
continue;
458+
}
453459
log(`[build] ${override.group} (${component})`);
454-
const services = GROUP_BUILD_SERVICES[override.group];
455460
await deps.liveRunner([...dockerArgs(component), "build", ...services], { env: await composeEnv(state) });
456461
await rememberBuiltImages(state, component, override.group, services, deps, saveState);
457462
}

test-suite/fhevm/src/cli.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe("resolveTarget", () => {
153153
});
154154

155155
describe("runtime invariants", () => {
156-
test("compat policy keeps legacy coprocessor args for v0.11.x only", () => {
156+
test("compat policy keeps legacy coprocessor args for versions before v0.11.0 only", () => {
157157
const state = (version: string) =>
158158
({
159159
target: "latest-release",
@@ -187,9 +187,10 @@ describe("runtime invariants", () => {
187187
completedSteps: [],
188188
updatedAt: "2026-03-09T00:00:00.000Z",
189189
}) satisfies State;
190-
expect(compatPolicyForState(state("v0.11.0")).coprocessorArgs["host-listener"]).toEqual([
190+
expect(compatPolicyForState(state("v0.10.9")).coprocessorArgs["host-listener"]).toEqual([
191191
["--coprocessor-api-key", "COPROCESSOR_API_KEY"],
192192
]);
193+
expect(compatPolicyForState(state("v0.11.0")).coprocessorArgs["host-listener"]).toBeUndefined();
193194
expect(compatPolicyForState(state("58aebb0")).coprocessorArgs["host-listener"]).toBeUndefined();
194195
});
195196

test-suite/fhevm/src/compat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const COMPAT_PROFILES = {
2626
} as const satisfies Record<string, CompatPolicy>;
2727

2828
const COMPAT_RULES = {
29-
coprocessor: [{ before: [0, 12, 0] as CompatSemver, profile: "legacy-coprocessor-api-keys" }],
29+
coprocessor: [{ before: [0, 11, 0] as CompatSemver, profile: "legacy-coprocessor-api-keys" }],
3030
connector: [{ before: [0, 11, 0] as CompatSemver, profile: "legacy-connector-chain-id" }],
3131
} as const;
3232

test-suite/fhevm/src/runtime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,9 @@ const runContractTask = async (
856856
deps: RuntimeDeps,
857857
) => {
858858
const state = await loadState();
859+
if (!state) {
860+
throw new Error("Stack is not running; run `fhevm-cli up` first");
861+
}
859862
await deps.liveRunner(
860863
[...dockerArgs(component), "run", "--rm", "--no-deps", "--entrypoint", "sh", service, "-lc", command],
861864
{
@@ -1102,8 +1105,8 @@ clean options:
11021105

11031106
export const main = async (argv = process.argv, deps: Partial<RuntimeDeps> = {}) => {
11041107
const runtime = { ...defaultDeps, ...deps };
1105-
const parsed = parseCli(argv);
11061108
try {
1109+
const parsed = parseCli(argv);
11071110
switch (parsed.command) {
11081111
case "up":
11091112
if (parsed.parsed.values["dry-run"]) {

0 commit comments

Comments
 (0)