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
address review (claude): ignore example/test/fixture dirs in vite config scan; fix test-label accuracy
Adam Eivyfa71293f88ae
diff --git a/server/lib/viteAllowedHosts.js b/server/lib/viteAllowedHosts.jsindex 023d39ccf7..b8db2c6e11 100644--- a/server/lib/viteAllowedHosts.js+++ b/server/lib/viteAllowedHosts.js@@ -104,10 +104,16 @@ export function hostIsAllowed(parsed, hostname) {const VITE_CONFIG_SUBDIRS = ['', 'client', 'frontend', 'web', 'app', 'ui', 'admin', 'apps/web', 'packages/client'];// Directories that never hold an app's own vite config but are expensive to walk-// (or would surface a dependency's config). Skipped by the recursive fallback.+// (or would surface a config that isn't the app's — a dependency's, an example's,+// or a test fixture's). Skipped by the recursive fallback so it can't return a+// stray shallower `vite.config.*` in place of the real app config. Dot-dirs are+// already skipped by the `!e.name.startsWith('.')` guard, so `.storybook` etc.+// need no entry here.const VITE_SCAN_IGNORE_DIRS = new Set(['node_modules', '.git', '.hg', '.svn', 'dist', 'build', 'out', 'coverage',- '.next', '.nuxt', '.cache', '.turbo', '.vite', 'tmp', 'temp', 'vendor', '.venv'+ '.next', '.nuxt', '.cache', '.turbo', '.vite', 'tmp', 'temp', 'vendor', '.venv',+ 'examples', 'example', 'test', 'tests', '__tests__', 'e2e',+ 'fixtures', 'fixture', 'playground', 'docs', 'storybook']);/**diff --git a/server/lib/viteAllowedHosts.test.js b/server/lib/viteAllowedHosts.test.jsindex a625b48f6b..96191fe2fe 100644--- a/server/lib/viteAllowedHosts.test.js+++ b/server/lib/viteAllowedHosts.test.js@@ -181,16 +181,19 @@ export default defineConfig({ server: { allowedHosts: true } });`;expect(cfg?.dir).toBe(repo);});- it('finds a config in an unlisted subdir via recursive fallback (critical-mass admin/)', async () => {- // `admin` is the critical-mass Vite client dir — the false-negative that- // produced a bogus "no vite.config was found" warning.+ it('finds a config in the admin/ subdir (critical-mass — the original false-negative)', async () => {+ // `admin` is the critical-mass Vite client dir that produced a bogus+ // "no vite.config was found" warning. It is now a fast-path subdir; the+ // recursive-fallback contract is pinned separately by the nested test below.await mkdir(join(repo, 'admin'), { recursive: true });await writeFile(join(repo, 'admin', 'vite.config.js'), ALLOW_ALL);const cfg = await findViteConfig(repo);expect(cfg?.path).toBe(join(repo, 'admin', 'vite.config.js'));});- it('finds a config nested two levels deep', async () => {+ it('finds a config nested two levels deep via the recursive fallback (unlisted subdir)', async () => {+ // `packages/dashboard` is NOT in the fast-path subdir list, so this only+ // passes if discoverViteConfig actually walks the tree — it pins the fallback.await mkdir(join(repo, 'packages', 'dashboard'), { recursive: true });await writeFile(join(repo, 'packages', 'dashboard', 'vite.config.ts'), ALLOW_ALL);const cfg = await findViteConfig(repo);@@ -204,6 +207,14 @@ export default defineConfig({ server: { allowedHosts: true } });`;expect(cfg).toBeNull();});+ it('ignores a stray config inside an example/fixture dir', async () => {+ // A demo/example app's vite config must not be mistaken for the real one.+ await mkdir(join(repo, 'examples', 'demo'), { recursive: true });+ await writeFile(join(repo, 'examples', 'demo', 'vite.config.js'), ALLOW_ALL);+ const cfg = await findViteConfig(repo);+ expect(cfg).toBeNull();+ });+it('returns null when no config exists', async () => {const cfg = await findViteConfig(repo);expect(cfg).toBeNull();