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

@ -573,6 +573,14 @@ export class Brainy<T = any> implements BrainyInterface<T> {
// v4.8.0: Storage adapters ALREADY extract standard fields to top-level!
// Just read from top-level fields of HNSWNounWithMetadata
console.log(`[DEBUG convertNounToEntity] Converting noun ${noun.id}:`, {
nounMetadataKeys: noun.metadata ? Object.keys(noun.metadata) : [],
nounType: noun.type,
hasName: !!noun.metadata?.name,
hasPath: !!noun.metadata?.path,
hasVfsType: !!noun.metadata?.vfsType
})
// v4.8.0: Clean structure with standard fields at top-level
const entity: Entity<T> = {
id: noun.id,
@ -592,6 +600,13 @@ export class Brainy<T = any> implements BrainyInterface<T> {
metadata: noun.metadata as T
}
console.log(`[DEBUG convertNounToEntity] Converted entity metadata:`, {
entityMetadataKeys: entity.metadata ? Object.keys(entity.metadata as any) : [],
metadata_name: (entity.metadata as any)?.name,
metadata_path: (entity.metadata as any)?.path,
metadata_vfsType: (entity.metadata as any)?.vfsType
})
return entity
}