Skip to content

Commit 9701546

Browse files
jfblaaclaude
andcommitted
perf(manifest): check each artifact path once across resolution roots
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3b54230 commit 9701546

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/commands/manifest/scripts/assemble.mts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,22 @@ function buildArtifactPaths(
413413
fileExists: (path: string) => boolean,
414414
): ResolvedArtifactPaths {
415415
const pathsById: ResolvedArtifactPaths['pathsById'] = new Map()
416+
// Every root that fetched an artifact lists its file, so check each path once.
417+
const existing = new Map<string, boolean>()
418+
const exists = (p: string) => {
419+
let e = existing.get(p)
420+
if (e === undefined) {
421+
e = fileExists(p)
422+
existing.set(p, e)
423+
}
424+
return e
425+
}
416426
for (const [id, fn] of finalNodes) {
417427
if (!fn.project) {
418428
// Only a root that fetched every file of the artifact, all still on
419429
// disk, resolved it: a partial list would claim it resolved whole.
420430
const complete = fn.resolutions.filter(
421-
r => !r.unfetched && r.targets.every(fileExists),
431+
r => !r.unfetched && r.targets.every(exists),
422432
)
423433
pathsById.set(
424434
id,

0 commit comments

Comments
 (0)