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: include untracked source files in local CI dependency discovery (#9628)

Adam Eivy6f6c65ff09b7
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index aaf7088cee..daef86e4fd 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -1007,6 +1007,14 @@ export function collectPlanInputs({ baseSha, forceFull = false, changedFiles, cw
]).filter((path) => existsSync(join(cwd, path)))
: trackedFiles;
+ // Present, non-ignored untracked sources are real local imports: without them
+ // a tracked importer of a not-yet-staged module looks unresolved and the
+ // dependency walk fails closed to a full plan. Local override mode only —
+ // committed CI inputs stay tracked-only.
+ const untrackedFiles = hasChangedFilesOverride
+ ? gitPaths(['ls-files', '-z', '--others', '--exclude-standard'], cwd).filter((path) => existsSync(join(cwd, path)))
+ : [];
+
let appDiff = null;
if (!forceFull && collectedChangedFiles.includes('client/src/App.jsx')) {
const committedDiff = execFileSync(
@@ -1032,7 +1040,7 @@ export function collectPlanInputs({ baseSha, forceFull = false, changedFiles, cw
const clientDependencies = collectedChangedFiles.some((path) => path.startsWith('server/lib/')
&& isExecutable(path) && !isTestFile(path))
- ? collectClientDependencies(presentFiles, cwd)
+ ? collectClientDependencies(hasChangedFilesOverride ? uniqueSorted([...presentFiles, ...untrackedFiles]) : presentFiles, cwd)
: [];
return { changedFiles: collectedChangedFiles, trackedFiles: presentFiles, appDiff, pathContractTests, clientDependencies };
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 63f7132239..6cc3aff911 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -240,6 +240,43 @@ it('carries transitive browser re-exports through the planner CLI and fails clos
}
});
+it('resolves local client imports of present untracked modules and still fails closed on missing ones', () => {
+ const root = mkdtempSync(join(tmpdir(), 'portos-ci-untracked-deps-'));
+ const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();
+ const write = (path, source) => {
+ mkdirSync(dirname(join(root, path)), { recursive: true });
+ writeFileSync(join(root, path), source);
+ };
+ const leaf = 'server/lib/shared/leaf.js';
+ const inspect = () => {
+ const inputs = collectPlanInputs({ baseSha: 'HEAD', changedFiles: [leaf], cwd: root });
+ return buildCiTestPlan(inputs.changedFiles, inputs);
+ };
+ try {
+ git('init', '-q');
+ write(leaf, 'export const value = 1;\n');
+ write('client/src/lib/consumer.js', "import { widget } from './newWidget.js';\nexport { value } from '../../../server/lib/shared/leaf.js';\n");
+ write('client/src/lib/consumer.test.js', "import './consumer.js';\n");
+ git('add', '--all');
+
+ // newWidget.js exists but is not yet staged: still a resolvable local import.
+ write('client/src/lib/newWidget.js', 'export const widget = 1;\n');
+ expect(git('status', '--porcelain')).toContain('?? client/src/lib/newWidget.js');
+ const plan = inspect();
+ expect(plan.full).toBe(false);
+ expect(plan.client.mode).toBe('related');
+ expect(plan.client.sources).toContain(leaf);
+
+ // Control: a genuinely missing import still widens to a full plan.
+ rmSync(join(root, 'client/src/lib/newWidget.js'));
+ const missing = inspect();
+ expect(missing.full).toBe(true);
+ expect(missing.reason).toBe('client dependency discovery unresolved');
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ }
+});
+
describe('CI test impact planner', () => {
it('selects executable documentation tests, including contracts outside the always-run list', () => {
const paths = ['docs/features/product-surfaces.test.js', 'docs/example.test.js'];