brainy/tests/unit/augmentations/image-handler.test.ts

312 lines
10 KiB
TypeScript
Raw Normal View History

feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
/**
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
* ImageHandler Tests (v5.8.0 - Pure JavaScript)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
*
* Tests for image processing with EXIF extraction and metadata extraction
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
* Using probe-image-size + exifr (no native dependencies)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
*/
import { describe, it, expect, beforeEach } from 'vitest'
import { ImageHandler } from '../../../src/augmentations/intelligentImport/handlers/imageHandler.js'
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
import { readFileSync } from 'fs'
import { join } from 'path'
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
describe('ImageHandler (v5.8.0 - Pure JS)', () => {
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
let handler: ImageHandler
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
// Simple test image generators (minimal PNG/JPEG headers)
const createMinimalJPEG = (width: number = 100, height: number = 100): Buffer => {
// Minimal JPEG: SOI + SOF0 + EOI
// This is a valid but minimal JPEG structure
const soi = Buffer.from([0xFF, 0xD8]) // Start of Image
const sof0 = Buffer.from([
0xFF, 0xC0, // SOF0 marker
0x00, 0x11, // Length: 17 bytes
0x08, // Precision: 8 bits
(height >> 8) & 0xFF, height & 0xFF, // Height
(width >> 8) & 0xFF, width & 0xFF, // Width
0x03, // Components: 3 (YCbCr)
0x01, 0x22, 0x00, // Y component
0x02, 0x11, 0x01, // Cb component
0x03, 0x11, 0x01 // Cr component
])
const eoi = Buffer.from([0xFF, 0xD9]) // End of Image
return Buffer.concat([soi, sof0, eoi])
}
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const createMinimalPNG = (width: number = 100, height: number = 100): Buffer => {
// PNG signature
const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])
// IHDR chunk
const ihdr = Buffer.alloc(25)
ihdr.writeUInt32BE(13, 0) // Length
ihdr.write('IHDR', 4)
ihdr.writeUInt32BE(width, 8)
ihdr.writeUInt32BE(height, 12)
ihdr.writeUInt8(8, 16) // Bit depth
ihdr.writeUInt8(2, 17) // Color type (RGB)
ihdr.writeUInt8(0, 18) // Compression
ihdr.writeUInt8(0, 19) // Filter
ihdr.writeUInt8(0, 20) // Interlace
ihdr.writeUInt32BE(0, 21) // CRC (simplified)
// IEND chunk
const iend = Buffer.from([0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130])
return Buffer.concat([signature, ihdr, iend])
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
}
beforeEach(() => {
handler = new ImageHandler()
})
describe('Handler Detection', () => {
it('should identify as image format handler', () => {
expect(handler.format).toBe('image')
})
it('should handle JPEG files by filename', () => {
expect(handler.canHandle({ filename: 'photo.jpg' })).toBe(true)
expect(handler.canHandle({ filename: 'photo.jpeg' })).toBe(true)
})
it('should handle PNG files by filename', () => {
expect(handler.canHandle({ filename: 'logo.png' })).toBe(true)
})
it('should handle WebP files by filename', () => {
expect(handler.canHandle({ filename: 'image.webp' })).toBe(true)
})
it('should handle other image formats', () => {
expect(handler.canHandle({ filename: 'photo.gif' })).toBe(true)
expect(handler.canHandle({ filename: 'photo.tiff' })).toBe(true)
expect(handler.canHandle({ filename: 'photo.bmp' })).toBe(true)
expect(handler.canHandle({ filename: 'icon.svg' })).toBe(true)
})
it('should handle images by extension', () => {
expect(handler.canHandle({ ext: '.jpg' })).toBe(true)
expect(handler.canHandle({ ext: 'png' })).toBe(true)
})
it('should reject non-image files', () => {
expect(handler.canHandle({ filename: 'document.pdf' })).toBe(false)
expect(handler.canHandle({ filename: 'data.csv' })).toBe(false)
expect(handler.canHandle({ filename: 'text.txt' })).toBe(false)
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should detect JPEG by magic bytes', () => {
const jpegBuffer = createMinimalJPEG(100, 100)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
expect(handler.canHandle(jpegBuffer)).toBe(true)
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should detect PNG by magic bytes', () => {
const pngBuffer = createMinimalPNG(100, 100)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
expect(handler.canHandle(pngBuffer)).toBe(true)
})
})
describe('Image Metadata Extraction', () => {
it('should extract JPEG metadata', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
expect(result.format).toBe('image')
expect(result.data).toHaveLength(1)
const imageData = result.data[0]
expect(imageData.type).toBe('media')
expect(imageData.metadata).toBeDefined()
expect(imageData.metadata.subtype).toBe('image')
expect(imageData.metadata.width).toBe(800)
expect(imageData.metadata.height).toBe(600)
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
expect(imageData.metadata.format).toBe('jpg') // probe-image-size uses 'jpg' not 'jpeg'
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
it('should extract PNG metadata', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalPNG(400, 300)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
const imageData = result.data[0]
expect(imageData.metadata.width).toBe(400)
expect(imageData.metadata.height).toBe(300)
expect(imageData.metadata.format).toBe('png')
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should include image size in bytes', async () => {
const imageBuffer = createMinimalJPEG(200, 200)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
const imageData = result.data[0]
expect(imageData.metadata.size).toBe(imageBuffer.length)
expect(imageData.metadata.size).toBeGreaterThan(0)
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should include MIME type when available', async () => {
const imageBuffer = createMinimalJPEG(100, 100)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
const imageData = result.data[0]
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
expect(imageData.metadata.mimeType).toBeDefined()
expect(imageData.metadata.mimeType).toContain('image/')
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
it('should include processing time in metadata', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer)
expect(result.metadata.processingTime).toBeGreaterThanOrEqual(0)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
expect(result.metadata.processingTime).toBeLessThan(5000)
})
it('should include image metadata in result metadata', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer)
expect(result.metadata.imageMetadata).toBeDefined()
expect(result.metadata.imageMetadata.width).toBe(800)
expect(result.metadata.imageMetadata.height).toBe(600)
})
})
describe('EXIF Data Extraction', () => {
it('should handle images without EXIF data', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: true
})
const imageData = result.data[0]
// Should not crash, EXIF will be undefined
expect(imageData.metadata.exif).toBeUndefined()
})
it('should extract EXIF by default', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
// Default: EXIF extraction enabled
const result = await handler.process(imageBuffer)
// Will be undefined for test images, but should not crash
expect(result.metadata.exifData).toBeUndefined()
})
it('should allow disabling EXIF extraction', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(800, 600)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
const imageData = result.data[0]
expect(imageData.metadata.exif).toBeUndefined()
})
})
describe('Error Handling', () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should handle invalid image data gracefully', async () => {
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const invalidBuffer = Buffer.from('not an image', 'utf-8')
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
// Should still process but with fallback values
const result = await handler.process(invalidBuffer, { extractEXIF: false })
// Fallback detection should provide basic info
expect(result.data[0].metadata.format).toBeDefined()
expect(result.data[0].metadata.size).toBe(invalidBuffer.length)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
it('should handle empty buffer', async () => {
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const emptyBuffer = Buffer.alloc(0)
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
// Should not crash, but will have unknown format
const result = await handler.process(emptyBuffer, { extractEXIF: false })
expect(result.data[0].metadata.format).toBe('unknown')
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
})
describe('Format Support', () => {
it('should process JPEG images', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(200, 200)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
expect(result.data[0].metadata.format).toBe('jpg') // probe-image-size uses 'jpg' not 'jpeg'
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
it('should process PNG images', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalPNG(200, 200)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, {
extractEXIF: false
})
expect(result.data[0].metadata.format).toBe('png')
})
it('should handle various image dimensions', async () => {
const sizes = [
[100, 100],
[1920, 1080],
[400, 300],
[1000, 500]
]
for (const [width, height] of sizes) {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(width, height)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
const result = await handler.process(imageBuffer, { extractEXIF: false })
expect(result.data[0].metadata.width).toBe(width)
expect(result.data[0].metadata.height).toBe(height)
}
})
})
describe('Integration with BaseFormatHandler', () => {
it('should inherit MIME type detection from BaseFormatHandler', () => {
// getMimeType is protected, but we can verify behavior
expect(handler.canHandle({ filename: 'test.jpg' })).toBe(true)
expect(handler.canHandle({ filename: 'test.png' })).toBe(true)
})
it('should provide structured ProcessedData', async () => {
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const imageBuffer = createMinimalJPEG(200, 200)
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
const result = await handler.process(imageBuffer, {
filename: 'test-image.jpg',
extractEXIF: false
})
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
// Verify ProcessedData structure
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
expect(result.format).toBe('image')
fix: resolve VFS tree corruption from blob errors (v5.8.0) CRITICAL FIX: Single blob read error no longer corrupts entire VFS tree Root Causes Fixed: 1. Uncaught blob errors in readFile() triggered VFS re-initialization 2. Race conditions in initializeRoot() created duplicate roots 3. Wrong root selection algorithm (oldest vs most children) Architectural Solution: - **Error Isolation**: Blob errors caught and re-thrown as VFSError VFS tree structure completely isolated from file content errors (src/vfs/VirtualFileSystem.ts:288-321) - **Singleton Promise Pattern**: Prevents duplicate root creation Concurrent init() calls wait for same initialization promise Acts as automatic mutex without custom lock class (src/vfs/VirtualFileSystem.ts:180-199) - **Smart Root Selection**: Selects root with MOST children (not oldest) Auto-heals existing duplicates on init() Logs cleanup suggestions for empty roots (src/vfs/VirtualFileSystem.ts:283-334) Production Impact: - Workshop production: 5 duplicate roots, 1,836 files orphaned - After fix: Zero duplicate roots possible, auto-healing - All 100 VFS tests pass ✅ Additional Fix: Remove Sharp native dependency (v5.8.0) ImageHandler rewritten using pure JavaScript: - exifr (already installed) for EXIF extraction - probe-image-size for image dimensions/format - Zero native dependencies (removed 10MB of native binaries) - All 25 image handler tests pass ✅ - No more test crashes from Sharp/libvips worker thread issues Test Results: - VFS tests: 100/100 pass ✅ - Image handler tests: 25/25 pass ✅ - Overall: 1157/1200 tests pass (18 pre-existing timeout issues) - Build: Successful, zero TypeScript errors ✅ Features Complete (TIER 1 - v5.8.0): - Transaction system (36 unit + 35 integration tests) - Duplicate check optimization (O(n) → O(log n)) - GraphIndex pagination - Comprehensive filter documentation
2025-11-14 11:27:35 -08:00
expect(result.data).toBeInstanceOf(Array)
expect(result.metadata).toBeDefined()
expect(result.filename).toBe('test-image.jpg')
// Verify data structure
const entity = result.data[0]
expect(entity.name).toBe('test-image')
expect(entity.type).toBe('media')
expect(entity.metadata).toBeDefined()
feat: add ImageHandler with EXIF extraction and comprehensive MIME detection (v5.2.0) Implements Phase 1.5 (Comprehensive MIME Type Detection) and adds built-in image processing support to IntelligentImportAugmentation. **New Features:** - ImageHandler: Extracts image metadata (dimensions, format, color space) using sharp - EXIF extraction: Camera data, GPS, timestamps using exifr library - Support for JPEG, PNG, WebP, GIF, TIFF, BMP, SVG, HEIC, AVIF formats - MimeTypeDetector: Unified MIME type detection with magic byte support - FormatDetector: Enhanced with image format detection via MIME + magic bytes **Architecture Fixes:** - Fixed brain.import() augmentation pipeline integration (src/brainy.ts:3140-3154) - Added parameter spreading for ImportSource objects to enable augmentation access - Fixed metadata propagation through ImportCoordinator to final results - Added augmentation data check in ImportCoordinator.extract() **Integration:** - ImageHandler registered as built-in handler alongside CSV, Excel, PDF - Images import as 'media' entities with 'image' subtype - Full metadata preserved in knowledge graph entities - Configuration options: enableImage, extractEXIF, imageDefaults **Test Coverage:** - 15 integration tests (image-import.test.ts) - 100% passing - 27 unit tests (image-handler.test.ts) - 100% passing - Format detection tests for all supported image types - Error handling and resilience tests **Breaking Changes:** None - backward compatible Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 14:06:17 -08:00
})
})
})