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: scope review-loop snapshot CI plans (#7883)

[._.]/ Adam Eivy1cfc5961dc6a
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index 4d0b168317..8710e158fe 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -263,6 +263,18 @@ const DOCUMENTATION_RULES = [
/\.(?:md|mdx|png|jpe?g|gif|webp|svg|ico)$/i,
];
+// 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.
+const FIXTURE_OWNERS = [
+ {
+ re: /^server\/services\/promptSections\/__snapshots__\/reviewLoopMatrix\/[^/]+\.txt$/,
+ tests: ['server/services/promptSections/reviewLifecycleMatrix.test.js'],
+ },
+];
+
+const fixtureOwnerFor = (path) => FIXTURE_OWNERS.find(({ re }) => re.test(path));
+
// The bundled slashdo submodule (see AGENTS.md "Slashdo Commands") ships no
// source into the tree the planner scans — `git diff` reports only the gitlink
// pointer at this path, never the files inside it — so it can't be detected the
@@ -623,10 +635,28 @@ export function buildCiTestPlan(changedFiles, {
}
const executable = relevant.filter(isExecutable);
- const unknown = relevant.filter((path) => !isExecutable(path));
+ const fixtureTests = [];
+ const unknown = [];
+ const missingFixtureOwners = [];
+ for (const path of relevant) {
+ if (isExecutable(path)) continue;
+ const owner = fixtureOwnerFor(path);
+ if (!owner) {
+ unknown.push(path);
+ continue;
+ }
+ if (owner.tests.some((test) => !trackedSet.has(test) || !runnerForTest(test))) {
+ missingFixtureOwners.push(path);
+ continue;
+ }
+ fixtureTests.push(...owner.tests);
+ }
if (unknown.length > 0) {
return fullPlan(changed, `unclassified changed file: ${unknown[0]}`, { appRouteOnly, trackedSet });
}
+ if (missingFixtureOwners.length > 0) {
+ return fullPlan(changed, `fixture owner not tracked: ${missingFixtureOwners[0]}`, { appRouteOnly, trackedSet });
+ }
if (executable.length > MAX_CHANGED_CODE_FILES) {
return fullPlan(changed, `wide change (${executable.length} executable files)`, { appRouteOnly, trackedSet, windowsEscalates: false });
}
@@ -658,6 +688,7 @@ export function buildCiTestPlan(changedFiles, {
const unscopedSources = jsSources.filter((path) => !featureDirectory(path));
const selectedTests = [
...directTests,
+ ...fixtureTests,
...structuralTestsFor(changed, trackedSet),
...alwaysRun,
];
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 0b5114e63e..93991925ca 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -65,6 +65,18 @@ const TRACKED = [
'scripts/fix-windows-console.js',
];
+const REVIEW_LOOP_SNAPSHOT = 'server/services/promptSections/__snapshots__/reviewLoopMatrix/local-gh.txt';
+const REVIEW_LOOP_OWNER = 'server/services/promptSections/reviewLifecycleMatrix.test.js';
+const REVIEW_LIFECYCLE_SOURCE = 'server/services/promptSections/reviewLifecycle.js';
+const REVIEW_LIFECYCLE_TEST = 'server/services/promptSections/reviewLifecycle.test.js';
+const REVIEW_LOOP_TRACKED = [
+ ...TRACKED,
+ REVIEW_LOOP_SNAPSHOT,
+ REVIEW_LOOP_OWNER,
+ REVIEW_LIFECYCLE_SOURCE,
+ REVIEW_LIFECYCLE_TEST,
+];
+
it('preserves Git-quoted source and contract paths through the planner CLI', () => {
const root = mkdtempSync(join(tmpdir(), 'portos-ci-paths-'));
const planner = fileURLToPath(new URL('./ci-test-plan.js', import.meta.url));
@@ -582,6 +594,71 @@ describe('CI test impact planner', () => {
expect(clientSide.server.files).toContain('server/lib/eidoverseWorldReset.parity.test.js');
});
+ describe('explicit text fixture ownership', () => {
+ it('selects the review-loop snapshot owner and always-run guards without full CI', () => {
+ const plan = buildCiTestPlan([REVIEW_LOOP_SNAPSHOT], { trackedFiles: REVIEW_LOOP_TRACKED });
+
+ expect(plan).toMatchObject({
+ full: false,
+ server: {
+ mode: 'files',
+ files: [REVIEW_LOOP_OWNER, 'server/services/taskPromptDefaults.test.js'],
+ sources: [],
+ },
+ client: { mode: 'skip' },
+ db: false,
+ build: false,
+ smoke: false,
+ windows: false,
+ });
+ });
+
+ it('combines a mapped snapshot owner with normal source selection', () => {
+ const plan = buildCiTestPlan([REVIEW_LIFECYCLE_SOURCE, REVIEW_LOOP_SNAPSHOT], {
+ trackedFiles: REVIEW_LOOP_TRACKED,
+ });
+
+ expect(plan.full).toBe(false);
+ expect(plan.server.mode).toBe('files');
+ expect(plan.server.sources).toEqual([]);
+ expect(plan.server.files).toEqual(expect.arrayContaining([
+ REVIEW_LIFECYCLE_TEST,
+ REVIEW_LOOP_OWNER,
+ 'server/services/taskPromptDefaults.test.js',
+ ]));
+ expect(plan.smoke).toBe(true);
+ });
+
+ it('fails closed for an unmapped fixture or a missing owner', () => {
+ const unmapped = buildCiTestPlan([
+ 'server/services/promptSections/__snapshots__/otherMatrix/unknown.txt',
+ ], { trackedFiles: REVIEW_LOOP_TRACKED });
+ expect(unmapped.full).toBe(true);
+ expect(unmapped.reason).toMatch(/unclassified/);
+
+ const missingOwner = buildCiTestPlan([REVIEW_LOOP_SNAPSHOT], { trackedFiles: TRACKED });
+ expect(missingOwner.full).toBe(true);
+ expect(missingOwner.reason).toMatch(/fixture owner not tracked/);
+ });
+
+ it('keeps an independent lockfile full-CI trigger authoritative', () => {
+ const plan = buildCiTestPlan([REVIEW_LOOP_SNAPSHOT, 'package-lock.json'], {
+ trackedFiles: [...REVIEW_LOOP_TRACKED, ...WINDOWS_CONTRACT_TESTS],
+ });
+
+ expect(plan).toMatchObject({
+ full: true,
+ server: { mode: 'full' },
+ client: { mode: 'full' },
+ db: true,
+ build: true,
+ smoke: true,
+ windows: true,
+ windowsMode: 'full',
+ });
+ });
+ });
+
it('runs the tree-scanning route and prompt-stage guards whenever a server source changes', () => {
const treeGuards = [
'server/lib/apiRouteGraph.test.js',