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
+11
View File
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import {
changedBehaviorResultSchema,
findChangedBehavior,
type ChangedBehaviorResult,
} from "./changedBehavior.js";
import { createEvidence, type Evidence } from "./evidence.js";
import type { JsonValue } from "./jsonValue.js";
@@ -123,6 +124,15 @@ const artifactResult = (
limitations: [],
});
const expectInvalidSummary = (result: ChangedBehaviorResult): void => {
expect(
changedBehaviorResultSchema.safeParse({
...result,
summary: { ...result.summary, observed_changes: 0 },
}).success,
).toBe(false);
};
describe("changed behavior", () => {
it("accepts declared-trace process comparison Evidence v4", () => {
const result = findChangedBehavior(
@@ -169,6 +179,7 @@ describe("changed behavior", () => {
summary: { observed_changes: 1, static_candidates: 0 },
findings: { total: 1, next_offset: null },
});
expectInvalidSummary(result);
expect(result.findings.items[0]).toMatchObject({
scope: "runtime",
dimension: "terminal",