fix(evidence): order canonical projections independently of locale

This commit is contained in:
morluto
2026-10-10 05:13:53 +08:00
parent 0f10499245
commit 614fb7681e
22 changed files with 123 additions and 81 deletions
+4 -3
View File
@@ -3,6 +3,8 @@ import { createHash } from "node:crypto";
import canonicalize from "canonicalize";
import { z } from "zod";
import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";
import { evidenceBundleSchema, parseEvidenceBundle } from "./evidenceBundle.js";
import {
evaluateReconstructionClaims,
@@ -403,9 +405,8 @@ const closureStatus = (
};
const reasonOrder = (left: ClosureReason, right: ClosureReason): number =>
`${left.code}:${left.subject_id}`.localeCompare(
`${right.code}:${right.subject_id}`,
);
compareUnicodeCodePoints(left.code, right.code) ||
compareUnicodeCodePoints(left.subject_id, right.subject_id);
const digest = (value: unknown): string => {
const encoded = canonicalize(value);