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: trace imported consumers when nested feature code changes (#9673)
[._.]/ Adam Eivy9e3cd301bcdf
diff --git a/docs/GITHUB_ACTIONS.md b/docs/GITHUB_ACTIONS.mdindex 06a0f52bd8..4a5b1e1194 100644--- a/docs/GITHUB_ACTIONS.md+++ b/docs/GITHUB_ACTIONS.md@@ -30,8 +30,8 @@ A release therefore pays for one full run (on its PR), not three.## CI Workflow (`ci.yml`)PRs into `main` use `scripts/ci-test-plan.js` to classify the changed files-before installing dependencies. Directory-scoped features run their server and-client feature tests; flat modules fall back to Vitest's import-graph-aware+before installing dependencies. Directory-scoped features add their server and+client feature tests, and every behavioral source (nested or flat) uses Vitest's import-graph-aware`related` mode, fed the changed behavioral source paths plus the planner'sexplicit test files. The planner deliberately chooses full CI for sharedcomposition roots, test configuration, dependency manifests, workflow changes,@@ -799,10 +799,15 @@ successor run".### Impact-planner safety rules-- A directory feature such as `server/services/sprites/` selects tests carrying- the same feature segment across server and client.-- Flat/shared behavioral modules use Vitest's import graph, driven by their- exact changed source paths. Directly changed tests are always included.+- A directory feature such as `server/services/sprites/` additively selects+ tests carrying the same feature segment across server and client. The feature+ name never identifies all consumers (a nested leaf can be imported by a+ differently named test in another area), so it does not replace traversal.+- Every runner with a changed behavioral source — flat, shared, or nested+ feature — runs one `related` invocation driven by the exact changed source+ paths, combined with the explicit selectors (feature, basename contract,+ guard, direct test) without duplicate execution. Directly changed tests are+ always included; a test-only or barrel-only diff keeps exact-file selection.- Barrel/catalog guards are added when reusable `lib`, `hooks`, or `utils`directories change, and catalog-only barrels are excluded from import-graphexpansion. JSX changes include the global accessibility convention guard.diff --git a/scripts/ci-test-plan.js b/scripts/ci-test-plan.jsindex daef86e4fd..1e867770e3 100644--- a/scripts/ci-test-plan.js+++ b/scripts/ci-test-plan.js@@ -735,9 +735,7 @@ export function buildCiTestPlan(changedFiles, {}const clientDependencySet = new Set(clientDependencies || []);const isClientSource = (path) => path.startsWith('client/') || clientDependencySet.has(path);- const sharedClientSources = jsSources.filter((path) => clientDependencySet.has(path));const features = uniqueSorted(jsSources.map(featureDirectory).filter(Boolean));- const unscopedSources = jsSources.filter((path) => !featureDirectory(path));const selectedTests = [...directTests,...fixtureTests,@@ -779,8 +777,6 @@ export function buildCiTestPlan(changedFiles, {const hasServerSource = jsSources.some(isServerRunnerFile);const hasClientSource = jsSources.some(isClientSource);- const hasUnscopedServer = unscopedSources.some(isServerRunnerFile);- const hasUnscopedClient = sharedClientSources.length > 0 || unscopedSources.some(isClientSource);const serverSources = jsSources.filter(isServerRunnerFile)@@ -789,11 +785,14 @@ export function buildCiTestPlan(changedFiles, {.filter(isClientSource).filter((path) => clientDependencySet.has(path) || !isStructuralBarrel(path));- // Feature-directory plans already enumerate their boundary tests. Flat and- // shared modules use Vitest's import graph, except a barrel-only edit whose- // contract is completely covered by the structural export guard.- const serverMode = hasUnscopedServer && serverSources.length > 0 ? 'related' : 'files';- const clientMode = hasUnscopedClient && clientSources.length > 0 ? 'related' : 'files';+ // Feature-name matches, basename contracts, direct tests and guards are+ // additive explicit selectors; they never replace import-graph traversal. A+ // nested feature leaf can be consumed by a differently named test in another+ // area, so any behavioral source in a runner takes one 'related' invocation.+ // Only a barrel-only edit (fully covered by the structural export guard) or a+ // test-only diff keeps exact-file selection.+ const serverMode = serverSources.length > 0 ? 'related' : 'files';+ const clientMode = clientSources.length > 0 ? 'related' : 'files';const server = serverFiles.length > 0? { mode: serverMode, files: serverFiles, sources: serverMode === 'related' ? serverSources : [] }diff --git a/scripts/ci-test-plan.test.js b/scripts/ci-test-plan.test.jsindex 6cc3aff911..1626f26f0e 100644--- a/scripts/ci-test-plan.test.js+++ b/scripts/ci-test-plan.test.js@@ -189,6 +189,40 @@ it('schedules the real client precision-copy import chain for a shared scoring c.toContain(join(cwd, source));});+it('schedules the real taxonomy-to-validation consumer chain for a nested editorial leaf', () => {+ const cwd = fileURLToPath(new URL('../', import.meta.url));+ const source = 'server/lib/editorial/checkInfra/taxonomy.js';+ const inputs = collectPlanInputs({ baseSha: 'HEAD', changedFiles: [source], cwd });+ const plan = buildCiTestPlan(inputs.changedFiles, inputs);++ expect(plan.full).toBe(false);+ expect(plan.server.mode).toBe('related');+ expect(plan.server.sources).toEqual([source]);+ // Explicit guards stay additive to the traversal.+ expect(plan.server.files).toEqual(expect.arrayContaining(ALWAYS_RUN_TESTS.filter((path) => path.startsWith('server/'))));+ // validation.test.js reaches the leaf only through pipelineValidation; it names+ // neither the leaf nor the editorial feature, so only traversal selects it.+ expect(plan.server.files).not.toContain('server/lib/validation.test.js');+ expect(staticImportClosure(join(cwd, 'server/lib/validation.test.js')).files)+ .toContain(join(cwd, source));+});++it('keeps exact-file selection for a test-only diff and traverses a nested feature leaf for a differently named consumer', () => {+ const leaf = 'server/lib/widgets/inner/leaf.js';+ const featureTest = 'server/lib/widgets/widgets.test.js';+ // schemaHub.test.js reaches the leaf only through middle modules and shares no+ // name with it or its feature: the plan must hand the leaf to the import graph.+ const trackedFiles = [leaf, 'server/lib/middle.js', 'server/lib/schemaHub.test.js', featureTest];+ const plan = buildCiTestPlan([leaf], { trackedFiles, clientDependencies: [] });+ expect(plan.full).toBe(false);+ expect(plan.server.mode).toBe('related');+ expect(plan.server.sources).toEqual([leaf]);+ expect(plan.server.files).toContain(featureTest);++ const testOnly = buildCiTestPlan([featureTest], { trackedFiles, clientDependencies: [] });+ expect(testOnly.server).toMatchObject({ mode: 'files', sources: [] });+});+it('carries transitive browser re-exports through the planner CLI and fails closed on unresolved edges', () => {const root = mkdtempSync(join(tmpdir(), 'portos-ci-browser-deps-'));const planner = fileURLToPath(new URL('./ci-test-plan.js', import.meta.url));@@ -508,7 +542,7 @@ describe('CI test impact planner', () => {expect(plan).toMatchObject({full: false,reason: 'targeted features: sprites',- server: { mode: 'files' },+ server: { mode: 'related' },client: { mode: 'files' },db: false,lint: { mode: 'skip' },@@ -587,7 +621,9 @@ describe('CI test impact planner', () => {], { trackedFiles: TRACKED });expect(plan.full).toBe(false);- expect(plan.server.mode).toBe('files');+ // A nested adapter still traverses its importers; the DB suite is additive.+ expect(plan.server.mode).toBe('related');+ expect(plan.server.sources).toContain('server/services/catalogDB/facets.js');expect(plan.db).toBe(true);});@@ -750,8 +786,8 @@ describe('CI test impact planner', () => {});expect(plan.full).toBe(false);- expect(plan.server.mode).toBe('files');- expect(plan.server.sources).toEqual([]);+ expect(plan.server.mode).toBe('related');+ expect(plan.server.sources).toContain(REVIEW_LIFECYCLE_SOURCE);expect(plan.server.files).toEqual(expect.arrayContaining([REVIEW_LIFECYCLE_TEST,REVIEW_LOOP_OWNER,