refactor: use canonical implementations and types directly

Remove forwarding wrappers and shadow aliases, migrate callers and verification scripts to their owners, and share one exhaustive semantic resource-bound projection.
This commit is contained in:
morluto
2026-10-09 23:35:19 +08:00
parent 3283a45d09
commit 765e809e36
119 changed files with 577 additions and 629 deletions
@@ -1,7 +1,7 @@
import { lstat, realpath } from "node:fs/promises";
import { compareCodePoints } from "../../domain/canonicalOrdering.js";
import { canonicalDigest } from "../../domain/comparisonSemantics.js";
import { compareUnicodeCodePoints } from "../../domain/unicodeCodePointOrder.js";
import { digestCanonicalValue } from "../../domain/canonicalDigest.js";
import { AsarArtifactReader } from "../AsarArtifactReader.js";
import {
ArtifactPathRegistry,
@@ -178,7 +178,7 @@ const materializeSelection = async ({
await reader.close();
readerClosed = true;
extracted.sort((left, right) =>
compareCodePoints(left.relative_path, right.relative_path),
compareUnicodeCodePoints(left.relative_path, right.relative_path),
);
const result = createExtractionResult(
input,
@@ -245,15 +245,15 @@ const createExtractionResult = (
source_manifest_id: inventory.manifest.manifest_id,
selected_occurrence_ids: selected
.map(({ occurrence }) => occurrence.occurrence_id)
.sort(compareCodePoints),
files_sha256: canonicalDigest(extracted, "Artifact"),
.sort(compareUnicodeCodePoints),
files_sha256: digestCanonicalValue(extracted, "Artifact"),
output_root_alias: "$OUTPUT_ROOT" as const,
};
return artifactExtractionResultSchema.parse({
manifest: inventory.manifest,
extraction_manifest: {
...extractionSemantic,
extraction_id: `aex_${canonicalDigest(extractionSemantic, "Artifact")}`,
extraction_id: `aex_${digestCanonicalValue(extractionSemantic, "Artifact")}`,
},
output_root: input.outputRoot,
artifacts: extracted,