Files
open-design/e2e/lib/vitest/orbit.ts
PerishFireandGitHub 976edaf38e test: harden e2e smoke and release reports (#1140)
* test: harden e2e inspect specs

* test: wire e2e release reports

* chore: bump packaged beta base to 0.6.1

* test: run release smoke vitest directly

* test: add suite-owned tools-dev lifecycle

* ci: harden stable release packaging

* fix(release,e2e): gate stable signing on verify and harden suite cleanup

- restore `needs: [metadata, verify]` on the stable release `build_mac`,
  `build_mac_intel`, `build_win`, and `build_linux` jobs so Apple
  signing/notarization and Windows release builds cannot run before
  pnpm guard, typecheck, and layout checks complete on the metadata commit.
- in `runToolsDevSuite`, drop the `started` flag and always attempt
  `stopToolsDevWeb` in `finally`; record stop errors in diagnostics, and
  when the test body succeeded, escalate the stop failure to the suite
  result and rethrow — so orphan daemon/web processes from an interrupted
  `startToolsDevWeb` or a broken shutdown can no longer pass silently.

Addresses PR #1140 review feedback from lefarcen and mrcfps.
2026-05-11 13:11:16 +08:00

67 lines
1.8 KiB
TypeScript

import { requestJson } from './http.ts';
export type OrbitRunStart = {
agentRunId: string;
projectId: string;
};
export type OrbitSummary = {
agentRunId?: string | null;
artifactId?: string | null;
artifactProjectId?: string | null;
completedAt: string;
connectorsChecked: number;
connectorsFailed: number;
connectorsSkipped: number;
connectorsSucceeded: number;
id?: string;
markdown: string;
templateSkillId?: string | null;
trigger?: 'manual' | 'scheduled';
};
export type OrbitStatus = {
config?: {
enabled?: boolean;
templateSkillId?: string | null;
time?: string;
};
lastRun?: OrbitSummary | null;
lastRunsByTemplate?: Record<string, OrbitSummary>;
nextRunAt?: string | null;
running?: boolean;
};
export async function readOrbitStatus(baseUrl: string): Promise<OrbitStatus> {
return await requestJson<OrbitStatus>(baseUrl, '/api/orbit/status');
}
export async function startOrbitRun(baseUrl: string): Promise<OrbitRunStart> {
return await requestJson<OrbitRunStart>(baseUrl, '/api/orbit/run', { body: {} });
}
export async function waitForOrbitSummary(
baseUrl: string,
agentRunId: string,
options: { intervalMs?: number; timeoutMs?: number } = {},
): Promise<OrbitStatus> {
const timeoutMs = options.timeoutMs ?? 30_000;
const intervalMs = options.intervalMs ?? 250;
const startedAt = Date.now();
let last: OrbitStatus | null = null;
while (Date.now() - startedAt < timeoutMs) {
last = await readOrbitStatus(baseUrl);
if (last.running === false && last.lastRun?.agentRunId === agentRunId) {
return last;
}
await delay(intervalMs);
}
throw new Error(`Orbit summary for ${agentRunId} was not finalized within ${timeoutMs}ms; last=${JSON.stringify(last)}`);
}
function delay(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}