fix: VFS where clause field names + isVFS flag

CRITICAL FIX: VFS was using incorrect field names in where clauses
- Metadata index stores flat fields: path, vfsType, name
- VFS queried with: 'metadata.path', 'metadata.vfsType' (wrong!)
- Fixed to use correct field names in where clauses

Changes:
- initializeRoot() now uses correct where clause (no workaround needed)
- Added isVFS flag to all VFS entities (mkdir, writeFile, root)
- Updated VFSMetadata type to include isVFS field
- Removed PathResolver fallback (production code, no fallbacks)

This fixes:
- Duplicate root entities (Workshop team had ~10 roots!)
- VFS queries now work correctly with metadata index
- Clean separation between VFS and knowledge graph entities

Production-ready: No mocks, no fallbacks, no workarounds
This commit is contained in:
David Snelling 2025-10-24 11:12:27 -07:00
parent 3260a6ce6d
commit f8d2d37b82
3 changed files with 30 additions and 8 deletions

View file

@ -224,7 +224,7 @@ export class PathResolver {
* Uses proper graph relationships to traverse the tree
*/
async getChildren(dirId: string): Promise<VFSEntity[]> {
// Use proper graph API to get all Contains relationships from this directory
// Production-ready: Use graph relationships (VFS creates these in mkdir/writeFile)
const relations = await this.brain.getRelations({
from: dirId,
type: VerbType.Contains
@ -233,7 +233,7 @@ export class PathResolver {
const validChildren: VFSEntity[] = []
const childNames = new Set<string>()
// Fetch all child entities
// Fetch all child entities via relationships
for (const relation of relations) {
const entity = await this.brain.get(relation.to)
if (entity && entity.metadata?.vfsType && entity.metadata?.name) {