mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-29 23:37:41 +00:00
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / ci (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
* fix: rebuild changed graphs in fresh databases Populated-table writes inflate LadybugDB storage (#3852). Bulk-load fresh graphs while retaining parse caches, no-ops and logical counts. Read prior graphs without writes so staging failures preserve their bytes. Restore compatible vectors and rebuild derived layers and FTS under the existing checkpoint and publication guards. Keep the write policy, preservation guards and regressions together so the replacement has one coherent publication contract. Closes #3852 * perf: skip FTS builds for empty tables * fix: align CI with compact graph writes Validate populated-table FTS coverage and cached full writes while keeping the performance budget unchanged. Compare database bytes without enumerating Buffer keys, and retain native checkpoint failure details. * perf: use bounded hybrid graph writes Keep small edits selective and scale the mutation budget with graph size. Compact accumulated native storage growth without copying every graph on every edit. Preserve physical receipts across shared-store publication and native resource limits during recovery. Align CI assertions with selective writes and populated FTS tables. Refs #3852 * fix: close hybrid compaction gaps Count removed rows before selective writes and preserve the shared graph's compaction receipt when publishing completed vectors. * test: serialize compaction native suites * test: declare capped count determinism * test: mock persisted rows in FTS fixtures * fix: address hybrid write review (#3854) Retain unreadable graph bytes before recovery and stop destructive writes when the real embedding cache probe fails. Keep small deletions and renames selective, preserve healthy private graphs through edit/revert cycles, and bound FTS presence probes. Cover durability, footprint boundaries and vector restoration. Align mock graph fixtures and fix the pre-existing WAL test's UUID false positive found by full-suite validation; its nine-test suite now passes. * test: clarify selective restore fixture (#3854) * test: isolate recovery CI fixtures (#3854) Cap embedding generation in the missing-graph recovery fixture so it does not require optional model packages. Allow cold PowerShell startup in the OS identity smoke test; retain the five-second production probe limit. * test: finish review cleanup (#3854) * test: strengthen graph integrity checks Hash persisted node and edge properties; clean failed fixtures and gate FTS setup through the test lifecycle. Refs #3854 --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
51 lines
2.4 KiB
TypeScript
51 lines
2.4 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import { readEmptyFtsTables } from '../../src/core/search/fts-table-state.js';
|
|
import { FTS_INDEXES } from '../../src/core/search/fts-schema.js';
|
|
|
|
const indexes = FTS_INDEXES.filter((index) => ['Function', 'Class'].includes(index.table));
|
|
const emptyClass = { tableName: 'Class', rowCount: 0 };
|
|
const populatedFunction = { tableName: 'Function', rowCount: 12 };
|
|
|
|
describe('readEmptyFtsTables', () => {
|
|
it('proves emptiness with one query, independent of result order and numeric representation', async () => {
|
|
const query = vi.fn().mockResolvedValue([emptyClass, { ...populatedFunction, rowCount: 12n }]);
|
|
expect(await readEmptyFtsTables(query, indexes)).toEqual(new Set(['Class']));
|
|
expect(query).toHaveBeenCalledTimes(1);
|
|
expect(query.mock.calls[0][0]).toContain(' UNION ALL ');
|
|
});
|
|
|
|
it.each([
|
|
['missing row', [emptyClass]],
|
|
['duplicate row', [emptyClass, emptyClass]],
|
|
['unexpected table', [emptyClass, { tableName: 'File', rowCount: 0 }]],
|
|
['string count', [emptyClass, { ...populatedFunction, rowCount: '0' }]],
|
|
['negative count', [emptyClass, { ...populatedFunction, rowCount: -1 }]],
|
|
['fractional count', [emptyClass, { ...populatedFunction, rowCount: 0.5 }]],
|
|
['missing count', [emptyClass, { tableName: 'Function' }]],
|
|
['null row', [emptyClass, null]],
|
|
])('does not skip any table with %s evidence', async (_label, rows) => {
|
|
expect(await readEmptyFtsTables(vi.fn().mockResolvedValue(rows), indexes)).toEqual(new Set());
|
|
});
|
|
|
|
it('does not convert a failed native read into proof of emptiness', async () => {
|
|
const query = vi.fn().mockRejectedValue(new Error('connection failed'));
|
|
expect(await readEmptyFtsTables(query, indexes)).toEqual(new Set());
|
|
});
|
|
|
|
it('reads again after a previously empty table gains rows', async () => {
|
|
const query = vi
|
|
.fn()
|
|
.mockResolvedValueOnce([emptyClass, populatedFunction])
|
|
.mockResolvedValueOnce([{ ...emptyClass, rowCount: 1 }, populatedFunction]);
|
|
expect(await readEmptyFtsTables(query, indexes)).toEqual(new Set(['Class']));
|
|
expect(await readEmptyFtsTables(query, indexes)).toEqual(new Set());
|
|
});
|
|
|
|
it('never interpolates an unsupported table identifier', async () => {
|
|
const query = vi.fn();
|
|
expect(
|
|
await readEmptyFtsTables(query, [{ ...indexes[0], table: 'Class` MATCH (n) DELETE n //' }]),
|
|
).toEqual(new Set());
|
|
expect(query).not.toHaveBeenCalled();
|
|
});
|
|
});
|