Skip to content

Commit face991

Browse files
committed
fix(tools): resolve extensionful specifiers in the boundary guard
`resolveSpecifier` probed `base + ext` and `base/index + ext` but never `base` itself, so an already-extensioned specifier resolved to null and its edge vanished from the walk — `import { tools } from '@/tools/registry.ts'` would have passed the guard silently. Not theoretical: `executor/execution/block-executor.ts` already imports `@/executor/human-in-the-loop/utils.ts` with the extension, so real edges were being dropped. Counts rise slightly now that they are followed (canvas 2,023 -> 2,029). Verified: the extensionful import exits 1, and removing it returns to 0.
1 parent 42c7448 commit face991

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/check-tool-registry-boundary.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ function resolveSpecifier(specifier: string, importer: string): string | null {
7171
else if (specifier.startsWith('.')) base = resolve(dirname(importer), specifier)
7272
else return null
7373

74+
// An already-extensioned specifier (`@/tools/registry.ts`) resolves as-is.
75+
// Probing only `base + ext` would miss it and silently drop the edge — and
76+
// extensionful `@/` imports do exist in this repo.
77+
if (existsSync(base) && statSync(base).isFile()) return base
78+
7479
for (const ext of EXTENSIONS) {
7580
if (existsSync(base + ext)) return base + ext
7681
}

0 commit comments

Comments
 (0)