Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scripts/verify-desktop-installed-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { describe, expect, it, vi } from "vitest";
import {
buildSidecarCommandPageScript,
type InstalledDesktopScenario,
resolveActualRuntimeVersion,
toSidecarWebSocketUrl,
type VerifyInstalledDesktopDeps,
verifyInstalledDesktopScenario,
Expand Down Expand Up @@ -73,6 +74,11 @@ function createDeps(
}

describe("verify-desktop-installed-update", () => {
it("uses the coordinator Runtime when active.json retains an older rollback candidate", () => {
expect(resolveActualRuntimeVersion("0.5.13", "0.5.8", null, "0.5.13")).toBe("0.5.13");
expect(resolveActualRuntimeVersion(null, "0.5.8", null, "0.5.7")).toBe("0.5.8");
});

it("preserves installed logs beside the report before deleting acceptance-owned paths", async () => {
const runner = await readFile(
resolve(import.meta.dirname, "verify-desktop-installed-update.ps1"),
Expand Down
27 changes: 21 additions & 6 deletions scripts/verify-desktop-installed-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ export interface InstalledDesktopScenarioReport extends InstalledEvidence {
logPaths: string[];
}

export function resolveActualRuntimeVersion(
coordinatorVersion: string | null | undefined,
activePointerVersion: string | null,
externalVersion: string | null | undefined,
factoryVersion: string | null
): string {
return coordinatorVersion || activePointerVersion || externalVersion || factoryVersion || "";
}

interface SidecarCommandPayload {
wsUrl: string;
operation: string;
Expand Down Expand Up @@ -431,7 +440,9 @@ export async function verifyInstalledDesktopScenario(
evidence.actualShellVersion !== scenario.targetShellVersion ||
evidence.actualRuntimeVersion !== expectedRuntime
) {
throw new Error("Installed component versions do not match the accepted candidate");
throw new Error(
`Installed component versions do not match the accepted candidate: shell ${evidence.actualShellVersion} (expected ${scenario.targetShellVersion}); Runtime ${evidence.actualRuntimeVersion} (expected ${expectedRuntime})`
);
}
if (isWslScenario(scenario.name)) {
if (evidence.wslRuntimeVersion !== scenario.targetRuntimeVersion) {
Expand Down Expand Up @@ -796,11 +807,15 @@ async function createDefaultDeps(options: InstalledDriverOptions): Promise<{
const observedWslRuntimeVersion = await readWslActiveRuntimeVersion(options.wslDistro);
const external = await readEvidenceFile(options.evidencePath);
const observedWslMarker = await wslMarkerExists(options.wslDistro, options.wslMarkerPath);
const actualRuntimeVersion =
observedRuntimeVersion ??
external.actualRuntimeVersion ??
observedFactoryRuntimeVersion ??
state.productVersion;
// active.json can intentionally retain the previous Runtime as a rollback
// candidate when a newer Factory Runtime is running. The coordinator state
// reflects the Runtime selected for the current process.
const actualRuntimeVersion = resolveActualRuntimeVersion(
state.productVersion,
observedRuntimeVersion,
external.actualRuntimeVersion,
observedFactoryRuntimeVersion
);
if (
isWslScenario(options.scenario.name) &&
typeof external.wslNpmMarkerExists !== "boolean" &&
Expand Down
Loading