fix: per-sheet column detection in Excel importer

CRITICAL FIX for Entity_* placeholder names in multi-sheet Excel imports

Root Cause:
- Column detection ran globally on first row of all combined sheets
- Different sheets have different column structures (Term vs Name, etc.)
- Concepts sheet: [Term, Definition] → detected 'Term' column 
- Characters sheet: [Name, Description] → looked for 'Term' column 
- Result: Characters/Places/Other fell back to Entity_* placeholders

Fix:
- Group rows by sheet (_sheet field)
- Detect columns per-sheet, not globally
- Each sheet now uses its own column mapping
- Characters/Places sheets now correctly find 'Name' column

Impact:
- Concepts: Still work (no change)
- Characters/Places/Other: NOW USE ACTUAL NAMES! 🎉

Also removed debug logging from v4.8.5 (performance overhead)

Fixes: Workshop File Explorer showing Entity_* instead of real names
Ref: BRAINY_V4.8.4_VFS_UNDEFINED_NAMES_BUG.md
This commit is contained in:
David Snelling 2025-10-28 14:30:31 -07:00
parent 14ffd3a477
commit 401443a4b0
4 changed files with 24 additions and 50 deletions

View file

@ -573,14 +573,6 @@ 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,
@ -600,13 +592,6 @@ 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
}