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
@@ -4,8 +4,8 @@ import { join } from "node:path";
import { TextReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
import { describe, expect, it } from "vitest";
import { compareCodePoints } from "../../../src/domain/canonicalOrdering.js";
import { canonicalDigest } from "../../../src/domain/comparisonSemantics.js";
import { compareUnicodeCodePoints } from "../../../src/domain/unicodeCodePointOrder.js";
import { digestCanonicalValue } from "../../../src/domain/canonicalDigest.js";
import { inventoryArtifact } from "../../../src/artifacts/inventory/ArtifactInventory.js";
import { compareArtifacts } from "../../../src/domain/artifactComparison.js";
import type { ArtifactInventoryResult } from "../../../src/domain/artifactGraph.js";
@@ -54,9 +54,9 @@ const directoryIdForChildren = (
inventory: ArtifactInventoryResult,
paths: readonly string[],
) =>
`art_${canonicalDigest(
`art_${digestCanonicalValue(
{
sha256: canonicalDigest(
sha256: digestCanonicalValue(
{
kind: "directory",
children: paths
@@ -69,7 +69,7 @@ const directoryIdForChildren = (
};
})
.sort((left, right) =>
compareCodePoints(String(left.name), String(right.name)),
compareUnicodeCodePoints(String(left.name), String(right.name)),
),
},
"Artifact",
@@ -70,7 +70,7 @@ describe("the CLI takes its environment as an input", () => {
// environment rather than whatever the process happens to carry.
const result = await createDirectAnalysis({
REA_LOG_LEVEL: "not-a-level",
}).runCapabilityStatus();
}).runSessionStatus();
expect(result).toMatchObject({ error: expect.anything() });
});
});
@@ -144,6 +144,26 @@ it("reports semantic value resource limits in application graph coverage", async
}),
]),
});
const sourceModuleLimits = graph.nodes
.filter(({ kind }) => kind === "javascript-module")
.flatMap(({ observations }) => observations)
.filter(
({ evidence }) =>
evidence.extractor.operation === "recover-source-module",
)
.flatMap(({ evidence }) => evidence.coverage.limits);
expect(sourceModuleLimits).toEqual(
expect.arrayContaining([
expect.objectContaining({
name: "javascript_semantic_primitive_candidates",
unit: "items",
}),
expect.objectContaining({
name: "javascript_semantic_primitive_bytes",
unit: "bytes",
}),
]),
);
expect(graph.limitations).toContain(
"Primitive candidate budget exceeded (maximum 256 alternatives).",
);