singularity-forge/src/tests
snowdamiz 80750b7d40 fix(web): lazily compute default package root to avoid Windows standalone crash
The standalone Next.js bundle bakes import.meta.url at build time with
the Linux CI runner's absolute path. On Windows, fileURLToPath() rejects
the Unix file:// URL at module load time, crashing all API routes with
ERR_INVALID_FILE_URL_PATH before GSD_WEB_PACKAGE_ROOT can be checked.

Replace the eager top-level const with a lazy getter that:
1. Defers evaluation until GSD_WEB_PACKAGE_ROOT is actually absent
2. Catches the cross-platform fileURLToPath failure gracefully
3. Falls back to process.cwd() when the baked-in URL is invalid
4. Caches the result so the computation only runs once

Add regression tests verifying:
- GSD_WEB_PACKAGE_ROOT is used when set
- Lazy fallback returns a valid absolute path without throwing
- Memoization is stable across calls
- Module loads without crash (the original failure mode)

Closes gsd-build/gsd-2#1881
2026-03-21 18:08:58 -04:00
..
integration feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
app-smoke.test.ts Improve startup performance with lazy extension loading (#1336) 2026-03-19 07:38:50 -06:00
artifact-manager.test.ts feat: TTSR + blob/artifact storage (ported from oh-my-pi) 2026-03-13 08:43:56 -06:00
auto-budget.test.ts refactor: extract 7 focused modules from auto.ts (#898) 2026-03-17 11:03:01 -05:00
auto-tool-tracking.test.ts refactor: extract 7 focused modules from auto.ts (#898) 2026-03-17 11:03:01 -05:00
bg-shell-persistence-cwd.test.ts fix/gsd-bg-shell-stale-cwd: normalize bg-shell worktree cwd detection 2026-03-16 17:02:58 -04:00
bg-shell-session-cleanup.test.ts fix: reap orphan-prone child processes across session churn (#920) 2026-03-17 13:14:51 -06:00
blob-store.test.ts test: replace shape-only assertions with value checks (#1875) 2026-03-21 15:25:10 -06:00
bundled-extension-paths.test.ts Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
ci_monitor.test.ts feat: add GitHub Workflows skill with CI workflow and ci_monitor tool (#294) 2026-03-13 22:31:17 -06:00
extension-discovery.test.ts fix: apply pi manifest opt-out to extension-discovery.ts (#1545) 2026-03-20 08:11:51 -06:00
extension-smoke.test.ts fix: google-search OAuth test mock and Windows path separator in smoke test 2026-03-16 11:56:46 -06:00
file-watcher.test.ts fix: prevent ensureGitignore from adding .gsd when tracked in git (#1364) (#1367) 2026-03-19 17:06:01 -06:00
google-search-auth.repro.test.ts fix: google-search OAuth test mock and Windows path separator in smoke test 2026-03-16 11:56:46 -06:00
gsd-web-launcher-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
headless-detection.test.ts fix: headless mode exits early on progress notifications containing 'complete' (#879) (#888) 2026-03-17 09:11:34 -06:00
headless-events.test.ts feat: add --events flag for JSONL stream filtering (#1000) 2026-03-17 17:35:44 -06:00
initial-gsd-header-filter.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
llm-context-tavily.test.ts feat: add Tavily as alternative search provider (#102) 2026-03-12 07:12:19 -06:00
marketplace-discovery.test.ts fix: remove duplicate marketplace-discovery test 2026-03-17 16:18:45 -06:00
mcp-client-schema.test.ts fix(mcp): preserve args for mcp_call tool invocations (#1354) 2026-03-19 15:29:19 -06:00
mcp-server.test.ts fix: resolve CI failures in VS Code extension PR 2026-03-16 16:53:34 -05:00
native-search.test.ts fix: remove duplicate TUI header rendered on session_start (#1663) 2026-03-21 08:34:18 -06:00
node-modules-symlink.test.ts fix: add @gsd/pi-tui to test module resolver in dist-redirect (#1811) 2026-03-21 12:04:13 -06:00
non-extension-library.test.ts fix: silence spurious extension load error for non-extension libraries (#1709) (#1747) 2026-03-21 08:54:19 -06:00
postinstall.test.ts fix: strip clack UI from postinstall, keep silent Playwright download (#783) 2026-03-16 21:35:04 -06:00
provider.test.ts fix(search): consolidate duplicate Brave API helpers (#1010) 2026-03-17 18:06:23 -06:00
pty-chat-parser.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
resource-loader.test.ts feat(gsd): activate matching skills in dispatched prompts (#1630) 2026-03-20 13:20:06 -06:00
resource-sync-staleness.test.ts fix: detect stale bundled resources via content fingerprint (#1193) 2026-03-18 11:06:09 -06:00
search-loop-guard.test.ts fix(search): keep loop guard armed after firing to prevent infinite loop restart (#1671) (#1674) 2026-03-21 08:35:48 -06:00
search-provider-command.test.ts feat: add Ollama Cloud as model and web tool provider (#430) (#434) 2026-03-14 21:03:31 -06:00
search-tavily.test.ts feat: add Tavily as alternative search provider (#102) 2026-03-12 07:12:19 -06:00
secret-scan.test.ts feat: add pre-commit secret scanner and CI secret detection (#1148) 2026-03-18 08:33:17 -06:00
tavily-helpers.test.ts feat: add Tavily as alternative search provider (#102) 2026-03-12 07:12:19 -06:00
terminal-cmux.test.ts feat: integrate cmux with gsd runtime (#1532) 2026-03-19 20:05:06 -06:00
token-counter.test.ts feat: add GitHub API client, diff-aware context, tiktoken token counting 2026-03-16 13:50:00 -05:00
tool-bootstrap.test.ts Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
ttsr-manager.test.ts fix: add barrel files for remote-questions, ttsr, and shared extensions (#1048) 2026-03-17 18:48:32 -06:00
ttsr-rule-loader.test.ts fix: add barrel files for remote-questions, ttsr, and shared extensions (#1048) 2026-03-17 18:48:32 -06:00
update-check.test.ts feat: add startup update check with 24h cache 2026-03-13 14:28:43 -03:00
url-utils.test.ts security: add SSRF protection to fetch_page tool 2026-03-16 13:35:48 -05:00
web-auth-token.test.ts fix(web): persist auth token in sessionStorage to survive page refreshes (#1877) 2026-03-21 15:25:27 -06:00
web-boot-node24.test.ts fix: resolve Node v24 web boot failure — ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING (#1864) 2026-03-21 15:24:07 -06:00
web-bridge-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-bridge-package-root.test.ts fix(web): lazily compute default package root to avoid Windows standalone crash 2026-03-21 18:08:58 -04:00
web-bridge-terminal-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-cli-entry.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-command-parity-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-continuity-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-diagnostics-contract.test.ts test: replace shape-only assertions with value checks (#1875) 2026-03-21 15:25:10 -06:00
web-live-interaction-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-live-state-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-mode-cli.test.ts feat: add --host, --port, --allowed-origins flags for web mode (#1847) (#1873) 2026-03-21 15:22:01 -06:00
web-mode-network-flags.test.ts feat: add --host, --port, --allowed-origins flags for web mode (#1847) (#1873) 2026-03-21 15:22:01 -06:00
web-multi-project-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-onboarding-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-onboarding-presentation.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-project-discovery-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-project-url.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-recovery-diagnostics-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-session-parity-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-state-surfaces-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-workflow-action-execution.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
web-workflow-controls-contract.test.ts feat(web): browser-based web interface (#1717) 2026-03-21 12:16:54 -06:00
welcome-screen.test.ts feat: feat(ui): minimal GSD welcome screen on startup (#1584) 2026-03-20 08:11:06 -06:00