GitNexus/gitnexus/test/unit/identity-reader-contract.test.ts
Gergő Magyar 450702e10c
perf: reduce lookup allocations and stream identity checks (#3805)
Reduce lexical lookup allocations and stream persisted node identities during incremental verification. Preserve lookup snapshots, connection ownership, cursor cleanup, and both fail-closed publication checks.

Include fresh and persistent benchmark coverage, differential comparisons, and memory scaling reproduction.

Validation: 4,019 local tests, 72,000 differential comparisons, build and typechecks, and all 12 required CI checks passed.
2026-11-04 10:15:24 +00:00

16 lines
861 B
TypeScript

import { describe, expectTypeOf, it } from 'vitest';
import type { forEachQueryRow } from '../../src/core/lbug/lbug-adapter.js';
import type { reconcileGraphNodeIdentities } from '../../src/core/incremental/write-reconciliation.js';
type CursorVisitor = Parameters<typeof forEachQueryRow>[1];
type IdentityReader = Parameters<typeof reconcileGraphNodeIdentities>[1];
type IdentityVisitor = Parameters<IdentityReader>[1];
describe('identity reader synchronous visitor contract', () => {
it('accepts synchronous visitors and rejects async visitors at both boundaries', () => {
expectTypeOf<() => undefined>().toExtend<CursorVisitor>();
expectTypeOf<() => undefined>().toExtend<IdentityVisitor>();
expectTypeOf<() => Promise<void>>().not.toExtend<CursorVisitor>();
expectTypeOf<() => Promise<void>>().not.toExtend<IdentityVisitor>();
});
});