GitNexus/gitnexus/vitest.config.ts
Gergő Magyar 347165dd59
fix(lbug): upgrade core and bundled extensions to 0.22.0 (#3578)
* fix(lbug): bump @ladybugdb/core to 0.21.2 to stop doubled rows after delete and re-copy

LadybugDB 0.21.0 and 0.21.1 return every row of a table that spans more
than one native vector twice once the incremental writeback has DETACH
DELETEd it and a COPY into an earlier table has run. NodeGroup::scan let a
morsel that ended before the group's first live row wrap an unsigned
subtraction and rescan to the end of the group (LadybugDB #1085, fixed in
0.21.2). No primary key error fires. The identity guard from #3442 stops
the run with "unexpected or duplicate ID", so a Swift edit that pulls every
importer into the write set failed on repos with more than 2048 structs.
Only unreleased main was affected: 1.6.12 ships 0.18.3.

Pin 0.21.2 in package.json, update the six @ladybugdb/core entries in the
lockfile, and move coreVersion in the vendored FTS manifest. The FTS
extension stays at 0.21.0 because no v0.21.1 or v0.21.2 artifact is
published; the pairing assertion and its unit tests pass.

Add a regression to the delete-nodes-for-files suite: 2049 structs with
CONTAINS edges are loaded, every file is deleted, the graph is loaded
again, and each id and edge must appear exactly once.

Verification (Linux, Node 22.18):
- lbug-delete-nodes-for-files: 11/11 on 0.21.2. With the 0.21.1 native
  packages swapped in, the new test fails with 4098 rows instead of 2049.
- Reporter recipe end to end on the built CLI: incremental analyze exits 0
  with no duplicate ids on a Swift-heavy fixture and on a 70-file Python
  fixture, with and without FTS. On 0.21.1 the Swift fixture exits 1.
- A 0.21.1-written database opens and reads under 0.21.2.
- prettier, eslint and typecheck:tests are clean on the changed files.
- The full lbug-db project had not finished when this was committed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix(lbug): pair core and extensions at 0.22.0

Include the duplicate-row scan and relationship page-padding fixes.
Use matching official FTS and VECTOR artifacts on all five platforms.

Add a page-padding regression and document the storage 47 to 49 upgrade,
including rollback and cached-embedding recovery limits.

* fix(lbug): recognize pending checkpoint recovery

* fix(bench): isolate indexes by runtime

* fix(query): reject mixed symbol paths

Printable paths could disagree with canonical symbol UIDs and pass
NUL-only validation. Reject those tuples at response boundaries.
Add Python/Swift MCP fault cases and a linked-worktree reproducer.

Refs #3527

* fix(query): preserve provider semantic IDs

* fix(lbug): clear analysis memory budget

Restore the normal reader budget after indexing. The leaked adaptive hint exhausted the 0.22.0 pool during query and rename operations. Assert the budget is restored after real analyses, and give integrity cases unique CI audit identities.

---------

Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-31 15:29:45 +00:00

289 lines
16 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import PerfSequencer from './test/helpers/perf-sequencer.js';
export default defineConfig({
test: {
// Shared settings — inherited by all projects via extends: true
testTimeout: 30000,
hookTimeout: 120000,
pool: 'forks',
globals: true,
// Keep the Vitest 4 mock lifecycle while upgrading the runner to Vitest 5.
clearMocks: false,
// Stable test identity across the Linux/macOS/Windows execution receipts.
includeTaskLocation: true,
teardownTimeout: 3000,
// E2E harnesses pin a small NODE_OPTIONS heap so spawned CLI children
// stay light; without this opt-out the #2649 auto-heap override would
// respawn every such child with a RAM-sized cap. Children inherit it via
// the harnesses' `{ ...process.env }` spreads. Tests that exercise the
// respawn behavior itself delete GITNEXUS_MEMORY in their own setup.
// Tests assert the English CLI contract unless a case opts into another
// language explicitly. Do not inherit a developer shell's CLI locale.
// GITNEXUS_ATOMIC_INCREMENTAL=0 is an operator off-switch that beats a
// caller's `atomicIncremental: true`, so an exported `=0` would silently
// turn off every staging test. Empty is neither '0' nor '1', i.e. unset;
// a test that needs a value stubs it.
env: { GITNEXUS_MEMORY: 'off', GITNEXUS_LANG: 'en', GITNEXUS_ATOMIC_INCREMENTAL: '' },
// N-API destructors can crash worker forks on macOS during process exit.
// This is independent of the QueryResult lifetime fix in @ladybugdb/core 0.15.2 —
// it's a vitest forks + native addon interaction where destructors run in
// arbitrary order at exit. Tests themselves pass; only the exit crashes.
// TODO: remove once LadybugDB fixes all N-API destructor ordering issues.
dangerouslyIgnoreUnhandledErrors: true,
// Coverage stays at root (not supported in project configs)
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
exclude: [
'src/cli/index.ts', // CLI entry point (commander wiring)
'src/server/**', // HTTP server (requires network)
'src/core/wiki/**', // Wiki generation (requires LLM)
],
// Auto-ratchet: vitest bumps thresholds when coverage exceeds them.
// CI will fail if a PR drops below these floors.
thresholds: {
statements: 26,
branches: 23,
functions: 28,
lines: 27,
},
},
// Balance shards using vitest-shard-balancer and the frozen CI timing history.
// groupOrder and sort order are left to the base sequencer.
sequence: {
sequencer: PerfSequencer,
},
// LadybugDB's native mmap addon causes file-lock conflicts when vitest
// runs lbug test files in parallel forks on Windows. The 'lbug-db'
// project forces sequential execution (fileParallelism: false).
//
// Each file runs in its own fork — the fork exits after the file
// completes, triggering an N-API destructor segfault that is caught
// by dangerouslyIgnoreUnhandledErrors. Tests themselves pass; only
// the exit crashes. This is safer than isolate: false, which causes
// native state corruption after 2-3 open/close cycles in the same fork.
projects: [
{
extends: true,
test: {
name: 'lbug-db',
include: [
'test/integration/dangling-owner-edges.test.ts',
'test/integration/class-expression-owners.test.ts',
'test/integration/rename-provider-*.test.ts',
'test/integration/pdg-explicit-owner.test.ts',
'test/integration/skip-fts.test.ts',
'test/integration/impact-callable-value-references.test.ts',
'test/integration/impact-private-type-file-seed.test.ts',
'test/integration/impact-private-type-source.test.ts',
'test/integration/impact-context-integrity.test.ts',
'test/integration/incremental-worktree-context.test.ts',
'test/integration/incremental-method-integrity.test.ts',
'test/integration/go-incremental-method-owners.test.ts',
'test/integration/query-symbol-integrity.test.ts',
'test/integration/mcp-index-generation.test.ts',
'test/integration/mcp-refresh-index-e2e.test.ts',
'test/integration/fts-repair-warm-session.test.ts',
'test/integration/impact-epistemic-lower-bound.test.ts',
'test/integration/impact-scope-omission-persistence.test.ts',
'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/local-backend.test.ts',
'test/integration/bm25-symbol-hydration.test.ts',
'test/integration/local-backend-calltool.test.ts',
'test/integration/spring-aop-mcp.test.ts',
// Native @ladybugdb/core: loads a real graph through loadGraphToLbug
// and asserts the Destination NULL/join invariant on the stored rows.
'test/integration/spring-destinations-lbug.test.ts',
'test/integration/spring-destinations-incremental.test.ts',
'test/integration/search-core.test.ts',
'test/integration/search-pool.test.ts',
'test/integration/fts-description-search.test.ts',
'test/integration/fts-fullfile-search.test.ts',
'test/integration/fts-cjk-segmentation-search.test.ts',
'test/integration/augmentation.test.ts',
'test/integration/staleness-and-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/api-impact-e2e.test.ts',
'test/integration/shape-check-regression.test.ts',
'test/integration/java-class-impact.test.ts',
'test/integration/class-impact-all-languages.test.ts',
'test/integration/lbug-orphan-sidecar-recovery.test.ts',
'test/integration/lbug-interrupted-checkpoint-recovery.test.ts',
'test/integration/lbug-checkpoint-accounting.test.ts',
'test/integration/lbug-rel-copy-page-padding.test.ts',
'test/integration/lbug-incremental-search.test.ts',
'test/integration/lbug-readonly-init.test.ts',
// Shared sibling store (#3352): each file runs real analyses and opens
// the resulting LadybugDB graphs.
'test/integration/shared-store-analyze.test.ts',
'test/integration/parse-cache-identity-lifecycle.test.ts',
'test/integration/parse-cache-identity-package.test.ts',
'test/integration/shared-store-seed.test.ts',
'test/integration/shared-store-cache.test.ts',
'test/integration/shared-store-clean.test.ts',
'test/integration/shared-store-clone-optin.test.ts',
'test/integration/shared-store-adoption.test.ts',
'test/integration/analyze-wal-checkpoint-failure.test.ts',
'test/integration/lbug-non-ascii-path.test.ts',
'test/integration/lbug-conn-serialization.test.ts',
'test/integration/lbug-load-overlap-errors.test.ts',
'test/integration/load-cached-embeddings-spill.test.ts',
'test/integration/group/manifest-resolve-symbol-2325.test.ts',
'test/integration/group/manifest-synthetic-impact-lbug.test.ts',
'test/integration/group/http-route-resolve-symbol.test.ts',
'test/integration/group/graphql-resolve-symbol.test.ts',
'test/integration/fts-stemmer-sweep.test.ts',
'test/integration/lbug-multiwriter-deadlock.test.ts',
'test/integration/extension-binary-real.test.ts',
'test/integration/lbug-delete-nodes-for-files.test.ts',
'test/integration/lbug-query-importers-batch.test.ts',
'test/integration/impact-ambiguous-blast-radius.test.ts',
// #2915. Native @ladybugdb/core via withTestLbugDB(poolAdapter:true),
// and it drives detect_changes over a real git repo — the mmap
// file-lock exposure this project serializes (TESTING.md § Vitest
// projects), on the Windows/macOS platforms #2915 was reported from.
'test/integration/detect-changes-path-anchoring.test.ts',
// #2915. Native @ladybugdb/core via withTestLbugDB(poolAdapter:true) —
// the wiki's graph queries executed by a real engine rather than a
// fake that answers on `query.includes(...)`.
'test/integration/wiki-graph-queries-engine.test.ts',
'test/unit/incremental-dirty-recovery.test.ts',
// Publication reconciliation uses real native COPY/checkpoints.
'test/unit/incremental-write-integrity.test.ts',
'test/unit/incremental-orchestration.test.ts',
// #2841. Native @ladybugdb/core: it runs real analyses, reopens the
// DB under different extension-install policies, and reads
// SHOW_INDEXES on the writable connection — exactly the mmap
// file-lock exposure this project exists to serialize (TESTING.md
// § Vitest projects). Registering it here does NOT narrow where it
// runs: vitest applies `--shard` once to the combined cross-project
// spec list (PerfSequencer is a complete, disjoint
// partition), and run-cross-platform.ts hands vitest explicit file
// paths, which resolve against every project's include list. Its
// `incremental-vector-extension-ordering` /
// `incremental-fts-drop-ordering` siblings are equally native and
// still sit in `default` — pre-existing drift, deliberately left
// alone here.
'test/unit/incremental-index-extension-dml-gate.test.ts',
],
fileParallelism: false,
sequence: { groupOrder: 1 },
},
},
{
extends: true,
test: {
name: 'default',
sequence: { groupOrder: 3 },
include: ['test/**/*.test.ts'],
exclude: [
'test/integration/dangling-owner-edges.test.ts',
'test/integration/class-expression-owners.test.ts',
'test/integration/rename-provider-*.test.ts',
'test/integration/pdg-explicit-owner.test.ts',
'test/integration/skip-fts.test.ts',
'test/integration/impact-callable-value-references.test.ts',
'test/integration/impact-private-type-file-seed.test.ts',
'test/integration/impact-private-type-source.test.ts',
'test/integration/impact-context-integrity.test.ts',
'test/integration/incremental-worktree-context.test.ts',
'test/integration/incremental-method-integrity.test.ts',
'test/integration/go-incremental-method-owners.test.ts',
'test/integration/query-symbol-integrity.test.ts',
'test/integration/mcp-index-generation.test.ts',
'test/integration/mcp-refresh-index-e2e.test.ts',
'test/integration/fts-repair-warm-session.test.ts',
'test/integration/impact-epistemic-lower-bound.test.ts',
'test/integration/impact-scope-omission-persistence.test.ts',
'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/local-backend.test.ts',
'test/integration/bm25-symbol-hydration.test.ts',
'test/integration/local-backend-calltool.test.ts',
'test/integration/spring-aop-mcp.test.ts',
'test/integration/spring-destinations-lbug.test.ts',
'test/integration/spring-destinations-incremental.test.ts',
'test/integration/search-core.test.ts',
'test/integration/search-pool.test.ts',
'test/integration/fts-description-search.test.ts',
'test/integration/fts-fullfile-search.test.ts',
'test/integration/fts-cjk-segmentation-search.test.ts',
'test/integration/augmentation.test.ts',
'test/integration/staleness-and-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/api-impact-e2e.test.ts',
'test/integration/shape-check-regression.test.ts',
'test/integration/java-class-impact.test.ts',
'test/integration/class-impact-all-languages.test.ts',
'test/integration/lbug-orphan-sidecar-recovery.test.ts',
'test/integration/lbug-interrupted-checkpoint-recovery.test.ts',
'test/integration/lbug-checkpoint-accounting.test.ts',
'test/integration/lbug-rel-copy-page-padding.test.ts',
'test/integration/lbug-incremental-search.test.ts',
'test/integration/lbug-readonly-init.test.ts',
'test/integration/analyze-wal-checkpoint-failure.test.ts',
'test/integration/lbug-non-ascii-path.test.ts',
'test/integration/lbug-conn-serialization.test.ts',
'test/integration/lbug-load-overlap-errors.test.ts',
'test/integration/load-cached-embeddings-spill.test.ts',
'test/integration/group/manifest-resolve-symbol-2325.test.ts',
'test/integration/group/manifest-synthetic-impact-lbug.test.ts',
'test/integration/group/http-route-resolve-symbol.test.ts',
'test/integration/group/graphql-resolve-symbol.test.ts',
'test/integration/skills-e2e.test.ts',
'test/integration/fts-extension-e2e.test.ts',
'test/integration/fts-stemmer-sweep.test.ts',
'test/integration/lbug-multiwriter-deadlock.test.ts',
'test/integration/extension-binary-real.test.ts',
'test/integration/lbug-delete-nodes-for-files.test.ts',
'test/integration/lbug-query-importers-batch.test.ts',
'test/integration/impact-ambiguous-blast-radius.test.ts',
'test/integration/detect-changes-path-anchoring.test.ts',
'test/integration/wiki-graph-queries-engine.test.ts',
'test/unit/incremental-dirty-recovery.test.ts',
'test/unit/incremental-write-integrity.test.ts',
'test/unit/incremental-orchestration.test.ts',
// Excluded here because it is included by `lbug-db` above; a file
// in two projects would be collected (and run) twice.
'test/unit/incremental-index-extension-dml-gate.test.ts',
'test/integration/shared-store-analyze.test.ts',
'test/integration/parse-cache-identity-lifecycle.test.ts',
'test/integration/parse-cache-identity-package.test.ts',
'test/integration/shared-store-seed.test.ts',
'test/integration/shared-store-cache.test.ts',
'test/integration/shared-store-clean.test.ts',
'test/integration/shared-store-clone-optin.test.ts',
'test/integration/shared-store-adoption.test.ts',
],
},
},
{
extends: true,
test: {
name: 'cli-e2e',
include: [
'test/integration/skills-e2e.test.ts',
// Spawns the real CLI per test; runs sequentially (fileParallelism:
// false) so it doesn't aggravate the under-load timeout-flake class.
'test/integration/fts-extension-e2e.test.ts',
],
fileParallelism: false,
sequence: { groupOrder: 2 },
},
},
],
},
});