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

merge: bring claim/issue-12315 up to date with main (#12315)

[._.]/ Adam Eivy7add7ae50d8a
diff --cc scripts/lib/testMemoRunner.js
index e44e49429b,47a499031a..e407f0ab89
--- a/scripts/lib/testMemoRunner.js
+++ b/scripts/lib/testMemoRunner.js
@@@ -31,10 -31,10 +31,10 @@@ import { mkdtempSync, readFileSync, rmS
import { tmpdir } from 'node:os';
import * as nodePath from 'node:path';
import { join, relative, sep } from 'node:path';
-import { resolveTestChrome } from '../../server/lib/browserSuiteGate.js';
+import { resolveTestChrome } from './testChrome.js';
import { WORKSPACE_BASE_INPUTS, createDiskFs, createTestMemoAnalyzer, relatedTests } from './testMemo.js';
import { readMemoEntry, readMemoRecord, writeMemoEntry, writeMemoRecord } from './testMemoStore.js';
- import { listWorkspaceTests, toRepoPath, toWorkspacePath } from './workspaceTests.js';
+ import { TEST_SCOPES, listWorkspaceTests, toRepoPath, toWorkspacePath, workspaceOf } from './workspaceTests.js';
const uniqueSorted = (values) => [...new Set(values)].sort();
const VIRTUAL_MODULE = /(?:^|\/)@vite\/|^\0|^virtual:/;
diff --cc server/lib/README.md
index 389a39366e,d3fa347130..3aae0aba58
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@@ -777,7 -777,7 +777,8 @@@ The barrel `server/lib/index.js` is a m
| Module | Purpose |
|---|---|
+| `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` (re-exported from `scripts/lib/testChrome.js`, where client tests import it too) is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying (#12293). |
+ | `browserSuiteGate.js` | `probeChromeH264(path)` runs the H.264 probe as an owned, deadline-bound child (own process group, SIGTERM→SIGKILL ladder awaiting `close`) and resolves `{ ok }` or `{ ok:false, cause }` — `missing-executable`, `codec-unavailable`, `probe-timeout`, `teardown-failed` (answered, then exited nonzero: never trusted, never a missing codec), `no-answer`; `describeH264Probe` is its path/PID-free one-liner; `chromeWithH264(path)` (async) returns the path only when that Chrome decodes H.264, null when the executable or codec is genuinely absent, and `{ probeFailure }` when the probe itself failed (reported by `browserSuiteCanRun` as a lifecycle failure, not a missing prerequisite); `browserSuiteCanRun(label, prerequisites)` is the `canRun` guard for the cross-workspace `*.browser.test.js` suites (Chrome + ffmpeg + the client bundler). Pass `{ name: discoveredValue }`; a falsy value is missing. Returns `false` with a visible skip log locally, but throws naming the missing prerequisites when `PORTOS_REQUIRE_BROWSER_SUITES` is set; `browserSuiteBlockReason(prerequisites)` is that verdict alone (the same wording, or `null`) for a caller that only reports, such as `scripts/pregate.js` — the flag the CI `database` job sets for the browser suites the planner selected (#10312). `resolveTestChrome(env)` is the one Chrome candidate list (`CHROME_PATH`, Playwright's bundled Chromium, then the macOS app and the Linux package paths) shared by the suites, the pregate probe and the test memo's tool keying, and `resolveClientBundler(repoRoot)` the one client bundler probe (resolved Vite, React plugin and Tailwind PostCSS paths, or `undefined` when any is missing; non-`MODULE_NOT_FOUND` errors throw) (#12293). |
| `dbTestGate.js` | `requireDbOrSkip(label, dbReady, reason)` keeps a missing local test database as a visible skipped suite, but throws when `PORTOS_REQUIRE_DB` is set so CI cannot pass after DB-backed suites disappear. |
| `gitTestRepo.js` | Shared real-git sandbox for integration tests (#4394): one initialized template (working tree + bare origin) per worker, then `fs.cp` into a fresh temp dir. `makeGitSandbox({ origin })`, `attachBareOrigin(scratch, repo)`, `materializeGitRepo(dest)`, `destroyGitSandbox`, plus `SKIP_HEAVY_INTEGRATION` (`VITEST_FAST=1`). `resetGitSandbox({ scratch, repo, initialHead })` / `resetGitWorktreeSandbox(repo, initialHead)` restore a sandbox in place (branches, worktrees, remote) so a `describe` can build one sandbox in `beforeAll` and reset between tests instead of paying the fs.cp/rm cycle per test (#5902). Every entry point runs `assertTempPath` first, so a path outside `os.tmpdir()` throws instead of `git init`-ing or `rm -rf`-ing a real checkout (#4554). Fixture-local maintenance/GC detachment is disabled so awaited Git operations retain their writers through teardown. Still real git — just not rebuilt from `init`+`commit`+`push` in every `beforeEach`. |
| `mirrorParity.js` | Source-extraction and comparison primitives for declaration-level contract tests: the vendored `aiToolkit/` copy of `TOOL_USE_RE` (`localModelHeuristics.mirror.test.js`), and the bootstrap sequence's body assertions (`bootstrap*.test.js`). A pure module the browser needs is imported by the client rather than mirrored, so no client↔server copy test should need these: `stripCommentsAndNormalize` (so per-side commentary may diverge but logic may not), `extractDeclaration(src, name)` (balanced `{}`/`()`/`[]` walk over `function` / `async function` / `const`), and `compareDeclaration(serverSrc, clientSrc, name)`. Use these instead of hand-rolling a brace-walker per mirror. Pure — no `vitest` import — so callers own the assertions. |
diff --cc server/lib/browserSuiteGate.js
index 8617bd0852,48eac3f2c7..d834a8e538
--- a/server/lib/browserSuiteGate.js
+++ b/server/lib/browserSuiteGate.js
@@@ -3,9 -4,50 +3,27 @@@ import { mkdtempSync, rmSync } from 'no
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-/**
- * Where the browser suites look for a Chrome after `CHROME_PATH` and
- * Playwright's bundled Chromium: the macOS app and the Linux package paths.
- * One list for the suites, the pregate probe and the test memo (#12293).
- */
-const TEST_CHROME_CANDIDATES = Object.freeze([
- '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
- '/usr/bin/google-chrome',
- '/usr/bin/chromium',
- '/usr/bin/chromium-browser',
-]);
-
-/** Playwright's bundled Chromium, when playwright-core is installed and a browser was downloaded; null otherwise. */
-function bundledChromium() {
- try { return createRequire(import.meta.url)('playwright-core').chromium.executablePath(); } catch { return null; }
-}
-
-/**
- * The Chrome binary a browser suite would launch on this machine, or null:
- * `env.CHROME_PATH`, then Playwright's bundled Chromium, then the macOS app
- * and the Linux package paths, the first that exists.
- */
-export function resolveTestChrome(env = process.env, { exists = existsSync, bundled = bundledChromium } = {}) {
- return [env.CHROME_PATH, bundled(), ...TEST_CHROME_CANDIDATES].find((path) => path && exists(path)) ?? null;
-}
+// The one Chrome resolver lives in scripts/lib so client tests can share it (#12315).
+export { resolveTestChrome } from '../../scripts/lib/testChrome.js';
+ const CLIENT_BUNDLER_PACKAGES = Object.freeze(['vite', '@vitejs/plugin-react', '@tailwindcss/postcss']);
+
+ /**
+ * The resolved paths of the client workspace's bundler packages (Vite, its
+ * React plugin, Tailwind's PostCSS plugin), or undefined when any is missing —
+ * the shape a `browserSuiteCanRun` prerequisite map treats as absent. Only
+ * MODULE_NOT_FOUND counts as missing; any other resolution error throws.
+ */
+ export function resolveClientBundler(repoRoot) {
+ try {
+ const requireClient = createRequire(join(repoRoot, 'client', 'package.json'));
+ return CLIENT_BUNDLER_PACKAGES.map((name) => requireClient.resolve(name));
+ } catch (error) {
+ if (error.code !== 'MODULE_NOT_FOUND') throw error;
+ return undefined;
+ }
+ }
+
/**
* Keep cross-workspace browser suites as visible skips on machines without
* Chrome, ffmpeg or the client workspace, while letting the one CI job that