refactor(domain): encode comparison and lifecycle states exactly (#473)

* refactor(domain): encode comparison states exactly

* refactor(domain): make evidence lifecycles explicit

* refactor(browser): parse capture states once

* test: prefer behavior over implementation seams

* chore: refresh schema-derived metadata

* test(process): preserve lifecycle cleanup coverage

* test(hopper): bind rename cache coverage to dispatch
This commit is contained in:
morluto
2026-08-11 18:04:36 +08:00
committed by GitHub
parent e91c8c39c2
commit d65730c4c2
43 changed files with 1732 additions and 780 deletions
@@ -76,7 +76,7 @@ describe("provider process runtime and wait primitives", () => {
});
});
it("clears the startup timer and external cancellation listener", async () => {
it("classifies external cancellation during startup", async () => {
vi.useFakeTimers();
const controller = new AbortController();
const deadline = new ProviderStartupDeadline(1_000, controller.signal);
@@ -120,7 +120,7 @@ describe("provider process runtime and wait primitives", () => {
deadline.dispose();
});
it("releases pending request timers and abort listeners on every outcome", async () => {
it("settles pending requests once on cancellation, timeout, and failure", async () => {
vi.useFakeTimers();
const operations = new PendingOperations<number, string>();
const controller = new AbortController();
@@ -134,6 +134,7 @@ describe("provider process runtime and wait primitives", () => {
controller.abort();
await expect(cancelled).resolves.toBe("cancelled");
expect(getEventListeners(controller.signal, "abort")).toHaveLength(0);
expect(operations.settle(1, "late reply")).toBe(false);
const timedOut = operations.wait(2, {
timeoutMs: 50,
@@ -142,6 +143,7 @@ describe("provider process runtime and wait primitives", () => {
});
await vi.advanceTimersByTimeAsync(50);
await expect(timedOut).resolves.toBe("timeout");
expect(operations.settle(2, "late reply")).toBe(false);
const failed = operations.wait(3, {
timeoutMs: 1_000,
@@ -150,6 +152,7 @@ describe("provider process runtime and wait primitives", () => {
});
operations.failAll((key) => `failed:${String(key)}`);
await expect(failed).resolves.toBe("failed:3");
expect(operations.settle(3, "late reply")).toBe(false);
expect(operations.size).toBe(0);
expect(vi.getTimerCount()).toBe(0);
});