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

[issue-9516] Run executable documentation contracts in scoped CI (#9534)

[._.]/3b595c5646ac
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index aa2d000ff1..aaf7088cee 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -218,6 +218,7 @@ export const ALWAYS_RUN_TESTS = [
// otherwise merge green.
'docs/api-doc.test.js',
'docs/deps-doc.test.js',
+ 'docs/features/product-surfaces.test.js',
'scripts/agent-instructions-files.test.js',
// The union-merged catalogs are `.md` to the planner — documentation-only —
// so a rebase that doubled a row would otherwise never be re-checked.
@@ -402,9 +403,10 @@ const pathMatchesFeature = (path, feature) => {
};
const isTestFile = (path) => TEST_FILE_RE.test(path);
-const isDocumentationOnly = (path) => DOCUMENTATION_RULES.some((rule) => rule.test(path));
const isPythonScript = (path) => PYTHON_SCRIPT_RE.test(path);
const isExecutable = (path) => EXECUTABLE_RE.test(path) || isPythonScript(path);
+// A documentation directory can also contain runnable contracts and helpers.
+const isDocumentationOnly = (path) => !isExecutable(path) && DOCUMENTATION_RULES.some((rule) => rule.test(path));
const isServerRunnerFile = (path) => RUNNER_ROOTS.server.some((root) => path.startsWith(root));
const isClientRunnerFile = (path) => RUNNER_ROOTS.client.some((root) => path.startsWith(root));
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 231ffdcf79..63f7132239 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -241,6 +241,27 @@ it('carries transitive browser re-exports through the planner CLI and fails clos
});
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'];
+ const plan = buildCiTestPlan(paths, { trackedFiles: [...TRACKED, ...paths] });
+
+ expect(plan.full).toBe(false);
+ expect(plan.server.mode).toBe('files');
+ expect(plan.server.files).toEqual(expect.arrayContaining(paths));
+ expect(plan.client.mode).toBe('skip');
+ });
+
+ it('covers the product-surfaces Markdown input without widening ordinary documentation changes', () => {
+ const contract = 'docs/features/product-surfaces.test.js';
+ const plan = buildCiTestPlan(['docs/features/product-surfaces.md'], {
+ trackedFiles: [...TRACKED, contract],
+ });
+
+ expect(plan).toMatchObject({ full: false, reason: 'documentation-only change',
+ server: { mode: 'files' }, client: { mode: 'skip' }, build: false, db: false, windows: false });
+ expect(plan.server.files).toContain(contract);
+ });
+
it('skips all expensive jobs for documentation-only changes, keeping the always-run guards', () => {
const plan = buildCiTestPlan([
'.changelog/NEXT.md',
@@ -555,6 +576,7 @@ describe('CI test impact planner', () => {
const plan = buildCiTestPlan([
'server/services/sprites/atlas.test.js', // deleted alongside its source
'client/src/components/catalog/CatalogCard.test.jsx', // deleted test
+ 'docs/example.test.js', // executable documentation contract was removed
], { trackedFiles: TRACKED.filter((path) => ![
'server/services/sprites/atlas.test.js',
'client/src/components/catalog/CatalogCard.test.jsx',
@@ -562,6 +584,7 @@ describe('CI test impact planner', () => {
expect(plan.full).toBe(false);
expect(plan.server.files).not.toContain('server/services/sprites/atlas.test.js');
+ expect(plan.server.files).not.toContain('docs/example.test.js');
});
it('widens when a changed executable source was deleted', () => {