mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-11 03:38:07 +00:00
test(lbug): assert temp-conn deleteNodesForFile skips withConnLock (negative gate, #2264)
The positive case (singleton deleteNodesForFile locks each per-table count) was covered, but not the negative branch of the targetConn === conn gate: a per-file/temp connection (dbPath provided) must NOT take the singleton lock, or temp-conn callers would needlessly contend with it. Add the negative-gate assertion so a regression that unconditionally locks is caught. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JBJomjoTdBV2eveDVq4JMm
This commit is contained in:
parent
1a7aefdcc9
commit
cdc3f93449
1 changed files with 18 additions and 0 deletions
|
|
@ -106,6 +106,24 @@ withTestLbugDB('conn-serialization', () => {
|
|||
expect(lockSpy).toHaveBeenCalled();
|
||||
expect(result).toMatchObject({ edgesDeleted: 0 });
|
||||
});
|
||||
|
||||
it('U5: deleteNodesForFile on a temp dbPath does NOT take the lock (negative gate)', async () => {
|
||||
// The targetConn === conn gate's negative branch: a per-file/temp connection
|
||||
// (dbPath provided) must NOT take the singleton lock, so temp-conn callers
|
||||
// can't contend with the singleton. Mirrors the positive U3 case above so a
|
||||
// regression that unconditionally locks is caught. (#2264)
|
||||
const { createTempDir } = await import('../helpers/test-db.js');
|
||||
const { deleteNodesForFile } = await import('../../src/core/lbug/lbug-adapter.js');
|
||||
const temp = await createTempDir('gn-negative-gate-');
|
||||
try {
|
||||
lockSpy.mockClear();
|
||||
const result = await deleteNodesForFile('any/path.ts', temp.dbPath);
|
||||
expect(lockSpy).not.toHaveBeenCalled();
|
||||
expect(result).toMatchObject({ deletedNodes: 0 });
|
||||
} finally {
|
||||
await temp.cleanup();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue