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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep directory requires and computed python imports non-memoizable (#12300)
[._.]/ Adam Eivy5252e9937b68
diff --git a/scripts/lib/testMemo.js b/scripts/lib/testMemo.jsindex 817877e516..7bc274a7b0 100644--- a/scripts/lib/testMemo.js+++ b/scripts/lib/testMemo.js@@ -741,7 +741,9 @@ export function extractFileFacts(src, { fileRel, cwdRel }) {if (tokens[at]?.t === 'id' && tokens[at + 1]?.v === '.' && tokens[at + 2]?.t === 'id') at += 2; // path.join(if (tokens[at]?.t !== 'id' || !PATH_JOIN.has(tokens[at].v) || tokens[at + 1]?.v !== '(') return null;const last = (evaluateArgs(tokens, match, at + 1, ctx, 0) ?? []).at(-1);- return last?.k === 'str' && !last.v.endsWith('/') && last.v !== '' ? posix.basename(last.v) : null;+ // Only an explicit file extension proves a file: a bare name may be a directory Node resolves+ // through index.js or package.json main, which a basename match would not collect.+ return last?.k === 'str' && /\.(?:c?js|mjs|json|node)$/.test(last.v) ? posix.basename(last.v) : null;};const record = (value, { walk = false, consumer = null, bare = false } = {}) => {@@ -1045,7 +1047,7 @@ export function createTestMemoAnalyzer({ fs, workspaceRel, env = {}, platform =const names = m ? (m[1] !== undefined ? [m[1]] : m[2].split(',')).map((part) => part.trim()).filter(Boolean) : [];// `importlib.import_module('x')` is a sibling import; a non-literal name may reach any module.if (!/^\s*#/.test(line)) {- for (const call of line.matchAll(/\bimport_module\(\s*(?:(['"])([\w.]+)\1|)/g)) {+ for (const call of line.matchAll(/\bimport_module\(\s*(?:(['"])([\w.]+)\1(?=\s*[,)])|)/g)) {if (call[2] !== undefined) names.push(call[2]);else resolved.unresolvedInputs.push(`python import_module with a non-literal name in ${target}`);}diff --git a/scripts/lib/testMemo.test.js b/scripts/lib/testMemo.test.jsindex 570471a100..5427950411 100644--- a/scripts/lib/testMemo.test.js+++ b/scripts/lib/testMemo.test.js@@ -228,6 +228,8 @@ describe('non-literal native require() in a product module', () => {expect(floor({ ...tree(boot), 'sub/ecosystem.config.cjs': 'module.exports = { apps: [2] };\n' }).key).not.toBe(base.key);// A non-literal basename is still unknown.expect(floor(tree(boot.replace("join(root.dir, NAME)", 'join(root.dir, root.name)')))).toMatchObject({ memoizable: false, reason: expect.stringContaining('non-literal') });+ // A bare name may be a directory Node loads via index.js or package.json main: not provably a file.+ expect(floor(tree(boot.replace("'ecosystem.config.cjs'", "'plugin'")))).toMatchObject({ memoizable: false, reason: expect.stringContaining('non-literal') });});it('keys a package-name constant by the installed package version', () => {@@ -278,6 +280,8 @@ describe('python sidecars, external tools and machine-local state', () => {expect(key(files).memoizable).toBe(true);expect(key({ ...files, 'scripts/_pins.py': 'PINS = 2\n' }).key).not.toBe(key(files).key);expect(key({ ...files, 'scripts/tool.py': 'import importlib\nmod = importlib.import_module(name)\n' })).toMatchObject({ memoizable: false, reason: expect.stringContaining('import_module') });+ // A literal prefix of a computed name is not the whole argument.+ expect(key({ ...files, 'scripts/tool.py': "import importlib\nmod = importlib.import_module('_pins' + suffix)\n" })).toMatchObject({ memoizable: false, reason: expect.stringContaining('import_module') });});it('fails closed when the test or repository tooling reads the install data tree or the home directory, and ignores a product module doing so', () => {