mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-13 03:58:33 +00:00
fix(test): export isStorageVersionMismatchError from remaining lbug-config mocks
The previous commit fixed the 5 test files that wholesale-mock lbug-config.js via vi.mock(), but missed 4 more that mock it via vi.doMock() instead (a different Vitest API my earlier grep for vi.mock(...) didn't match): lbug-adapter-wal-schema.test.ts (8 call sites), lbug-checkpoint-lifecycle.test.ts (12 call sites), and basicblock-callee-ids-schema.test.ts / convex-metadata-persistence- contract.test.ts (1 shared mock factory each). All of these exercise lbug-adapter.ts's doInitLbug, which now also calls isStorageVersionMismatchError() unconditionally on every open failure — caught by actually running the full suite rather than trusting the `-t lbug` name filter, which doesn't match these files' test names. Verified: all 10 affected files (97 tests) pass; npx tsc --noEmit clean. Full suite rerun in progress to confirm no other gaps remain. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
e6a5526c4d
commit
d68c68ae38
4 changed files with 44 additions and 0 deletions
|
|
@ -177,6 +177,8 @@ const makeConfigMock = () => {
|
|||
resolveNativeSafeStorageDir: (p: string) => p,
|
||||
WAL_RECOVERY_SUGGESTION: 'run analyze --force',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
};
|
||||
return { mock, queries };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ function makeConfigMock() {
|
|||
resolveNativeSafeStorageDir: (value: string) => value,
|
||||
WAL_RECOVERY_SUGGESTION: 'run analyze --force',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -199,6 +201,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -260,6 +264,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -312,6 +318,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -389,6 +397,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -470,6 +480,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -524,6 +536,8 @@ describe('doInitLbug WAL corruption guard — behavioural', () => {
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -646,6 +660,8 @@ describe('Symmetric WAL-size gate during missing-shadow recovery (PR #1747 D2)',
|
|||
WAL_RECOVERY_SUGGESTION:
|
||||
'WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index.',
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -167,6 +169,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -232,6 +236,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -300,6 +306,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -359,6 +367,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -431,6 +441,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -506,6 +518,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -565,6 +579,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -617,6 +633,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -680,6 +698,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -758,6 +778,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
@ -836,6 +858,8 @@ describe('lbug adapter CHECKPOINT lifecycle', () => {
|
|||
isDbBusyError: vi.fn((err: unknown) => String(err).toLowerCase().includes('lock')),
|
||||
isOpenRetryExhausted: vi.fn(() => false),
|
||||
waitForWindowsHandleRelease: vi.fn(async () => true),
|
||||
isStorageVersionMismatchError: vi.fn(() => false),
|
||||
STORAGE_VERSION_MISMATCH_SUGGESTION: '',
|
||||
}));
|
||||
vi.doMock('../../src/core/lbug/extension-loader.js', () => ({
|
||||
extensionManager: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue