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([issue-12739]): scope CI for Python requirement pin changes

[._.]/ Adam Eivy67738304e442
diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.md
index 027d433805..395cd9252b 100644
--- a/docs/GITHUB_ACTIONS.md
+++ b/docs/GITHUB_ACTIONS.md
@@ -936,8 +936,9 @@ gets two content-addressed keys (`scripts/lib/testMemo.js`):
Both keys also cover: every non-JS file a member names through a literal path
anchored at `import.meta.url`, `__dirname`, `process.cwd()` or an identifier
bound to one of those (a literal directory contributes its whole tree, up to
-400 files; snapshot files and the planner's `FIXTURE_OWNERS` directories are
-added for the test itself); the installed version of every package the
+400 files; snapshot files and each `FIXTURE_OWNERS` directory — or only
+its direct children when the owner sets `fileRe` — are added for the test
+itself); the installed version of every package the
members reach (so a lockfile bump invalidates exactly the suites that reach
the bumped packages); a Python sidecar's resolvable sibling imports; the
version of an external program a member reaches (`TEST_MEMO_TOOLS`: the
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index 350cb90bb3..d7cdeb0f3f 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -537,14 +537,29 @@ const DOCUMENTATION_RULES = [
// Text snapshots are executable test inputs, but their extension is deliberately
// outside EXECUTABLE_RE. Keep this mapping explicit rather than treating every
// `.txt` file as a test fixture: an unmapped text artifact must still widen CI.
-// `dir` names the directory the pattern covers so the test memo
-// (scripts/lib/testMemo.js) can hash every fixture an owning test reads.
+// `dir` names the directory the test memo (scripts/lib/testMemo.js) hashes for
+// an owning test. `fileRe`, when set, keeps only that directory's direct
+// children — `scripts/` is past the memo's directory limit, and hashing the
+// whole tree would fail the installer suites closed instead of keying the pins.
export const FIXTURE_OWNERS = [
{
re: /^server\/services\/promptSections\/__snapshots__\/reviewLoopMatrix\/[^/]+\.txt$/,
dir: 'server/services/promptSections/__snapshots__/reviewLoopMatrix',
tests: ['server/services/promptSections/reviewLifecycleMatrix.test.js'],
},
+ // Pip pins consumed only by an explicit Install/Repair (`setup-image-video.sh`).
+ // No Vitest suite reads the files; the installer-contract tests are the suites
+ // that exercise that script and server/lib/pythonSetup.js.
+ {
+ re: /^scripts\/requirements-[^/]+\.txt$/,
+ dir: 'scripts',
+ fileRe: /^requirements-[^/]+\.txt$/,
+ tests: [
+ 'scripts/setup-image-video.test.js',
+ 'server/lib/pythonSetup.install.test.js',
+ 'server/lib/pythonSetup.test.js',
+ ],
+ },
];
const fixtureOwnerFor = (path) => FIXTURE_OWNERS.find(({ re }) => re.test(path));
@@ -1246,6 +1261,7 @@ function buildSuitePlan(changedFiles, {
let reason = 'Vitest related-test fallback';
if (features.length) reason = `targeted features: ${features.join(', ')}`;
else if (jsSources.length === 0 && pythonSources.length > 0) reason = 'python script parsing contracts';
+ else if (jsSources.length === 0 && fixtureTests.length > 0) reason = 'text fixture owners';
return finishPlan({
full: false,
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 3793d3f6af..344a64f665 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -1004,6 +1004,48 @@ describe('CI test impact planner', () => {
expect(missingOwner.reason).toMatch(/fixture owner not tracked/);
});
+ it('scopes a requirements-pin change to the installer contract', () => {
+ const requirements = [
+ 'scripts/requirements-ltx25-cuda.txt',
+ 'scripts/requirements-minimax-h3-cuda.txt',
+ 'scripts/requirements-minimax-h3-mlx.lock.txt',
+ 'scripts/requirements-wan22-cuda.txt',
+ ];
+ const owners = [
+ 'scripts/setup-image-video.test.js',
+ 'server/lib/pythonSetup.install.test.js',
+ 'server/lib/pythonSetup.test.js',
+ ];
+ const plan = buildCiTestPlan(requirements, { trackedFiles: [...TRACKED, ...requirements, ...owners] });
+
+ expect(plan.full).toBe(false);
+ expect(plan.reason).toBe('text fixture owners');
+ expect(plan.server).toMatchObject({ mode: 'files', sources: [] });
+ expect(plan.server.files).toEqual([
+ ...owners,
+ 'server/services/taskPromptDefaults.test.js',
+ ].sort());
+ expect(plan.client).toMatchObject({ mode: 'skip' });
+ expect(plan).toMatchObject({ db: false, build: false, smoke: false, windows: false });
+ });
+
+ it('still widens CI for an unmapped text artifact', () => {
+ const owners = [
+ 'scripts/setup-image-video.test.js',
+ 'server/lib/pythonSetup.test.js',
+ ];
+ const unmapped = buildCiTestPlan(['scripts/notes.txt'], {
+ trackedFiles: [...TRACKED, ...owners, 'scripts/notes.txt'],
+ });
+ expect(unmapped.full).toBe(true);
+ expect(unmapped.reason).toMatch(/unclassified changed file: scripts\/notes\.txt/);
+
+ // The pin pattern is one filename shape, not every requirements text file.
+ const bare = buildCiTestPlan(['scripts/requirements.txt'], { trackedFiles: TRACKED });
+ expect(bare.full).toBe(true);
+ expect(bare.reason).toMatch(/unclassified/);
+ });
+
it('keeps an independent lockfile full-CI trigger authoritative', () => {
const plan = buildCiTestPlan([REVIEW_LOOP_SNAPSHOT, 'server/package-lock.json'], {
trackedFiles: [...REVIEW_LOOP_TRACKED, ...WINDOWS_CONTRACT_TESTS],
diff --git a/scripts/lib/testMemo.js b/scripts/lib/testMemo.js
index 4f25471b6a..922d9f1417 100644
--- a/scripts/lib/testMemo.js
+++ b/scripts/lib/testMemo.js
@@ -970,23 +970,30 @@ export function createTestMemoAnalyzer({ fs, workspaceRel, env = {}, platform =
const ignoredInput = (rel) => IGNORED_INPUT_PREFIXES.some((prefix) => rel === prefix.slice(0, -1) || rel.startsWith(prefix));
const underGit = (rel) => rel === '.git' || rel.startsWith('.git/');
- /** Sorted files under `dirRel`, or null when the tree exceeds the limit. */
- const tree = (dirRel) => {
- if (trees.has(dirRel)) return trees.get(dirRel);
+ /**
+ * Sorted files under `dirRel`, or null when the collected set exceeds the
+ * limit. `nameRe` keeps only direct children whose basename matches; other
+ * names are not counted, so a directory past the limit can still contribute
+ * a small explicit set (the Python requirement pins under `scripts/`).
+ */
+ const tree = (dirRel, nameRe = null) => {
+ const cacheKey = nameRe ? `${dirRel}\0${nameRe.source}\0${nameRe.flags}` : dirRel;
+ if (trees.has(cacheKey)) return trees.get(cacheKey);
const files = [];
const walk = (dir) => {
for (const name of fs.list(dir).sort()) {
if (SKIP_TREE_DIRS.has(name) || (dir === '' && name === 'data')) continue;
const rel = dir === '' ? name : `${dir}/${name}`;
const kind = fs.kind(rel);
- if (kind === 'dir') walk(rel);
- else if (kind === 'file') files.push(rel);
+ if (kind === 'dir') {
+ if (!nameRe) walk(rel);
+ } else if (kind === 'file' && (!nameRe || nameRe.test(name))) files.push(rel);
if (files.length > DIRECTORY_INPUT_LIMIT) throw new RangeError('tree too large');
}
};
let result = files;
try { walk(dirRel); } catch (error) { if (!(error instanceof RangeError)) throw error; result = null; }
- trees.set(dirRel, result);
+ trees.set(cacheKey, result);
return result;
};
@@ -1202,7 +1209,7 @@ export function createTestMemoAnalyzer({ fs, workspaceRel, env = {}, platform =
const problems = [];
for (const owner of FIXTURE_OWNERS) {
if (!owner.tests.includes(testRel)) continue;
- const files = tree(owner.dir);
+ const files = tree(owner.dir, owner.fileRe);
if (files === null) problems.push(`fixture directory too large: ${owner.dir}`);
else for (const file of files) inputs.add(file);
}
diff --git a/scripts/lib/testMemo.test.js b/scripts/lib/testMemo.test.js
index 6e5786f650..48a55d40cd 100644
--- a/scripts/lib/testMemo.test.js
+++ b/scripts/lib/testMemo.test.js
@@ -128,6 +128,43 @@ describe('floor key', () => {
});
});
+describe('fixture owners', () => {
+ // No package import: a scripts/ owner does not walk up into server/node_modules.
+ const stub = "it('pin', () => {});\n";
+ const owners = [
+ 'scripts/setup-image-video.test.js',
+ 'server/lib/pythonSetup.install.test.js',
+ 'server/lib/pythonSetup.test.js',
+ ];
+ const files = {
+ ...TREE,
+ ...Object.fromEntries(owners.map((owner) => [owner, stub])),
+ 'scripts/requirements-ltx25-cuda.txt': 'pillow==1\n',
+ 'scripts/requirements-wan22-cuda.txt': 'diffusers==1\n',
+ 'scripts/notes.txt': 'unmapped\n',
+ 'scripts/nested/requirements-extra.txt': 'nested\n',
+ };
+
+ it('hashes requirements pins into the installer-contract owners and ignores other text', () => {
+ for (const owner of owners) {
+ const before = keyOf(files, owner);
+ expect(before.floor.memoizable, owner).toBe(true);
+ expect(keyOf({ ...files, 'scripts/requirements-ltx25-cuda.txt': 'pillow==2\n' }, owner).floor.key, owner)
+ .not.toBe(before.floor.key);
+ expect(keyOf({ ...files, 'scripts/notes.txt': 'changed\n' }, owner).floor.key, owner).toBe(before.floor.key);
+ expect(keyOf({ ...files, 'scripts/nested/requirements-extra.txt': 'changed\n' }, owner).floor.key, owner)
+ .toBe(before.floor.key);
+ const recorded = keyOf(files, owner, { records: new Map([[owner, [owner]]]) });
+ expect(recorded.recorded.memoizable, owner).toBe(true);
+ expect(keyOf(
+ { ...files, 'scripts/requirements-wan22-cuda.txt': 'diffusers==2\n' },
+ owner,
+ { records: new Map([[owner, [owner]]]) },
+ ).recorded.key, owner).not.toBe(recorded.recorded.key);
+ }
+ });
+});
+
describe('recorded key', () => {
const recorded = ['server/lib/a.test.js', 'server/lib/a.js', 'server/lib/b.js'];
const withRecord = (files, test = 'server/lib/a.test.js', loaded = recorded) => keyOf(files, test, { records: new Map([[test, loaded]]) });