Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline (Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/* packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
33 lines
997 B
TypeScript
33 lines
997 B
TypeScript
import * as fc from "fast-check";
|
|
import { describe, expect, it } from "vitest";
|
|
import { assertTransition, canTransition } from "./run-state.js";
|
|
|
|
describe("run state machine", () => {
|
|
it("allows takeover resume onto a lease", () => {
|
|
expect(canTransition("waiting_takeover", "leased")).toBe(true);
|
|
expect(canTransition("waiting_takeover", "running")).toBe(false);
|
|
});
|
|
|
|
it("rejects rewriting a completed run", () => {
|
|
expect(() => assertTransition("completed", "running")).toThrow(/illegal/i);
|
|
});
|
|
|
|
it("never leaves a terminal state except failed retry", () => {
|
|
fc.assert(
|
|
fc.property(
|
|
fc.constantFrom("completed" as const, "cancelled" as const),
|
|
fc.constantFrom(
|
|
"queued" as const,
|
|
"leased" as const,
|
|
"running" as const,
|
|
"waiting_input" as const,
|
|
"completed" as const,
|
|
),
|
|
(from, to) => {
|
|
expect(canTransition(from, to)).toBe(false);
|
|
},
|
|
),
|
|
);
|
|
});
|
|
});
|