fix(artifacts): bound mobile projection candidates

This commit is contained in:
morluto
2026-07-20 11:31:36 +00:00
parent d36b385378
commit 0cc9d468c4
7 changed files with 109 additions and 20 deletions
+9 -5
View File
@@ -4,6 +4,7 @@ import canonicalize from "canonicalize";
import { z } from "zod";
import { parseArtifactInventoryEvidence } from "./artifactInventoryEvidence.js";
import { projectBoundedCartesian } from "./boundedCartesianProjection.js";
import { evidenceSchema } from "./evidence.js";
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
@@ -248,16 +249,19 @@ const bridgeCandidates = (
native: readonly Component[],
maximum: number,
) => {
const candidates = managed.flatMap((source) =>
native.map((target) => ({
const projection = projectBoundedCartesian(
managed,
native,
maximum,
(source, target) => ({
managed_path: source.path,
native_path: target.path,
basis: bridgeBasis(target.path),
})),
}),
);
return {
candidates: candidates.slice(0, maximum),
omitted: Math.max(0, candidates.length - maximum),
candidates: projection.values,
omitted: projection.omitted,
};
};