test(8.0): integration rot pass — 77→17 failures (parallel per-file hardening)

Cleared ~60 rotted-test failures across 17 integration files: get() now passes
{includeVectors:true} where the vector is used; close() teardown added (cures
heartbeat-bleed timeouts); removed-API call-sites rewritten to the 8.0 surface
(addRelationship→relate, COW internals dropped); Result/Entity shape assertions
updated; deterministic-embedder semantic assertions rewritten as self-retrieval
(or moved to Tier-2 where irreducible); perf thresholds relaxed; 384-dim fixtures.

Adds the Tier-2 (real-model) scaffolding: tests/setup-semantic.ts +
tests/configs/vitest.semantic.config.ts + test:semantic; test:ci now runs
unit+integration (anti-rot gate, goes live once green).

Remaining 17 failures are REAL 8.0 library bugs the pass surfaced (fixed next,
not papered over): dual-bound where-filter dropping a bound; counts not
rehydrating after restart; related() offset pagination; relate() non-idempotent
updatedAt; unscoped VFS path-cache. Plus find-unified finish + a few stragglers.
This commit is contained in:
David Snelling 2026-06-17 13:11:41 -07:00
parent c600468bb5
commit e5997a1516
20 changed files with 1187 additions and 789 deletions

View file

@ -34,7 +34,10 @@ describe('Remaining APIs Comprehensive Test', () => {
await brain.init()
})
afterAll(() => {
afterAll(async () => {
// Close the brain so background flush / writer-lock heartbeat stop before
// the dir is removed (prevents teardown timeouts and cross-test bleed).
await brain.close()
if (fs.existsSync(testDir)) {
fs.rmSync(testDir, { recursive: true, force: true })
}
@ -344,24 +347,31 @@ Gadget,20`
console.log(` ✅ neural.clusters() created semantic clusters`)
})
it('should respect includeVFS option in clustering', async () => {
console.log('\n📋 Test: neural.clusters() VFS filtering')
it('should cluster over the full corpus (VFS entities included by default)', async () => {
console.log('\n📋 Test: neural.clusters() includes VFS entities by default')
// Create VFS files
// Create VFS files. In 8.0 these are normal graph entities marked
// metadata.isVFS — only the VFS *root* carries visibility:'system'.
const vfs = brain.vfs
await vfs.writeFile('/cluster-test1.txt', 'VFS file content')
await vfs.writeFile('/cluster-test2.txt', 'Another VFS file')
const neural = brain.neural()
// Cluster without VFS (default)
const clustersNoVFS = await neural.clusters({
// clusters() has no VFS-exclusion knob (ClusteringOptions has none) and
// its corpus comes from find(), whose excludeVFS defaults to false
// (VFS included). So VFS files are part of the clusterable corpus.
const clusters = await neural.clusters({
maxClusters: 5
})
// Count VFS entities in clusters
expect(clusters.length).toBeGreaterThan(0)
// Confirm clustering does not silently drop VFS entities: at least one of
// the VFS files we just wrote appears as a cluster member. (Metadata-only
// get is enough — we only read metadata.isVFS, not the vector.)
let vfsCount = 0
for (const cluster of clustersNoVFS) {
for (const cluster of clusters) {
for (const memberId of cluster.members) {
const entity = await brain.get(memberId)
if (entity?.metadata?.isVFS === true) {
@ -370,12 +380,12 @@ Gadget,20`
}
}
console.log(` Clusters without VFS: ${clustersNoVFS.length}, VFS entities: ${vfsCount}`)
console.log(` Clusters: ${clusters.length}, VFS members: ${vfsCount}`)
// Should not include VFS entities by default
expect(vfsCount).toBe(0)
// 8.0 contract: VFS entities are included in clustering by default.
expect(vfsCount).toBeGreaterThan(0)
console.log(` ✅ neural.clusters() respects VFS filtering`)
console.log(` ✅ neural.clusters() clusters the full corpus including VFS`)
})
})