feat(vfs): fix VFS visibility by removing broken filtering

- Remove includeVFS parameter and broken isVFS filtering logic
- Add excludeVFS parameter for optional VFS entity filtering
- VFS entities now part of knowledge graph by default
- Enable O(1) graph adjacency optimizations for VFS operations
- Update all VFS projections and PathResolver
- Add comprehensive VFS visibility documentation

This fixes the bug where VFS operations returned empty results due to
operator object mismatch in storage adapters. VFS relationships now use
proper graph traversal without metadata filtering.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-10-27 10:44:06 -07:00
parent 5c3d2e9b67
commit 8393d01209
9 changed files with 134 additions and 85 deletions

View file

@ -31,8 +31,7 @@ export class AuthorProjection extends BaseProjectionStrategy {
vfsType: 'file',
owner: authorName
},
limit: 1000,
includeVFS: true // v4.4.0: Must include VFS entities!
limit: 1000
}
// Filter by filename if subpath specified
@ -53,14 +52,13 @@ export class AuthorProjection extends BaseProjectionStrategy {
* Resolve author to entity IDs using REAL Brainy.find()
*/
async resolve(brain: Brainy, vfs: VirtualFileSystem, authorName: string): Promise<string[]> {
// Use REAL Brainy metadata filtering
// v4.7.0: VFS entities are part of the knowledge graph
const results = await brain.find({
where: {
vfsType: 'file',
owner: authorName
},
limit: 1000,
includeVFS: true // v4.4.0: Must include VFS entities!
limit: 1000
})
return this.extractIds(results)
@ -75,10 +73,9 @@ export class AuthorProjection extends BaseProjectionStrategy {
const results = await brain.find({
where: {
vfsType: 'file',
owner: { $exists: true }
owner: { exists: true }
},
limit,
includeVFS: true // v4.4.0: Must include VFS entities!
limit
})
return results.map(r => r.entity as VFSEntity)

View file

@ -29,10 +29,9 @@ export class TagProjection extends BaseProjectionStrategy {
const query: FindParams = {
where: {
vfsType: 'file',
tags: { contains: tagName } // BFO operator for array contains
tags: { contains: tagName } // contains operator for array search
},
limit: 1000,
includeVFS: true // v4.4.0: Must include VFS entities!
limit: 1000
}
// Filter by filename if subpath specified
@ -53,14 +52,13 @@ export class TagProjection extends BaseProjectionStrategy {
* Resolve tag to entity IDs using REAL Brainy.find()
*/
async resolve(brain: Brainy, vfs: VirtualFileSystem, tagName: string): Promise<string[]> {
// Use REAL Brainy metadata filtering
// v4.7.0: VFS entities are part of the knowledge graph
const results = await brain.find({
where: {
vfsType: 'file',
tags: { contains: tagName } // BFO operator
tags: { contains: tagName }
},
limit: 1000,
includeVFS: true // v4.4.0: Must include VFS entities!
limit: 1000
})
return this.extractIds(results)
@ -74,10 +72,9 @@ export class TagProjection extends BaseProjectionStrategy {
const results = await brain.find({
where: {
vfsType: 'file',
tags: { exists: true } // BFO operator
tags: { exists: true } // exists operator
},
limit,
includeVFS: true // v4.4.0: Must include VFS entities!
limit
})
return results.map(r => r.entity as VFSEntity)

View file

@ -69,17 +69,16 @@ export class TemporalProjection extends BaseProjectionStrategy {
const endOfDay = new Date(date)
endOfDay.setHours(23, 59, 59, 999)
// Use REAL Brainy metadata filtering with range operators
// v4.7.0: VFS entities are part of the knowledge graph
const results = await brain.find({
where: {
vfsType: 'file',
modified: {
greaterEqual: startOfDay.getTime(), // BFO operator
lessEqual: endOfDay.getTime() // BFO operator
greaterEqual: startOfDay.getTime(),
lessEqual: endOfDay.getTime()
}
},
limit: 1000,
includeVFS: true // v4.4.0: Must include VFS entities!
limit: 1000
})
return this.extractIds(results)
@ -94,10 +93,9 @@ export class TemporalProjection extends BaseProjectionStrategy {
const results = await brain.find({
where: {
vfsType: 'file',
modified: { greaterEqual: oneDayAgo } // BFO operator
modified: { greaterEqual: oneDayAgo }
},
limit,
includeVFS: true // v4.4.0: Must include VFS entities!
limit
})
return results.map(r => r.entity as VFSEntity)