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:
parent
c600468bb5
commit
e5997a1516
20 changed files with 1187 additions and 789 deletions
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
import { describe, it, expect, beforeAll, afterAll } from 'vitest'
|
||||
import { Brainy } from '../../src/brainy.js'
|
||||
import { NounType } from '../../src/types/graphTypes.js'
|
||||
import { NounType, VerbType } from '../../src/types/graphTypes.js'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
|
|
@ -41,7 +41,10 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
await brain.init()
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
afterAll(async () => {
|
||||
// Close the brain so the writer lock is released and the background flush /
|
||||
// heartbeat does not bleed into other suites (also avoids ~8s teardown hangs).
|
||||
await brain.close()
|
||||
if (fs.existsSync(testDir)) {
|
||||
fs.rmSync(testDir, { recursive: true, force: true })
|
||||
}
|
||||
|
|
@ -141,7 +144,7 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
relationId = await brain.relate({
|
||||
from: entity1Id,
|
||||
to: entity2Id,
|
||||
type: 'relatedTo'
|
||||
type: VerbType.RelatedTo
|
||||
})
|
||||
|
||||
expect(typeof relationId).toBe('string')
|
||||
|
|
@ -195,7 +198,7 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
|
||||
const relationIds = await brain.relateMany({
|
||||
items: [
|
||||
{ from: ids.successful[0], to: ids.successful[1], type: 'links' }
|
||||
{ from: ids.successful[0], to: ids.successful[1], type: VerbType.References }
|
||||
]
|
||||
})
|
||||
|
||||
|
|
@ -255,7 +258,9 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
})
|
||||
|
||||
it('vfs.readdir() - should list directory', async () => {
|
||||
const entries = await vfs.readdir('/test-dir')
|
||||
// 8.0: readdir() returns string[] by default; pass { withFileTypes: true }
|
||||
// to get VFSDirent objects (each with .name / .type / .path / .entityId).
|
||||
const entries = await vfs.readdir('/test-dir', { withFileTypes: true })
|
||||
|
||||
expect(entries.length).toBeGreaterThan(0)
|
||||
expect(entries.some((e: any) => e.name === 'file.txt')).toBe(true)
|
||||
|
|
@ -265,8 +270,11 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
it('vfs.stat() - should get file stats', async () => {
|
||||
const stats = await vfs.stat('/test-dir/file.txt')
|
||||
|
||||
// 8.0: VFSStats mirrors Node's fs.Stats — type is exposed via isFile() /
|
||||
// isDirectory() / isSymbolicLink() predicates, not a `type` string field.
|
||||
expect(stats.size).toBeGreaterThan(0)
|
||||
expect(stats.type).toBe('file')
|
||||
expect(stats.isFile()).toBe(true)
|
||||
expect(stats.isDirectory()).toBe(false)
|
||||
console.log(`✅ vfs.stat() got stats: ${stats.size} bytes`)
|
||||
})
|
||||
|
||||
|
|
@ -283,13 +291,19 @@ describe('Comprehensive All-APIs Test', () => {
|
|||
console.log(`✅ VFS entities properly flagged with isVFS`)
|
||||
})
|
||||
|
||||
it('VFS entities excluded from knowledge graph', async () => {
|
||||
it('VFS entities excluded from knowledge graph via excludeVFS', async () => {
|
||||
// 8.0: find() INCLUDES VFS entities by default (one unified store). Pass
|
||||
// excludeVFS:true to get a clean knowledge-graph view — this asserts that
|
||||
// opt-in exclusion actually strips every VFS-flagged entity.
|
||||
const knowledge = await brain.find({
|
||||
type: NounType.Document,
|
||||
excludeVFS: true,
|
||||
limit: 100
|
||||
})
|
||||
|
||||
const vfsCount = knowledge.filter(r => r.metadata?.isVFS === true).length
|
||||
const vfsCount = knowledge.filter(
|
||||
r => r.metadata?.isVFS === true || r.metadata?.isVFSEntity === true
|
||||
).length
|
||||
expect(vfsCount).toBe(0)
|
||||
console.log(`✅ Knowledge graph clean: 0 VFS entities leaked`)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue