debug: add comprehensive logging to trace VFS undefined names bug

- Add debug logging to VFS readdir() to show children and VFSDirent structure
- Add debug logging to PathResolver.getChildren() to trace entity retrieval
- Add debug logging to convertNounToEntity() to trace metadata extraction
- Helps diagnose v4.8.4 VFS undefined names bug reported by Workshop team

Ref: BRAINY_V4.8.4_VFS_UNDEFINED_NAMES_BUG.md
This commit is contained in:
David Snelling 2025-10-28 13:57:59 -07:00
parent 522cbfa93a
commit 4b980a46a8
3 changed files with 48 additions and 1 deletions

View file

@ -230,6 +230,7 @@ export class PathResolver {
from: dirId,
type: VerbType.Contains
})
console.log(`[DEBUG PathResolver] getChildren(${dirId}): Found ${relations.length} Contains relations`)
const validChildren: VFSEntity[]= []
const childNames = new Set<string>()
@ -237,12 +238,24 @@ export class PathResolver {
// Fetch all child entities via relationships
for (const relation of relations) {
const entity = await this.brain.get(relation.to)
console.log(`[DEBUG PathResolver] Retrieved entity ${relation.to}:`, {
exists: !!entity,
type: entity?.type,
hasMetadata: !!entity?.metadata,
metadataKeys: entity?.metadata ? Object.keys(entity.metadata) : [],
metadata_vfsType: entity?.metadata?.vfsType,
metadata_name: entity?.metadata?.name
})
if (entity && entity.metadata?.vfsType && entity.metadata?.name) {
validChildren.push(entity as VFSEntity)
childNames.add(entity.metadata.name)
} else {
console.log(`[DEBUG PathResolver] ❌ FILTERED OUT entity ${relation.to} - missing vfsType or name`)
}
}
console.log(`[DEBUG PathResolver] Returning ${validChildren.length} valid children (filtered from ${relations.length})`)
// Update cache
this.parentCache.set(dirId, childNames)
return validChildren