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

ci: run prompt-history and Linux containment jobs only when their inputs change

[._.]/ Adam Eivyf88c2c2fa2f8
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3681445b93..ce3e12fbb3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -50,6 +50,10 @@ jobs:
build: ${{ steps.plan.outputs.build }}
smoke: ${{ steps.plan.outputs.smoke }}
slashdo: ${{ steps.plan.outputs.slashdo }}
+ # Path-gated single-purpose jobs: true on a forced-full run, else only
+ # when the diff reaches the job's import closure (scripts/ci-test-plan.js).
+ prompt_history: ${{ steps.plan.outputs.prompt_history }}
+ linux_containment: ${{ steps.plan.outputs.linux_containment }}
windows: ${{ steps.plan.outputs.windows }}
windows_mode: ${{ steps.plan.outputs.windows_mode }}
windows_files: ${{ steps.plan.outputs.windows_files }}
@@ -131,6 +135,9 @@ jobs:
BUILD_MODE: ${{ steps.plan.outputs.build }}
SMOKE_MODE: ${{ steps.plan.outputs.smoke }}
SLASHDO_MODE: ${{ steps.plan.outputs.slashdo }}
+ PROMPT_HISTORY_MODE: ${{ steps.plan.outputs.prompt_history }}
+ LINUX_CONTAINMENT_MODE: ${{ steps.plan.outputs.linux_containment }}
+ NODE_MINIMUM_MODE: ${{ steps.node-minimum.outputs.run }}
WINDOWS_MODE: ${{ steps.plan.outputs.windows }}
WINDOWS_TEST_MODE: ${{ steps.plan.outputs.windows_mode }}
SERVER_SHARDS: ${{ steps.plan.outputs.server_shards }}
@@ -150,12 +157,17 @@ jobs:
echo "- Client build: \`${BUILD_MODE}\`"
echo "- Server smoke: \`${SMOKE_MODE}\`"
echo "- Slashdo submodule: \`${SLASHDO_MODE}\`"
+ echo "- Shipped prompt history: \`${PROMPT_HISTORY_MODE}\`"
+ echo "- Linux worker containment: \`${LINUX_CONTAINMENT_MODE}\`"
+ echo "- Node minimum compatibility: \`${NODE_MINIMUM_MODE}\`"
echo "- Windows server tests: \`${WINDOWS_MODE}\` (\`${WINDOWS_TEST_MODE}\`, shards \`${WINDOWS_SHARDS}\`)"
echo "- Suite selection reasons: \`${SUITE_REASONS}\`"
} >> "$GITHUB_STEP_SUMMARY"
prompt-history:
name: Shipped prompt history
+ needs: impact
+ if: needs.impact.outputs.prompt_history == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
@@ -1040,7 +1052,7 @@ jobs:
linux-containment:
name: Linux worker containment
needs: impact
- if: needs.impact.outputs.server_mode != 'skip'
+ if: needs.impact.outputs.linux_containment == 'true'
# 22.04 allows unprivileged user namespaces without changing the runner's
# AppArmor policy. Restricted hosts must remain fail-closed in the product.
runs-on: ubuntu-22.04
@@ -1065,6 +1077,8 @@ jobs:
- name: Exercise real namespaces, seccomp, limits and cancellation
env:
PORTOS_REQUIRE_LINUX_CONTAINMENT: '1'
+ # Keep this list equal to the impact planner's LINUX_CONTAINMENT_TESTS:
+ # the job is gated on those files' import closure.
run: npm test --prefix server -- --run lib/codeAnimationContainment.test.js routes/codeAnimationExecution.test.js services/codeAnimation/containedWorker.test.js
gate:
diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.md
index 4c0b104d54..5663f2f4c4 100644
--- a/docs/GITHUB_ACTIONS.md
+++ b/docs/GITHUB_ACTIONS.md
@@ -423,7 +423,8 @@ own.
### Shallow checkouts
-No job clones full history. `actions/checkout` runs at `fetch-depth: 2`
+Only the path-gated **Shipped prompt history** job clones full history (it
+reads every past stage-prompt body). `actions/checkout` runs at `fetch-depth: 2`
in every job that diffs against the base. The two gate jobs set no depth at all
(the action's own default is 1) and pass `sparse-checkout: scripts` instead:
they check out only to run `scripts/ci-gate-report.js`, never look at history,
@@ -510,6 +511,24 @@ The selected work is split across parallel jobs:
when a `package.json`, a lockfile, an `.npmrc`, `.nvmrc`, the gate script or
its `directInvocation.js` import, its drift test or `ci.yml` changed, since nothing else can change its answer; non-PR runs
always run it.
+- **Shipped prompt history** — the one job with a full-history clone; it checks
+ that every stage-prompt body ever shipped is accepted by a prompt migration.
+ On a pull request it runs only when the impact planner's `prompt_history`
+ output is true: the diff touches `scripts/migrations/`,
+ `data.reference/prompts/`, `server/services/taskPromptDefaults`, the
+ integrity-snapshot regenerator, `ci.yml`, or any module the guard or a
+ hash-declaring migration statically imports (`PROMPT_HISTORY_PATH_RE` and
+ `collectPromptHistoryInputs()` in `scripts/ci-test-plan.js`). Non-PR runs
+ and pull requests into `release` always run it, and `npm run pregate` runs
+ it locally when selected.
+- **Linux worker containment** — runs `LINUX_CONTAINMENT_TESTS` against real
+ bubblewrap namespaces on ubuntu-22.04. On a pull request it runs only when
+ the `linux_containment` output is true: the diff touches the static import
+ closure of those tests and the server Vitest harness, `server/package.json`,
+ `server/package-lock.json` or `ci.yml`. The closure is recomputed from the
+ head tree on every run, so a new dependency is gated without a list edit.
+ Non-PR runs and pull requests into `release` always run it. Pregate reports
+ it as CI-only.
- **CI Gate** — always reports one stable required-check result and fails if any
selected job failed or was cancelled. Both block, but the message distinguishes
them: `scripts/ci-gate-report.js` says *cancelled, not failed* and names the
diff --git a/scripts/ci-dependabot-admission.test.js b/scripts/ci-dependabot-admission.test.js
index babe903c7a..0e71562e23 100644
--- a/scripts/ci-dependabot-admission.test.js
+++ b/scripts/ci-dependabot-admission.test.js
@@ -42,7 +42,7 @@ describe('Dependabot maintainer release', () => {
expect(ci.impact.indexOf('node scripts/ci-dependabot-admission.js'))
.toBeLessThan(ci.impact.indexOf('node scripts/ci-base-sha.js'));
expect(ci.impact).not.toContain('continue-on-error: true');
- for (const name of ['server', 'client', 'lint', 'database', 'browser', 'windows-server', 'node-minimum', 'linux-containment']) {
+ for (const name of ['prompt-history', 'server', 'client', 'lint', 'database', 'browser', 'windows-server', 'node-minimum', 'linux-containment']) {
expect(ci[name]).toContain('needs: impact');
}
expect(ci.gate).toContain('if: always()');
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.js
index 552cb93ca4..cd1523aa9a 100644
--- a/scripts/ci-test-plan.js
+++ b/scripts/ci-test-plan.js
@@ -2,13 +2,14 @@
import { execFileSync } from 'child_process';
import { existsSync, readFileSync } from 'fs';
-import { join, posix } from 'path';
-import { staticImportSpecifiersFromSource } from '../server/lib/staticImportGraph.js';
+import { join, posix, relative } from 'path';
+import { staticImportClosure, staticImportSpecifiersFromSource, toModuleKey } from '../server/lib/staticImportGraph.js';
import { escapeRegExp } from '../server/lib/textUtils.js';
import { isDirectlyInvoked } from './lib/directInvocation.js';
import { writeStepOutput } from './lib/githubOutput.js';
import { resolveDbTestFiles } from './lib/dbTestFiles.js';
import { BROWSER_SUITES } from './lib/browserSuites.js';
+import { declaresPromptHashes, isNumberedMigrationFile } from './migrations/shippedPromptHistory.js';
const TEST_FILE_RE = /\.(?:test|spec)\.[cm]?[jt]sx?$/i;
const MODULE_SOURCE_RE = /\.[cm]?[jt]sx?$/i;
@@ -577,6 +578,75 @@ export const needsSlashdoSubmodule = (plan) => Boolean(
|| plan.server.sources.some((path) => SLASHDO_CONTRACT_SOURCE_FILES.includes(path))
);
+// Two narrow CI jobs observe a small, enumerable input set, so a pull request
+// that touches none of it skips them (non-PR and release-base runs are forced
+// full and always run both). Each gate is the head tree's static import
+// closure of the job's entry points, computed per run so it cannot drift from
+// a hand-kept list, plus the non-module inputs named by the pattern. ci.yml is
+// in both patterns so a workflow edit proves the job still runs.
+export const PROMPT_HISTORY_GUARD = 'scripts/migrations/check-shipped-prompt-history.js';
+// The guard reads git history of data.reference/prompts/stages and imports the
+// migrations that declare prompt hashes. The whole migrations directory is
+// listed (not just today's declaring modules) so a diff that removes a
+// declaration still runs the guard. taskPromptDefaults and the snapshot
+// regenerator are the other half of a prompt-default bump.
+export const PROMPT_HISTORY_PATH_RE = /^(?:scripts\/migrations\/|data\.reference\/prompts\/|server\/services\/taskPromptDefaults(?:\/|\.js$)|scripts\/regen-prompt-integrity-snapshot(?:\.test)?\.js$|\.github\/workflows\/ci\.yml$)/;
+// The files the `linux-containment` job passes to `npm test --prefix server`.
+export const LINUX_CONTAINMENT_TESTS = [
+ 'server/lib/codeAnimationContainment.test.js',
+ 'server/routes/codeAnimationExecution.test.js',
+ 'server/services/codeAnimation/containedWorker.test.js',
+];
+// The server Vitest config and its setup files load around every one of those
+// tests; vitestTempRootSetup.js is named by URL, not by an import edge.
+const LINUX_CONTAINMENT_ENTRIES = [
+ ...LINUX_CONTAINMENT_TESTS,
+ 'server/vitest.config.js',
+ 'server/vitest.setup.js',
+ 'scripts/vitestTempRootSetup.js',
+];
+// The job installs server dependencies from these before running anything.
+export const LINUX_CONTAINMENT_PATH_RE = /^(?:server\/package(?:-lock)?\.json|\.github\/workflows\/ci\.yml)$/;
+
+/**
+ * Repository-relative static import closure of `entries` in `cwd`, or null
+ * when a module cannot be read — the caller then runs the gated job rather
+ * than trusting a partial walk. Every entry is an input even when absent, so
+ * deleting or renaming one still runs the job that names it.
+ */
+const staticClosureOf = (entries, cwd) => {
+ try {
+ const files = new Set(entries);
+ for (const entry of entries) {
+ if (!existsSync(join(cwd, entry))) continue;
+ for (const file of staticImportClosure(join(cwd, entry)).files) files.add(toModuleKey(relative(cwd, file)));
+ }
+ return uniqueSorted([...files]);
+ } catch {
+ return null;
+ }
+};
+
+/** Static closure of the prompt-history guard and every migration it imports. */
+export function collectPromptHistoryInputs(files, cwd) {
+ try {
+ const declaring = files.filter((path) => path.startsWith('scripts/migrations/')
+ && !path.slice('scripts/migrations/'.length).includes('/')
+ && isNumberedMigrationFile(basenameOf(path))
+ && declaresPromptHashes(readFileSync(join(cwd, path), 'utf8')));
+ return staticClosureOf([PROMPT_HISTORY_GUARD, ...declaring], cwd);
+ } catch {
+ return null;
+ }
+}
+
+/** Static closure of the linux-containment tests and their Vitest harness. */
+export const collectLinuxContainmentInputs = (cwd) => staticClosureOf(LINUX_CONTAINMENT_ENTRIES, cwd);
+
+/** True when the diff reaches a gated job's inputs; null inputs fail open to running it. */
+const touchesJobInputs = (changed, inputs, pattern) => inputs === null
+ || changed.some((path) => pattern.test(path) || inputs.includes(path));
+
const RUNNER_ROOTS = {
server: [
'server/',
@@ -866,7 +936,25 @@ const suiteReasonsFor = (plan, { appRouteOnly = false } = {}) => ({
* Flat/shared files fall back to Vitest's import-graph-aware "related" mode,
* while composition roots and test configuration force the complete suite.
*/
-export function buildCiTestPlan(changedFiles, {
+/**
+ * The CI plan for a diff: the test-suite selection plus whether each
+ * path-gated job (prompt history, Linux containment) runs.
+ *
+ * `promptHistoryInputs` / `linuxContainmentInputs` are the jobs' static
+ * import closures from collectPlanInputs(); null (the default) runs the job.
+ */
+export function buildCiTestPlan(changedFiles, options = {}) {
+ const plan = buildSuitePlan(changedFiles, options);
+ const { forceFull = false, promptHistoryInputs = null, linuxContainmentInputs = null } = options;
+ return {
+ ...plan,
+ promptHistory: forceFull || touchesJobInputs(plan.changedFiles, promptHistoryInputs, PROMPT_HISTORY_PATH_RE),
+ linuxContainment: forceFull
+ || touchesJobInputs(plan.changedFiles, linuxContainmentInputs, LINUX_CONTAINMENT_PATH_RE),
+ };
+}
+
+function buildSuitePlan(changedFiles, {
trackedFiles = [],
forceFull = false,
forceFullReason = 'full CI requested',
@@ -1278,6 +1366,8 @@ export function emitGitHubPlan(plan) {
build: plan.build,
smoke: plan.smoke,
slashdo: plan.slashdo,
+ prompt_history: plan.promptHistory,
+ linux_containment: plan.linuxContainment,
windows: plan.windows,
windows_mode: plan.windowsMode,
windows_files: JSON.stringify(plan.windowsFiles),
@@ -1485,8 +1575,12 @@ export function collectPlanInputs({ baseSha, forceFull = false, changedFiles, cw
.filter((path) => DEPENDENCY_MANIFEST_RE.test(path))
.map((path) => [path, classifyDependencyChange(path, baseSha ? readAtBase(path) : null, readInTree(path))]));
+ // A forced-full run always runs both gated jobs, so it skips the walks.
+ const promptHistoryInputs = forceFull ? null : collectPromptHistoryInputs(dependencyFiles, cwd);
+ const linuxContainmentInputs = forceFull ? null : collectLinuxContainmentInputs(cwd);
+
return { changedFiles: collectedChangedFiles, trackedFiles: presentFiles, appDiff, pathContractTests,
- clientDependencies, dbDependencies, browserDependencies, dependencyChanges };
+ clientDependencies, dbDependencies, browserDependencies, dependencyChanges, promptHistoryInputs, linuxContainmentInputs };
}
function main() {
@@ -1510,7 +1604,10 @@ function main() {
&& (!Array.isArray(changedFilesOverride) || changedFilesOverride.some((path) => typeof path !== 'string'))) {
throw new Error('CI_CHANGED_FILES must be a JSON array of repository-relative path strings.');
}
- const { changedFiles, trackedFiles, appDiff, pathContractTests, clientDependencies, dbDependencies, browserDependencies, dependencyChanges } = collectPlanInputs({
+ const {
+ changedFiles, trackedFiles, appDiff, pathContractTests, clientDependencies, dbDependencies, browserDependencies,
+ dependencyChanges, promptHistoryInputs, linuxContainmentInputs,
+ } = collectPlanInputs({
baseSha: base,
forceFull,
changedFiles: changedFilesOverride,
@@ -1525,6 +1622,8 @@ function main() {
dbDependencies,
browserDependencies,
dependencyChanges,
+ promptHistoryInputs,
+ linuxContainmentInputs,
}));
}
diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.js
index 27397672e1..4abc585ba3 100644
--- a/scripts/ci-test-plan.test.js
+++ b/scripts/ci-test-plan.test.js
@@ -1,12 +1,13 @@
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it, vi } from 'vitest';
import { execFileSync } from 'node:child_process';
-import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { resolveDbTestFiles } from './lib/dbTestFiles.js';
import { staticImportClosure } from '../server/lib/staticImportGraph.js';
import { TRUSTED_REBUILDS } from './trusted-rebuilds.js';
+import { workflowJobs } from './lib/workflowJobs.js';
import {
ALWAYS_RUN_TESTS,
@@ -14,9 +15,11 @@ import {
buildCiTestPlan,
classifyDependencyChange,
collectPlanInputs,
+ emitGitHubPlan,
forceFullReasonFor,
FULL_SUITE_SHARDS,
isRouteOnlyAppDiff,
+ LINUX_CONTAINMENT_TESTS,
MAX_TARGETED_TEST_FILES,
needsSlashdoSubmodule,
PLATFORM_PACKAGE_RES,
@@ -1869,3 +1872,81 @@ describe('dependency manifest Windows escalation', () => {
}
});
});
+
+describe('path-gated single-purpose jobs', () => {
+ const repo = fileURLToPath(new URL('../', import.meta.url));
+ const realPlan = (changedFiles) => {
+ const inputs = collectPlanInputs({ baseSha: 'HEAD', changedFiles, cwd: repo });
+ return buildCiTestPlan(inputs.changedFiles, inputs);
+ };
+ const gates = (plan) => ({ promptHistory: plan.promptHistory, linuxContainment: plan.linuxContainment });
+
+ it('runs each job only when the real diff reaches its inputs', () => {
+ expect(gates(realPlan(['docs/README.md']))).toEqual({ promptHistory: false, linuxContainment: false });
+ // Reached only through the hash-declaring migrations' import closure.
+ expect(gates(realPlan(['server/lib/fileUtils.js']))).toEqual({ promptHistory: true, linuxContainment: true });
+ expect(gates(realPlan(['server/lib/codeAnimationContainment.js'])))
+ .toEqual({ promptHistory: false, linuxContainment: true });
+ expect(gates(realPlan(['data.reference/prompts/stages/example.md'])))
+ .toEqual({ promptHistory: true, linuxContainment: false });
+ expect(gates(realPlan(['server/package-lock.json'])).linuxContainment).toBe(true);
+ expect(gates(realPlan(['.github/workflows/ci.yml']))).toEqual({ promptHistory: true, linuxContainment: true });
+ });
+
+ it('gates linux-containment on the whole closure of the tests the job runs', () => {
+ // A transitive dependency of the route test that its name never mentions:
+ // only the import walk can select it.
+ const inputs = collectPlanInputs({ baseSha: 'HEAD', changedFiles: [], cwd: repo });
+ const closure = staticImportClosure(join(repo, 'server/routes/codeAnimationExecution.test.js')).files;
+ expect(closure).toContain(join(repo, 'server/services/codeAnimation/execution.js'));
+ for (const file of closure) {
+ expect(inputs.linuxContainmentInputs).toContain(file.slice(repo.length).split('\\').join('/'));
+ }
+ });
+
+ it('runs both jobs when forced full or when an input walk is inconclusive', () => {
+ expect(gates(buildCiTestPlan(['docs/README.md'], { forceFull: true })))
+ .toEqual({ promptHistory: true, linuxContainment: true });
+ expect(gates(buildCiTestPlan(['docs/README.md'], { promptHistoryInputs: null, linuxContainmentInputs: null })))
+ .toEqual({ promptHistory: true, linuxContainment: true });
+ expect(gates(buildCiTestPlan(['docs/README.md'], { promptHistoryInputs: [], linuxContainmentInputs: [] })))
+ .toEqual({ promptHistory: false, linuxContainment: false });
+ });
+
+ it('still runs a job when the diff deletes one of its entry points', () => {
+ const root = mkdtempSync(join(tmpdir(), 'ci-plan-gates-'));
+ try {
+ execFileSync('git', ['init', '-q'], { cwd: root });
+ const deleted = LINUX_CONTAINMENT_TESTS[0];
+ const inputs = collectPlanInputs({ baseSha: 'HEAD', changedFiles: [deleted], cwd: root });
+ expect(buildCiTestPlan(inputs.changedFiles, inputs).linuxContainment).toBe(true);
+ expect(buildCiTestPlan(['docs/README.md'], inputs).linuxContainment).toBe(false);
+ } finally {
+ rmSync(root, { recursive: true, force: true });
+ }
+ });
+
+ it('emits both decisions and ci.yml gates the jobs on them', () => {
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {});
+ try {
+ emitGitHubPlan(buildCiTestPlan(['docs/README.md'], { promptHistoryInputs: [], linuxContainmentInputs: [] }));
+ const outputs = JSON.parse(log.mock.calls.at(-1)[0]);
+ expect(outputs).toMatchObject({ prompt_history: false, linux_containment: false });
+ } finally {
+ log.mockRestore();
+ }
+
+ const jobs = workflowJobs(readFileSync(join(repo, '.github/workflows/ci.yml'), 'utf8'));
+ expect(jobs.impact).toContain('prompt_history: ${{ steps.plan.outputs.prompt_history }}');
+ expect(jobs.impact).toContain('linux_containment: ${{ steps.plan.outputs.linux_containment }}');
+ expect(jobs['prompt-history']).toContain('needs: impact');
+ expect(jobs['prompt-history']).toContain("if: needs.impact.outputs.prompt_history == 'true'");
+ expect(jobs['linux-containment']).toContain("if: needs.impact.outputs.linux_containment == 'true'");
+ // The gate walks LINUX_CONTAINMENT_TESTS, so the job must run exactly those.
+ const run = jobs['linux-containment'].match(/run: npm test --prefix server -- --run (.*)/)[1];
+ expect(run.split(' ').map((path) => `server/${path}`)).toEqual(LINUX_CONTAINMENT_TESTS);
+ // A skipped gated job still reports to CI Gate, which treats skipped as passing.
+ expect(jobs.gate).toContain('CI_GATE_RESULT_PROMPT_HISTORY: ${{ needs.prompt-history.result }}');
+ expect(jobs.gate).toContain('CI_GATE_RESULT_LINUX_CONTAINMENT: ${{ needs.linux-containment.result }}');
+ });
+});
diff --git a/scripts/migrations/shippedPromptHistory.js b/scripts/migrations/shippedPromptHistory.js
index 9a6f62fa9c..db5923b3af 100644
--- a/scripts/migrations/shippedPromptHistory.js
+++ b/scripts/migrations/shippedPromptHistory.js
@@ -97,19 +97,27 @@ export const findUnacceptedPromptHistory = ({
return stranded;
};
+/** A numbered migration module (not a helper or test) this guard may load. */
+export const isNumberedMigrationFile = (file) =>
+ /^\d.*\.js$/.test(file) && !file.endsWith('.test.js');
+
+/**
+ * Whether a migration's source declares shipped prompt hashes, i.e. whether the
+ * guard imports it. The CI planner gates the job on the import closure of
+ * exactly these modules, so both sides share this predicate.
+ */
+export const declaresPromptHashes = (source) =>
+ source.includes('ACCEPTED_OLD_MD5') || source.includes('NEW_SHIPPED_MD5');
+
const migrationHashes = async (migrationsDir) => {
const accepted = {};
const files = (await readdir(migrationsDir))
- .filter((file) => /^\d.*\.js$/.test(file) && !file.endsWith('.test.js'))
+ .filter(isNumberedMigrationFile)
.sort();
for (const file of files) {
const sourcePath = join(migrationsDir, file);
const source = await readFile(sourcePath, 'utf8');
- if (
- !source.includes('ACCEPTED_OLD_MD5') &&
- !source.includes('NEW_SHIPPED_MD5')
- )
- continue;
+ if (!declaresPromptHashes(source)) continue;
const migration = await import(pathToFileURL(sourcePath).href);
for (const [name, hashes] of Object.entries(
migration.ACCEPTED_OLD_MD5 || {},
diff --git a/scripts/pregate.js b/scripts/pregate.js
index 187c9bd17e..f0c712e474 100644
--- a/scripts/pregate.js
+++ b/scripts/pregate.js
@@ -27,7 +27,8 @@
* What it deliberately does NOT cover, because each needs a resource this
* checkout does not have: the DB suites (a provisioned `portos_test` —
* `npm run setup:db:test && npm run test:db`), the Windows job (a Windows
- * runner), and the client build / boot smoke. The summary names the ones the
+ * runner), the Linux worker-containment job (bubblewrap namespaces), and the
+ * client build / boot smoke. The summary names the ones the
* plan flagged so they are a decision rather than a surprise.
*/
@@ -56,6 +57,7 @@ const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
export const UNCOVERED_SUITES = Object.freeze({
db: 'npm run setup:db:test && npm run test:db (never against the real `portos` database)',
windows: 'a Windows runner — no local equivalent; CI is the only proof',
+ linuxContainment: 'a Linux host with bubblewrap: PORTOS_REQUIRE_LINUX_CONTAINMENT=1 npm test --prefix server -- --run <LINUX_CONTAINMENT_TESTS>',
build: 'npm run build',
smoke: 'npm run smoke',
});
@@ -128,6 +130,11 @@ export function resolvePlanStages(plan, { skipLint = false, baseSha } = {}) {
});
});
+ // CI's `prompt-history` job: one git-history read, seconds locally.
+ if (plan.promptHistory) {
+ stages.push({ name: 'shipped prompt history', script: 'migrations/check-shipped-prompt-history.js', args: [], env: {} });
+ }
+
return stages;
}
@@ -364,6 +371,8 @@ async function main() {
windows: raw.windows,
build: raw.build,
smoke: raw.smoke,
+ promptHistory: raw.prompt_history,
+ linuxContainment: raw.linux_containment,
};
console.log(`📋 ${raw.changed_files.length} changed file(s) — ${plan.reason}.`);
diff --git a/scripts/pregate.test.js b/scripts/pregate.test.js
index 794d60e89d..ecd65005b3 100644
--- a/scripts/pregate.test.js
+++ b/scripts/pregate.test.js
@@ -84,6 +84,14 @@ describe('resolvePlanStages', () => {
}
});
+ it('runs the shipped prompt-history guard only when the plan selects it', () => {
+ expect(resolvePlanStages(planWith({ promptHistory: false })).map((stage) => stage.name))
+ .not.toContain('shipped prompt history');
+ expect(resolvePlanStages(planWith({ promptHistory: true })).at(-1)).toEqual({
+ name: 'shipped prompt history', script: 'migrations/check-shipped-prompt-history.js', args: [], env: {},
+ });
+ });
+
it('drops the lint stage under --skip-lint but keeps the test stages', () => {
const stages = resolvePlanStages(
planWith({ lint: { mode: 'files', files: ['client/src/App.jsx'] } }),
@@ -127,7 +135,7 @@ describe('pregate hidden-content invocation', () => {
'scripts/pregate.js', 'scripts/checkNodeVersion.js', 'scripts/scan-diff-hidden-content.js',
'scripts/ci-test-plan.js', 'scripts/ci-base-sha.js', 'server/lib/staticImportGraph.js',
'scripts/lib/directInvocation.js', 'scripts/lib/browserFidelity.js', 'scripts/lib/browserTestProfiles.js', 'scripts/lib/githubOutput.js', 'scripts/lib/dbTestFiles.js',
- 'scripts/lib/browserSuites.js', 'scripts/lib/workspaceDependencies.js',
+ 'scripts/lib/browserSuites.js', 'scripts/lib/workspaceDependencies.js', 'scripts/migrations/shippedPromptHistory.js',
'server/lib/diffHiddenContentScan.js', 'server/lib/modelAbuseGuard.js',
'server/lib/textUtils.js',
]) {
@@ -616,7 +624,7 @@ describe('the gate end to end', () => {
'scripts/pregate.js', 'scripts/checkNodeVersion.js', 'scripts/scan-diff-hidden-content.js',
'scripts/ci-test-plan.js', 'scripts/ci-base-sha.js', 'server/lib/staticImportGraph.js',
'scripts/lib/directInvocation.js', 'scripts/lib/browserFidelity.js', 'scripts/lib/browserTestProfiles.js', 'scripts/lib/githubOutput.js', 'scripts/lib/dbTestFiles.js',
- 'scripts/lib/browserSuites.js', 'scripts/lib/workspaceDependencies.js',
+ 'scripts/lib/browserSuites.js', 'scripts/lib/workspaceDependencies.js', 'scripts/migrations/shippedPromptHistory.js',
'server/lib/diffHiddenContentScan.js', 'server/lib/modelAbuseGuard.js',
'server/lib/textUtils.js',
]) {