Skip to content

Commit 8fc718b

Browse files
only21milclaude
andcommitted
test(scripts): refuse existing repo-root icon entries without following symlinks
The empty-target test checked each repo-root icon with fs.exists, which follows symlinks. A dangling favicon.ico link read as absent, copyFile wrote its referent outside the checkout, and the finalizer removed the link. Read the repo-root directory listing instead, compare names case-insensitively, and name the path in the failure message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c91d12f commit 8fc718b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎scripts/apply-web-brand-assets.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@ it.layer(NodeServices.layer)("apply-web-brand-assets", (it) => {
3636
const path = yield* Path.Path;
3737
const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
3838
const destinations = WEB_ICON_FILENAMES.map((filename) => path.join(repoRoot, filename));
39+
// readDirectory does not follow symlinks, so a dangling link counts as an existing entry.
40+
// Names are lowercased so a case-insensitive filesystem cannot hide a differently cased file.
41+
const existingEntries = new Set(
42+
(yield* fs.readDirectory(repoRoot)).map((entry) => entry.toLowerCase()),
43+
);
3944
for (const destination of destinations) {
40-
assert.isFalse(yield* fs.exists(destination));
45+
assert.isFalse(
46+
existingEntries.has(path.basename(destination)),
47+
`${destination} already exists`,
48+
);
4149
}
4250
yield* Effect.addFinalizer(() =>
4351
Effect.forEach(destinations, (destination) => fs.remove(destination, { force: true })).pipe(

0 commit comments

Comments
 (0)