refactor(domain): converge comparison mechanics on shared vocabulary (#824)
Delete the private canonicalJson duplicate in functionComparisonNormalization in favor of comparisonSemantics (same canonicalize behavior via the context parameter). Add comparisonStatus as the single owner of the canonical unchanged/changed/unknown triple and conclusion vocabulary, with mappers pinning every pipeline-native status; adopt the shared triple schema where wire-identical (bundle result, scenario overall/step). Native detail enums and collation choices stay untouched.
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
bundleClassificationToCanonical,
|
||||
comparisonConclusionSchema,
|
||||
comparisonStatusSchema,
|
||||
functionStatusToCanonical,
|
||||
scenarioArtifactStatusToCanonical,
|
||||
sourceToBundleStatusToCanonical,
|
||||
} from "./comparisonStatus.js";
|
||||
|
||||
describe("comparison status vocabulary", () => {
|
||||
it("owns the canonical unchanged/changed/unknown triple", () => {
|
||||
expect(comparisonStatusSchema.options).toEqual([
|
||||
"unchanged",
|
||||
"changed",
|
||||
"unknown",
|
||||
]);
|
||||
expect(comparisonConclusionSchema.options).toEqual([
|
||||
"observed_change",
|
||||
"derived_relationship",
|
||||
"contradiction",
|
||||
"unresolved_branch",
|
||||
]);
|
||||
});
|
||||
|
||||
it("projects every bundle classification", () => {
|
||||
expect(
|
||||
(
|
||||
[
|
||||
"added",
|
||||
"removed",
|
||||
"changed",
|
||||
"unknown",
|
||||
"history_advanced",
|
||||
"history_diverged",
|
||||
] as const
|
||||
).map(bundleClassificationToCanonical),
|
||||
).toEqual([
|
||||
"changed",
|
||||
"changed",
|
||||
"changed",
|
||||
"unknown",
|
||||
"changed",
|
||||
"changed",
|
||||
]);
|
||||
});
|
||||
|
||||
it("projects every source-to-bundle item status", () => {
|
||||
expect(
|
||||
(
|
||||
[
|
||||
"unchanged",
|
||||
"modified",
|
||||
"removed",
|
||||
"split",
|
||||
"merged",
|
||||
"duplicated",
|
||||
"unknown",
|
||||
] as const
|
||||
).map(sourceToBundleStatusToCanonical),
|
||||
).toEqual([
|
||||
"unchanged",
|
||||
"changed",
|
||||
"changed",
|
||||
"changed",
|
||||
"changed",
|
||||
"changed",
|
||||
"unknown",
|
||||
]);
|
||||
});
|
||||
|
||||
it("projects every function dimension status without claiming truncated work", () => {
|
||||
expect(
|
||||
(["unchanged", "changed", "truncated", "unknown"] as const).map(
|
||||
functionStatusToCanonical,
|
||||
),
|
||||
).toEqual(["unchanged", "changed", "unknown", "unknown"]);
|
||||
});
|
||||
|
||||
it("projects every scenario artifact status", () => {
|
||||
expect(
|
||||
(["changed", "unknown"] as const).map(scenarioArtifactStatusToCanonical),
|
||||
).toEqual(["changed", "unknown"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user