Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Cover non-code read-declaration roots and correct gate docs (#7431)
Nick Gomez098db5313c2e
diff --git a/packages/app/tests/meta/worker-lifetime-owner-safety.reads.ts b/packages/app/tests/meta/worker-lifetime-owner-safety.reads.tsindex f447db4d4..7022862c3 100644--- a/packages/app/tests/meta/worker-lifetime-owner-safety.reads.ts+++ b/packages/app/tests/meta/worker-lifetime-owner-safety.reads.ts@@ -1,7 +1,7 @@export const ROUND_READS = {test: './worker-lifetime-owner-safety.test.ts',reads:- 'the owner, subject and observer scripts it starts from the worker-lifetime fixtures, with everything they require',+ 'the owner, subject and observer scripts it starts from the worker-lifetime fixtures, with everything they require, and the identity sampler they run with python3 on macOS',roots: ['packages/app/tests/foundation/worker-lifetime/process-identity.cjs','packages/app/tests/foundation/worker-lifetime/resource-owner.cjs',@@ -9,4 +9,5 @@ export const ROUND_READS = {'packages/app/tests/foundation/worker-lifetime/safety-subject.cjs','packages/app/tests/foundation/worker-lifetime/startup-observer.cjs',],+ include: ['packages/app/tests/foundation/worker-lifetime/process-identity.py'],};diff --git a/test-support/read-declarations-closure.test.ts b/test-support/read-declarations-closure.test.tsindex 00c9abfcd..f18f7fbf7 100644--- a/test-support/read-declarations-closure.test.ts+++ b/test-support/read-declarations-closure.test.ts@@ -1,7 +1,8 @@import { mkdirSync, writeFileSync } from 'node:fs';import { dirname, join } from 'node:path';import { afterAll, describe, expect, test } from 'vitest';-import { deriveReadClosure, derivedReads } from './read-declarations-closure';+import { derivedReads, deriveReadClosure } from './read-declarations-closure';+import { declares } from './read-declarations-match';import { createTempDirFactory } from './temp-dir.test-helper';const makeTempDir = createTempDirFactory(afterAll);@@ -146,4 +147,36 @@ describe('what a declared root loads, derived from its module graph', () => {'the root glob "missing.mjs" matches no file in this tree',);});++ test('every listed file a root glob matches is a derived read, so a shell or Python script root covers itself and nothing it runs', () => {+ const files = {+ 'scripts/start.mjs': "import './helper.mjs';\n",+ 'scripts/helper.mjs': 'export {};\n',+ 'scripts/run.sh': '#!/bin/sh\nnode scripts/ran.mjs\n',+ 'scripts/ran.mjs': 'export {};\n',+ 'scripts/probe.py': 'print(1)\n',+ 'tools/check.sh': 'exit 0\n',+ 'tools/check.ts': 'export {};\n',+ 'tools/unlisted.sh': 'exit 0\n',+ };+ const root = tree(files);+ const listed = new Set(Object.keys(files).filter((path) => path !== 'tools/unlisted.sh'));+ const globMatches = (glob: string, path: string): boolean =>+ declares({ include: [glob] }, path);+ expect(+ derivedReads(+ root,+ ['scripts/start.mjs', 'scripts/run.sh', 'scripts/probe.py', 'tools/*'],+ listed,+ globMatches,+ ),+ ).toEqual([+ 'scripts/helper.mjs',+ 'scripts/probe.py',+ 'scripts/run.sh',+ 'scripts/start.mjs',+ 'tools/check.sh',+ 'tools/check.ts',+ ]);+ });});diff --git a/test-support/read-declarations-closure.ts b/test-support/read-declarations-closure.tsindex 042485b96..bd5c00bb9 100644--- a/test-support/read-declarations-closure.ts+++ b/test-support/read-declarations-closure.ts@@ -135,5 +135,7 @@ export function derivedReads(}files.push(...matched);}- return deriveReadClosure(okRoot, [...new Set(files)].sort()).filter((path) => listed.has(path));+ const matchedFiles = [...new Set(files)].sort();+ const imported = deriveReadClosure(okRoot, matchedFiles).filter((path) => listed.has(path));+ return [...new Set([...matchedFiles, ...imported])].sort();}