mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-11 22:53:04 +00:00
* chore(ci): reduce CI runner-minutes by consolidating parity and narrowing cross-platform
Scope-resolution parity previously spawned 9 separate GitHub Actions jobs
(one per migrated language), each doing full checkout + npm ci + build for
a single test file. Consolidate into one job running scripts/run-parity.ts
which loops through all migrated languages sequentially — same coverage,
~45 fewer runner-minutes of redundant setup per PR.
Cross-platform (Windows/macOS) previously ran the full 373-file test suite.
Narrow to 45 platform-sensitive files (native LadybugDB, process spawning,
path separators, worker threads, filesystem behavior). Full suite still runs
on Ubuntu with coverage.
Also adds 2 missing lbug integration tests (lbug-orphan-sidecar-recovery,
lbug-readonly-init) to the sequential lbug-db vitest project where they
belong, and rewrites TESTING.md to document all test lanes.
* fix: address code review findings on parity and cross-platform scripts
- Capture stderr in run-parity.ts (vitest writes diagnostics to stderr)
- Lower per-invocation timeout from 5min to 60s to stay within CI job limit
- Add --language flag validation (error on missing value)
- Add timeout diagnostic to run-cross-platform.ts catch block
- Add analyze-wal-checkpoint-failure.test.ts to lbug-db sequential project
- Expand cross-platform list: parser-loader, pipeline, pipeline-graph-golden,
setup-skills, cli/tool-no-index-stderr (51 files, was 45)
* fix: add shell:true for Windows npx resolution and simplify fs import
execFileSync('npx', ...) fails with ENOENT on Windows because npx is
npx.cmd — shell:true resolves this. Also replaces dynamic await
import('fs') with static import, and fixes timeout detection to use
err.killed instead of err.code.
* fix(ci): raise parity per-invocation timeout to 120s and job timeout to 30min
TypeScript and C++ resolver tests take 60-90s on CI runners, exceeding
the 60s per-invocation timeout. Raise to 120s. Also bump the job-level
timeout from 25 to 30 minutes for margin (realistic total is ~11 min).
* fix(ci): raise parity per-invocation timeout to 180s for C++ resolver
C++ resolver tests take 130-150s on CI runners due to template
metaprogramming, ADL, and SFINAE fixture volume. 120s was still too
tight. Realistic total across all 9 languages is ~12 min, well under
the 30-min job timeout.
* fix(ci): use stdio inherit for parity — no per-invocation timeout
Switch from piped stdio with per-invocation timeouts to stdio: 'inherit'.
Vitest output streams to CI console in real time, making failures
immediately visible. The CI job-level timeout (30 min) is the only
guard — no more artificial per-invocation timeouts that cut off slow
resolver tests like C++ (which genuinely takes 3+ minutes).
---------
Co-authored-by: Test <test@example.com>
131 lines
4.7 KiB
TypeScript
131 lines
4.7 KiB
TypeScript
/**
|
|
* Cross-platform test subset runner.
|
|
*
|
|
* Runs only the tests that exercise platform-sensitive behavior on
|
|
* Windows and macOS. The full suite runs on Ubuntu; this narrows the
|
|
* cross-platform matrix to tests that actually vary across OSes.
|
|
*
|
|
* Categories included:
|
|
* - Platform-specific logic (path.sep, process.platform guards)
|
|
* - Native addon loading (LadybugDB, tree-sitter)
|
|
* - Process spawning and shell behavior
|
|
* - Filesystem locking and temp-dir behavior
|
|
* - Worker threads (real, not mocked)
|
|
* - CLI end-to-end tests
|
|
*
|
|
* When adding a new test that uses platform-varying APIs (native addons,
|
|
* child_process with real spawning, filesystem locking, path.sep), add
|
|
* it to the appropriate section below.
|
|
*
|
|
* Usage:
|
|
* npx vitest run $(npx tsx scripts/cross-platform-tests.ts)
|
|
* # or via the package script:
|
|
* npm run test:cross-platform
|
|
*/
|
|
|
|
// Platform-specific logic tests — contain explicit process.platform guards
|
|
// or test behavior that differs across operating systems
|
|
const PLATFORM_LOGIC = [
|
|
'test/unit/setup.test.ts',
|
|
'test/unit/setup-jsonc.test.ts',
|
|
'test/unit/setup-codex.test.ts',
|
|
'test/unit/platform-capabilities.test.ts',
|
|
'test/unit/worker-pool-windows-quarantine.test.ts',
|
|
'test/unit/lbug-pool-win-fts-probe.test.ts',
|
|
'test/unit/repo-manager.test.ts',
|
|
'test/unit/repo-manager-finalize-invariant.test.ts',
|
|
'test/unit/hooks.test.ts',
|
|
'test/unit/cursor-hook.test.ts',
|
|
'test/unit/sidecar-recovery.test.ts',
|
|
'test/unit/pool-wal-recovery.test.ts',
|
|
'test/unit/detect-changes-worktree.test.ts',
|
|
'test/unit/eval-server-bind-restriction.test.ts',
|
|
'test/unit/ignore-service.test.ts',
|
|
'test/unit/group/bridge-db.test.ts',
|
|
'test/unit/group/bridge-db-edge.test.ts',
|
|
];
|
|
|
|
// Native LadybugDB integration tests — exercise the @ladybugdb/core
|
|
// N-API addon which has known platform-specific behavior (Windows
|
|
// file-lock lag after close, macOS N-API destructor segfaults)
|
|
const LBUG_NATIVE = [
|
|
'test/integration/lbug-core-adapter.test.ts',
|
|
'test/integration/lbug-vector-extension.test.ts',
|
|
'test/integration/lbug-pool.test.ts',
|
|
'test/integration/lbug-pool-stability.test.ts',
|
|
'test/integration/lbug-lock-retry.test.ts',
|
|
'test/integration/lbug-open-retry.test.ts',
|
|
'test/integration/lbug-close-handle-release.test.ts',
|
|
'test/integration/lbug-orphan-sidecar-recovery.test.ts',
|
|
'test/integration/lbug-readonly-init.test.ts',
|
|
'test/integration/local-backend.test.ts',
|
|
'test/integration/local-backend-calltool.test.ts',
|
|
'test/integration/search-core.test.ts',
|
|
'test/integration/search-pool.test.ts',
|
|
'test/integration/staleness-and-stability.test.ts',
|
|
'test/integration/analyze-wal-checkpoint-failure.test.ts',
|
|
];
|
|
|
|
// Process spawning and CLI tests — exercise child_process with real
|
|
// process spawning, which behaves differently across platforms (shell
|
|
// quoting, path resolution, signal handling)
|
|
const SPAWN_CLI = [
|
|
'test/integration/cli-e2e.test.ts',
|
|
'test/integration/hooks-e2e.test.ts',
|
|
'test/integration/skills-e2e.test.ts',
|
|
'test/integration/server-http-startup.test.ts',
|
|
'test/integration/mcp/server-startup.test.ts',
|
|
'test/integration/analyze-heap-oom-e2e.test.ts',
|
|
'test/integration/group/group-cli.test.ts',
|
|
'test/integration/cli/tool-no-index-stderr.test.ts',
|
|
'test/integration/setup-skills.test.ts',
|
|
];
|
|
|
|
// Worker threads tests — exercise real worker_threads which have
|
|
// platform-specific behavior (thread spawning, IPC, exit handling)
|
|
const WORKER_THREADS = [
|
|
'test/integration/worker-pool.test.ts',
|
|
'test/integration/parse-impl-quarantine-cache-skip.test.ts',
|
|
];
|
|
|
|
// Tree-sitter native addon smoke tests — verify that native grammars
|
|
// load correctly on each platform (binary compatibility, .node loading)
|
|
const NATIVE_ADDON_SMOKE = [
|
|
'test/integration/tree-sitter-languages.test.ts',
|
|
'test/integration/parsing.test.ts',
|
|
'test/integration/pipeline.test.ts',
|
|
'test/integration/pipeline-graph-golden.test.ts',
|
|
'test/unit/parser-loader.test.ts',
|
|
];
|
|
|
|
// Filesystem behavior tests — exercise operations that vary across
|
|
// platforms (CRLF, symlinks, permissions, temp dirs)
|
|
const FILESYSTEM = [
|
|
'test/integration/filesystem-walker.test.ts',
|
|
'test/integration/markdown-processor-crlf.test.ts',
|
|
'test/integration/ignore-and-skip-e2e.test.ts',
|
|
];
|
|
|
|
const ALL_CROSS_PLATFORM = [
|
|
...PLATFORM_LOGIC,
|
|
...LBUG_NATIVE,
|
|
...SPAWN_CLI,
|
|
...WORKER_THREADS,
|
|
...NATIVE_ADDON_SMOKE,
|
|
...FILESYSTEM,
|
|
];
|
|
|
|
// When invoked directly, print the file list for vitest consumption
|
|
if (process.argv[1]?.endsWith('cross-platform-tests.ts')) {
|
|
console.log(ALL_CROSS_PLATFORM.join('\n'));
|
|
}
|
|
|
|
export {
|
|
ALL_CROSS_PLATFORM,
|
|
PLATFORM_LOGIC,
|
|
LBUG_NATIVE,
|
|
SPAWN_CLI,
|
|
WORKER_THREADS,
|
|
NATIVE_ADDON_SMOKE,
|
|
FILESYSTEM,
|
|
};
|