Skip to content

Commit 8bb17de

Browse files
committed
fix(test-suite): show local build in fhevm-cli output
1 parent 186c343 commit 8bb17de

2 files changed

Lines changed: 37 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, test } from "bun:test";
22

33
import {
4+
displayedBundle,
45
multiChainCoprocessorUpgradeTargets,
56
preflightPorts,
67
resumeRepairStep,
@@ -9,7 +10,7 @@ import {
910
} from "./flow/up-flow";
1011
import { assertContractTaskStackRunning } from "./flow/contracts";
1112
import { envPath, hostChainAddressesPath, kmsCoreConfigPath } from "./layout";
12-
import type { State } from "./types";
13+
import { OVERRIDE_GROUPS, type State } from "./types";
1314

1415
const completeState = (): State => ({
1516
target: "latest-main",
@@ -309,4 +310,14 @@ describe("runtime helpers", () => {
309310
test("resume hint is suppressed for equals-form fresh-stack flags", () => {
310311
expect(shouldShowResumeHint(["up", "--target=sha", "--sha=badbad"])).toBe(false);
311312
});
313+
314+
test("displayedBundle prints local build for repo-owned versions under full build", () => {
315+
const state = completeState();
316+
state.overrides = OVERRIDE_GROUPS.map((group) => ({ group }));
317+
const bundle = displayedBundle(state.versions, state.overrides);
318+
expect(bundle.env.GATEWAY_VERSION).toBe("LOCAL BUILD");
319+
expect(bundle.env.RELAYER_VERSION).toBe("LOCAL BUILD");
320+
expect(bundle.env.TEST_SUITE_VERSION).toBe("LOCAL BUILD");
321+
expect(bundle.env.CORE_VERSION).toBe("v0.13.10-rc.3");
322+
});
312323
});

test-suite/fhevm/src/flow/up-flow.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
RpcError,
2626
SchemaGuardError,
2727
} from "../errors";
28-
import { describeBundle } from "../resolve/target";
28+
import { describeBundle, REPO_KEYS } from "../resolve/target";
2929
import {
3030
ADDRESS_DIR,
3131
COMPOSE_OUT_DIR,
@@ -72,7 +72,7 @@ import type {
7272
VersionBundle,
7373
VersionTarget,
7474
} from "../types";
75-
import { STEP_NAMES } from "../types";
75+
import { OVERRIDE_GROUPS, STEP_NAMES } from "../types";
7676
import {
7777
exists,
7878
hostReachableMaterialUrl,
@@ -255,7 +255,26 @@ const overrideWarnings = (overrides: LocalOverride[], target?: string) => {
255255
};
256256

257257
/** Prints the resolved version bundle in compact or detailed form. */
258-
const printBundle = (bundle: VersionBundle, options?: { detailed?: boolean }) => {
258+
const fullBuildActive = (overrides: LocalOverride[]) =>
259+
OVERRIDE_GROUPS.every((group) => overrides.some((item) => item.group === group));
260+
261+
/** Rewrites displayed repo-owned versions to match the effective runtime source under `--build`. */
262+
export const displayedBundle = (
263+
bundle: VersionBundle,
264+
overrides: LocalOverride[],
265+
) =>
266+
!fullBuildActive(overrides)
267+
? bundle
268+
: {
269+
...bundle,
270+
env: Object.fromEntries(
271+
Object.entries(bundle.env).map(([key, value]) => [key, REPO_KEYS.has(key) ? "LOCAL BUILD" : value]),
272+
),
273+
};
274+
275+
/** Prints the resolved version bundle in compact or detailed form. */
276+
const printBundle = (state: Pick<State, "versions" | "overrides">, options?: { detailed?: boolean }) => {
277+
const bundle = displayedBundle(state.versions, state.overrides);
259278
console.log(`[resolve] ${bundle.lockName}`);
260279
if (options?.detailed) {
261280
console.log(describeBundle(bundle));
@@ -461,7 +480,7 @@ export const runStep = async (state: State, step: StepName) => {
461480
await preflight(state, true, state.requiresGitHub ?? true);
462481
break;
463482
case "resolve":
464-
printBundle(state.versions, { detailed: true });
483+
printBundle(state, { detailed: true });
465484
break;
466485
case "generate":
467486
await generateRuntime(state, stackSpecForState(state));
@@ -903,7 +922,7 @@ export const upDryRun = async (options: Omit<UpOptions, "dryRun">) => {
903922
state.scenarioSourcePath ??= state.scenario?.sourcePath;
904923
ensureResumeOptions(state, options);
905924
await preflight(state, false, state.requiresGitHub);
906-
printBundle(state.versions, { detailed: true });
925+
printBundle(state, { detailed: true });
907926
printPlan(state, options.fromStep ?? startStep(state, options));
908927
console.log("[dry-run] resume preview uses persisted state only; no runtime state or containers were changed");
909928
return;
@@ -915,7 +934,7 @@ export const upDryRun = async (options: Omit<UpOptions, "dryRun">) => {
915934
await assertSchemaCompatibility(bundle, options.overrides, scenario, options.allowSchemaMismatch);
916935
const state = previewStateFromBundle(options, bundle, scenario);
917936
await preflight(state, false, state.requiresGitHub);
918-
printBundle(state.versions, { detailed: true });
937+
printBundle(state, { detailed: true });
919938
printPlan(state, options.fromStep);
920939
console.log("[dry-run] preflight passed; no runtime state or containers were changed");
921940
};

0 commit comments

Comments
 (0)