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

@ -846,20 +846,6 @@ 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) {
@ -884,17 +870,12 @@ export class VirtualFileSystem implements IVirtualFileSystem {
// Return appropriate format
if (options?.withFileTypes) {
const result = children.map(child => ({
return 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)