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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: keep PostgreSQL tests out of ordinary server memo selection (#13455)
[._.]/ Adam Eivya3844c6bda24
diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex 0edabd6d91..821e81eea8 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -802,6 +802,7 @@ const RUNNER_EXCLUDED_FIXTURES = /^server\/fixtures\//;const runnerForTest = (path) => {if (!isTestFile(path) || RUNNER_EXCLUDED_FIXTURES.test(path)) return null;if (isClientRunnerFile(path)) return 'client';+ if (resolveDbTestFiles([path]).length > 0) return 'db';if (isServerRunnerFile(path)) return 'server';return null;};@@ -1308,7 +1309,7 @@ function buildSuitePlan(changedFiles, {: skippedRunner();const dbTests = new Set(resolveDbTestFiles(trackedFiles));- const db = serverFiles.some((path) => dbTests.has(path))+ const db = selectedTests.some((path) => dbTests.has(path))|| executable.some((path) => DB_RISK_RULES.some((rule) => rule.test(path)))|| serverSources.some((path) => dbDependencies === null || dbDependencies.includes(path));diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.jsindex 25ba3601e5..1c8e266dcf 100644--- a/scripts/ci-test-plan.test.js+++ b/scripts/ci-test-plan.test.js@@ -533,10 +533,18 @@ it('requests DB verification for every suite in the real canonical inventory witfor (const suite of dbTests) {const plan = buildCiTestPlan([suite], inputs);expect(plan, suite).toMatchObject({ full: false, db: true, server: { mode: 'files' } });- expect(plan.server.files, suite).toContain(suite);+ expect(plan.server.files, suite).not.toContain(suite);}});+it('keeps PostgreSQL tests out of ordinary server runner selection and routes them to the DB stage (#13455)', () => {+ const dbSuite = 'server/services/githubNotifications.db.test.js';+ const plan = buildCiTestPlan([dbSuite], { trackedFiles: [dbSuite] });+ expect(plan.server.files).not.toContain(dbSuite);+ expect(plan.server.mode).toBe('skip');+ expect(plan.db).toBe(true);+});+it('requests DB verification for the real deck, model pin and backup source contracts', () => {const cwd = fileURLToPath(new URL('../', import.meta.url));const sources = ['server/routes/decks.js', 'server/services/modelPinRecords.js', 'server/services/backup.js'];diff --git a/scripts/lib/dbTestFiles.js b/scripts/lib/dbTestFiles.jsindex 2e9e87f3fd..5d3620d395 100644--- a/scripts/lib/dbTestFiles.js+++ b/scripts/lib/dbTestFiles.js@@ -81,6 +81,8 @@ const exactFiles = new Set(patterns.filter((pattern) => !pattern.includes('*')))const globs = patterns.filter((pattern) => pattern.includes('*'));/** Resolve the canonical, server-rooted include patterns without loading Vitest. */-export const resolveDbTestFiles = (files) => files.filter((file) => (- exactFiles.has(file) || globs.some((pattern) => posix.matchesGlob(file, pattern))-));+export const resolveDbTestFiles = (files) => files.filter((file) => {+ const serverPath = file.startsWith('server/') ? file : posix.normalize(posix.join('server', file));+ return exactFiles.has(file) || exactFiles.has(serverPath)+ || globs.some((pattern) => posix.matchesGlob(file, pattern) || posix.matchesGlob(serverPath, pattern));+});diff --git a/scripts/run-ci-tests.js b/scripts/run-ci-tests.jsindex 85c23db4e4..13c6784184 100644--- a/scripts/run-ci-tests.js+++ b/scripts/run-ci-tests.js@@ -20,6 +20,7 @@ import {import { resolveMemoDir } from './lib/testMemoStore.js';import { guardInputSnapshot } from './lib/pregateReport.js';import { browserOwnerExcludes, TEST_SCOPES, workspaceOf } from './lib/workspaceTests.js';+import { resolveDbTestFiles } from './lib/dbTestFiles.js';const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..');@@ -436,13 +437,15 @@ async function main() {delete process.env.PORTOS_PREGATE_GUARDS;const mode = process.env.CI_TEST_MODE || 'full';const inputFiles = JSON.parse(process.env.CI_TEST_FILES || '[]');- // Explicit planner selectors must respect the same browser ownership as+ // Explicit planner selectors must respect the same browser and DB ownership as// workspace discovery and Vitest; guard reuse may leave only these suites.const browserExcludes = new Set(scope === 'server'? browserOwnerExcludes().map(path => `server/${path}`) : []);+ const dbExcludes = new Set(scope === 'server'+ ? resolveDbTestFiles(inputFiles) : []);const profileFiles = process.env.PORTOS_BROWSER_TEST_PROFILE !== undefined? browserTestProfileFiles(process.env.PORTOS_BROWSER_TEST_PROFILE, inputFiles) : inputFiles;- const repoFiles = profileFiles.filter(path => !browserExcludes.has(path));+ const repoFiles = profileFiles.filter(path => !browserExcludes.has(path) && !dbExcludes.has(path));const repoSources = JSON.parse(process.env.CI_TEST_SOURCES || '[]');const selectedFiles = repoFiles.map((path) => toRunnerPath(workspace, path));diff --git a/scripts/run-ci-tests.test.js b/scripts/run-ci-tests.test.jsindex 1eadc3e59e..73d35abbd6 100644--- a/scripts/run-ci-tests.test.js+++ b/scripts/run-ci-tests.test.js@@ -388,6 +388,47 @@ it('keeps explicit browser selectors with their owner after structural guard reu}});+it('keeps explicit DB selectors with the DB runner after structural guard reuse and test memo subtraction (#13455)', async () => {+ const guard = 'server/lib/index.test.js';+ const dbTest = 'server/services/githubNotifications.db.test.js';+ const ordinary = 'scripts/example.test.js';+ const { scratch: fixture, repo: root } = await createRunnerSandbox([guard, dbTest, ordinary]);+ const run = ({ files, proof }) => spawnSync(process.execPath, [join(root, 'scripts/run-ci-tests.js'), 'server'], {+ cwd: root, encoding: 'utf8', timeout: 10000,+ env: { ...process.env, PATH: `${fixture}${delimiter}${process.env.PATH}`, CI_SHARD: '',+ CI_TEST_MODE: 'files', CI_TEST_FILES: JSON.stringify(files), CI_TEST_SOURCES: '[]',+ CI: 'true', PORTOS_PREGATE_GUARDS: proof ? JSON.stringify({ files: [guard], snapshot: proof }) : '',+ PORTOS_TEST_MEMO: 'off', GITHUB_ENV: '', GITHUB_STEP_SUMMARY: '' },+ });+ try {+ installFakeNpm(fixture, REPORTING_NPM);+ const proof = guardInputSnapshot(root);+ expect(proof).toEqual(expect.any(String));++ // When the structural guard is reused, the DB test must not be handed to the server runner as its sole selector.+ const result = run({ files: [guard, dbTest], proof });+ expect(result.error).toBeUndefined();+ expect(result.status, result.stderr).toBe(0);+ expect(result.stdout).toContain('Reused 1 structural guards');+ expect(result.stdout).toContain('No server tests left to run');+ expect(result.stdout).not.toContain('{"args"');++ // A mixed selection runs only the ordinary non-DB server contract.+ const mixed = run({ files: [ordinary, dbTest] });+ expect(mixed.status, mixed.stderr).toBe(0);+ const selectionOf = (res) => JSON.parse(res.stdout.split('\n').find(line => line.startsWith('{"args"'))).selection.include;+ expect(selectionOf(mixed)).toEqual(['../scripts/example.test.js']);++ // A DB-only selection prints "No server tests selected" and exits 0 without invoking Vitest.+ const soleDb = run({ files: [dbTest] });+ expect(soleDb.status, soleDb.stderr).toBe(0);+ expect(soleDb.stdout).toContain('No server tests selected');+ expect(soleDb.stdout).not.toContain('{"args"');+ } finally {+ await destroyGitSandbox(fixture);+ }+});+it('rejects empty browser coverage except explicitly deferred smoke-only inputs', () => {for (const [profile, files, expected] of [['fidelity', [], 1], ['fidelity', ['server/lib/filmLook.browser.test.js'], 1],