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

refactor: share the slashdo submodule CI guard, document known gaps

[._.]/ Adam Eivyeaa6bfaab561
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index b4e3705520..a02b685af2 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -223,7 +223,26 @@ const SLASHDO_CONTRACT_SOURCE_FILES = [
'server/lib/slashdoInvocation.js',
];
-/** Whether this plan's server job needs `lib/slashdo` initialized. */
+/**
+ * Whether this plan's server job needs `lib/slashdo` initialized.
+ *
+ * The `changedFiles` check is currently unreachable from `buildCiTestPlan`
+ * itself: `SLASHDO_GITLINK_PATH` has no recognized extension, so a real
+ * gitlink change already hits the "unclassified changed file" rule and forces
+ * `plan.full = true` first, which the `plan.full` clause above already
+ * covers. It stays as a direct, defense-in-depth check — independent of that
+ * incidental classification — and is what the unit tests below exercise
+ * against a hand-built plan.
+ *
+ * This only catches a literal edit to the two source files, not an indirect
+ * one: a shared dependency of `slashdoLoader.js`/`slashdoInvocation.js`
+ * changing would not set this, even though Vitest's real `related` selection
+ * can still transitively pull the contract tests in — in which case they run
+ * without the submodule and take the documented skip. In practice a
+ * sufficiently shared dependency changing also tends to select enough tests
+ * to exceed MAX_TARGETED_TEST_FILES and force a full plan, which does trigger
+ * this; a narrowly-shared one is the remaining gap.
+ */
export const needsSlashdoSubmodule = (plan) => Boolean(
plan.full
|| plan.changedFiles.includes(SLASHDO_GITLINK_PATH)
diff --git a/server/lib/slashdoInvocation.test.js b/server/lib/slashdoInvocation.test.js
index c2e294752b..ab7e1400e1 100644
--- a/server/lib/slashdoInvocation.test.js
+++ b/server/lib/slashdoInvocation.test.js
@@ -15,6 +15,7 @@ import {
unreachableReviewerIncludes,
} from './slashdoInvocation.js';
import { loadSlashdoFile } from './slashdoLoader.js';
+import { requireSlashdoSubmoduleInCi } from './testHelper.js';
describe('isValidSlashdoCommand', () => {
it('accepts bare command names', () => {
@@ -386,12 +387,7 @@ describe('bundled command context budget', () => {
it('keeps the better entrypoint small and preserves an eager procedure', async () => {
const { existsSync } = await import('fs');
if (!existsSync(new URL('../../lib/slashdo/src/transformer.js', import.meta.url))) {
- // See slashdoLoader.test.js for why this fails rather than skips in CI
- // when the submodule was expected: a return here would otherwise turn a
- // failed "Initialize slashdo submodule" step into a silent pass.
- if (process.env.CI_EXPECT_SLASHDO_SUBMODULE === 'true') {
- throw new Error('lib/slashdo submodule is missing but this CI job expected it to be initialized');
- }
+ requireSlashdoSubmoduleInCi(false);
return;
}
const { loadSlashdoBundle } = await import('./slashdoLoader.js');
diff --git a/server/lib/slashdoLoader.test.js b/server/lib/slashdoLoader.test.js
index f5e820f2dc..8cdddcfd9c 100644
--- a/server/lib/slashdoLoader.test.js
+++ b/server/lib/slashdoLoader.test.js
@@ -16,17 +16,11 @@ vi.mock('./fileUtils.js', async importOriginal => {
} };
});
import { loadSlashdoLib, loadSlashdoFile, loadSlashdoBundle, writeResolvedSlashdoBody } from './slashdoLoader.js';
+import { requireSlashdoSubmoduleInCi } from './testHelper.js';
const source = fileURLToPath(new URL('../../lib/slashdo/src', import.meta.url));
const hasSubmodule = existsSync(join(source, 'transformer.js'));
-// CI sets this (see ci.yml "Initialize slashdo submodule") whenever the
-// selected test plan needs the real bundled renderer — a missing submodule
-// there means the init step failed silently, so this must fail the job
-// rather than quietly falling back to the fixture-only coverage below. A
-// local or intentionally minimal checkout (the flag unset) keeps skipping.
-if (process.env.CI_EXPECT_SLASHDO_SUBMODULE === 'true' && !hasSubmodule) {
- throw new Error('lib/slashdo submodule is missing but this CI job expected it to be initialized');
-}
+requireSlashdoSubmoduleInCi(hasSubmodule);
const write = (path, body) => {
mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, body);
diff --git a/server/lib/testHelper.js b/server/lib/testHelper.js
index fb01e467d3..c333e7e224 100644
--- a/server/lib/testHelper.js
+++ b/server/lib/testHelper.js
@@ -404,3 +404,18 @@ export function resolveTestPython() {
}
}) || null;
}
+
+/**
+ * Fail the CI job — rather than silently skip — when `lib/slashdo` was
+ * expected to be initialized but isn't (issue #6263). ci.yml sets
+ * `CI_EXPECT_SLASHDO_SUBMODULE` on the "Run server tests" step whenever the
+ * impact planner selected slashdo's bundled adapter contracts; a missing
+ * submodule there means the "Initialize slashdo submodule" step failed. With
+ * the env var unset — a local or intentionally minimal checkout — this is a
+ * no-op and the caller's own skip/early-return applies instead.
+ */
+export function requireSlashdoSubmoduleInCi(hasSubmodule) {
+ if (process.env.CI_EXPECT_SLASHDO_SUBMODULE === 'true' && !hasSubmodule) {
+ throw new Error('lib/slashdo submodule is missing but this CI job expected it to be initialized');
+ }
+}