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

@ -846,6 +846,20 @@ export class VirtualFileSystem implements IVirtualFileSystem {
// Get children
let children = await this.pathResolver.getChildren(entityId)
console.log(`[DEBUG VFS] readdir(${path}): Found ${children.length} children`)
// Debug first child
if (children.length > 0) {
const firstChild = children[0]
console.log(`[DEBUG VFS] First child structure:`, {
id: firstChild.id,
type: firstChild.type,
metadataKeys: Object.keys(firstChild.metadata || {}),
metadata_name: firstChild.metadata?.name,
metadata_path: firstChild.metadata?.path,
metadata_vfsType: firstChild.metadata?.vfsType
})
}
// Apply filters
if (options?.filter) {
@ -870,12 +884,17 @@ export class VirtualFileSystem implements IVirtualFileSystem {
// Return appropriate format
if (options?.withFileTypes) {
return children.map(child => ({
const result = children.map(child => ({
name: child.metadata.name,
path: child.metadata.path,
type: child.metadata.vfsType,
entityId: child.id
} as VFSDirent))
console.log(`[DEBUG VFS] Returning ${result.length} VFSDirent items`)
if (result.length > 0) {
console.log(`[DEBUG VFS] First VFSDirent:`, result[0])
}
return result
}
return children.map(child => child.metadata.name)