Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address review (claude): harden FableLoom import guard

Adam Eivy5b908b1b4d80
diff --git a/client/src/pages/FableLoomStory.browser.test.js b/client/src/pages/FableLoomStory.browser.test.js
index dfe9591b64..25f0bbbe72 100644
--- a/client/src/pages/FableLoomStory.browser.test.js
+++ b/client/src/pages/FableLoomStory.browser.test.js
@@ -15,6 +15,7 @@ const BUILTINS = new Set([
const importSpecifiers = (source) => [
...source.matchAll(/^\s*import\s+(?:[^'"]*?\s+from\s+)?['"]([^'"]+)['"]/gm),
...source.matchAll(/^\s*export\s+(?:\*|{)[^'"]*?\s+from\s+['"]([^'"]+)['"]/gm),
+ ...source.matchAll(/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g),
].map((match) => match[1]);
const resolveSourceImport = (fromFile, specifier) => {
@@ -45,17 +46,25 @@ const browserBuiltinImports = (entry) => {
}
if (!specifier.startsWith('.')) continue;
const importedFile = resolveSourceImport(file, specifier);
- if (importedFile && SOURCE_EXTENSIONS.includes(extname(importedFile))) {
+ if (!importedFile) {
+ findings.push(`${relative(REPO_ROOT, file)} has an unresolvable relative import ${specifier}`);
+ } else if (SOURCE_EXTENSIONS.includes(extname(importedFile))) {
pending.push(importedFile);
}
}
}
- return findings.sort();
+ return { findings: findings.sort(), visited };
};
describe('FableLoomStory browser dependency boundary', () => {
it('keeps the route import graph free of Node builtins', () => {
- expect(browserBuiltinImports(ENTRY)).toEqual([]);
+ const { findings, visited } = browserBuiltinImports(ENTRY);
+ expect(findings).toEqual([]);
+ const reached = [...visited].map((file) => relative(REPO_ROOT, file));
+ expect(reached).toEqual(expect.arrayContaining([
+ 'server/lib/fableLoomOutline.js',
+ 'server/lib/textUtils.js',
+ ]));
});
});