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:
@@ -1,5 +1,4 @@
|
||||
import canonicalize from "canonicalize";
|
||||
|
||||
import { canonicalJson } from "./comparisonSemantics.js";
|
||||
import { compareCodePoints } from "./canonicalOrdering.js";
|
||||
|
||||
import type {
|
||||
@@ -179,8 +178,8 @@ export const stringAndNameProjection = (
|
||||
|
||||
export const sorted = (values: readonly unknown[]): readonly unknown[] =>
|
||||
[...values].sort((left, right) => {
|
||||
const leftJson = canonicalJson(left);
|
||||
const rightJson = canonicalJson(right);
|
||||
const leftJson = canonicalJson(left, "Function normalization");
|
||||
const rightJson = canonicalJson(right, "Function normalization");
|
||||
// Preserve existing collation while ordering distinct values within a tie.
|
||||
return (
|
||||
leftJson.localeCompare(rightJson) ||
|
||||
@@ -218,10 +217,3 @@ const relativeAddress = (value: string, base: string): string | null => {
|
||||
? null
|
||||
: String(parsed - parsedBase);
|
||||
};
|
||||
|
||||
const canonicalJson = (value: unknown): string => {
|
||||
const encoded = canonicalize(value);
|
||||
if (encoded === undefined)
|
||||
throw new TypeError("Function normalization could not canonicalize data");
|
||||
return encoded;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user