fix: CRITICAL systemic VFS metadata bug across ALL storage adapters (v4.7.4)
CRITICAL BUG FIX - Workshop Team Unblocked! This hotfix resolves a systemic bug affecting ALL 7 storage adapters that caused VFS queries to return empty results even when data existed. Bug Pattern: `if (!metadata) continue` in getNouns()/getVerbs() Impact: VFS queries returned empty arrays despite 577 relationships existing Root Cause: Storage adapters skipped entities if metadata file read returned null Fixes: - storage: Fix metadata skip bug in 12 locations across 7 adapters (TypeAware, Memory, FileSystem, GCS, S3, R2, OPFS, Azure) - neural: Fix SmartExtractor weighted score threshold (28 failures → 4) - neural: Fix PatternSignal priority ordering - api: Fix Brainy.relate() weight parameter not returned Test Results: - TypeAwareStorageAdapter: 17/17 passing (was 7 failures) - SmartExtractor: 42/46 passing (was 28 failures) - Neural clustering: 3/3 passing - Brainy.relate(): 20/20 passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c75bbb9ba4
commit
e06edb7d52
15 changed files with 287 additions and 144 deletions
|
|
@ -556,8 +556,17 @@ export class SmartExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
// Determine final confidence score
|
||||
// FIX: When only one signal matches, use its original confidence instead of weighted score
|
||||
// The weighted score is too low when only one signal matches (e.g., 0.8 * 0.2 = 0.16 < 0.60 threshold)
|
||||
let finalConfidence = bestScore
|
||||
if (bestSignals.length === 1) {
|
||||
// Single signal: use its original confidence
|
||||
finalConfidence = bestSignals[0].confidence
|
||||
}
|
||||
|
||||
// Check minimum confidence threshold
|
||||
if (!bestType || bestScore < this.options.minConfidence) {
|
||||
if (!bestType || finalConfidence < this.options.minConfidence) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -572,7 +581,7 @@ export class SmartExtractor {
|
|||
|
||||
return {
|
||||
type: bestType,
|
||||
confidence: Math.min(bestScore, 1.0), // Cap at 1.0
|
||||
confidence: Math.min(finalConfidence, 1.0), // Cap at 1.0
|
||||
source: 'ensemble',
|
||||
evidence,
|
||||
metadata: {
|
||||
|
|
@ -609,7 +618,9 @@ export class SmartExtractor {
|
|||
|
||||
const best = validResults[0]
|
||||
|
||||
if (best.weightedScore < this.options.minConfidence) {
|
||||
// FIX: Use original confidence, not weighted score for threshold check
|
||||
// Weighted score is for ranking signals, not for absolute threshold
|
||||
if (best.confidence < this.options.minConfidence) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,33 +109,58 @@ export class PatternSignal {
|
|||
* - Document: files, papers, reports
|
||||
*/
|
||||
private initializePatterns(): void {
|
||||
// Person patterns
|
||||
this.addPatterns(NounType.Person, 0.80, [
|
||||
/\b(?:Dr|Prof|Mr|Mrs|Ms|Sir|Lady|Lord)\s+[A-Z][a-z]+/,
|
||||
/\b[A-Z][a-z]+\s+[A-Z][a-z]+(?:\s+[A-Z][a-z]+)?\b/, // Full names
|
||||
/\b(?:CEO|CTO|CFO|COO|VP|Director|Manager|Engineer|Developer|Designer)\b/i,
|
||||
/\b(?:author|creator|founder|inventor|contributor|maintainer)\b/i,
|
||||
/\b(?:user|member|participant|attendee|speaker|presenter)\b/i
|
||||
// Organization patterns - HIGH PRIORITY (must check before person full name pattern)
|
||||
this.addPatterns(NounType.Organization, 0.88, [
|
||||
/\b(?:Inc|LLC|Corp|Ltd|GmbH|SA|AG)\b/, // Strong org indicators
|
||||
/\b[A-Z][a-z]+\s+(?:Company|Corporation|Enterprises|Industries|Group)\b/
|
||||
])
|
||||
|
||||
// Location patterns
|
||||
this.addPatterns(NounType.Location, 0.75, [
|
||||
/\b(?:city|town|village|country|nation|state|province)\b/i,
|
||||
/\b(?:street|avenue|road|boulevard|lane|drive)\b/i,
|
||||
/\b(?:building|tower|center|complex|headquarters)\b/i,
|
||||
/\b(?:north|south|east|west|central)\s+[A-Z][a-z]+/i,
|
||||
/\b[A-Z][a-z]+,\s*[A-Z]{2}\b/ // City, State format
|
||||
// Location patterns - HIGH PRIORITY (city/country format, addresses)
|
||||
this.addPatterns(NounType.Location, 0.86, [
|
||||
/\b[A-Z][a-z]+,\s*[A-Z]{2}\b/, // City, State format (e.g., "Paris, FR")
|
||||
/\b(?:street|avenue|road|boulevard|lane|drive)\b/i
|
||||
])
|
||||
|
||||
// Organization patterns
|
||||
this.addPatterns(NounType.Organization, 0.78, [
|
||||
/\b(?:Inc|LLC|Corp|Ltd|GmbH|SA|AG)\b/,
|
||||
/\b[A-Z][a-z]+\s+(?:Company|Corporation|Enterprises|Industries|Group)\b/,
|
||||
// Event patterns - HIGH PRIORITY (specific event keywords)
|
||||
this.addPatterns(NounType.Event, 0.84, [
|
||||
/\b(?:conference|summit|symposium|workshop|seminar|webinar)\b/i,
|
||||
/\b(?:hackathon|bootcamp)\b/i
|
||||
])
|
||||
|
||||
// Person patterns - SPECIFIC INDICATORS (high confidence)
|
||||
this.addPatterns(NounType.Person, 0.82, [
|
||||
/\b(?:Dr|Prof|Mr|Mrs|Ms|Sir|Lady|Lord)\s+[A-Z][a-z]+/, // Titles
|
||||
/\b(?:CEO|CTO|CFO|COO|VP|Director|Manager|Engineer|Developer|Designer)\b/i, // Roles
|
||||
/\b(?:author|creator|founder|inventor|contributor|maintainer)\b/i
|
||||
])
|
||||
|
||||
// Organization patterns - MEDIUM PRIORITY
|
||||
this.addPatterns(NounType.Organization, 0.76, [
|
||||
/\b(?:university|college|institute|academy|school)\b/i,
|
||||
/\b(?:department|division|team|committee|board)\b/i,
|
||||
/\b(?:government|agency|bureau|ministry|administration)\b/i
|
||||
])
|
||||
|
||||
// Location patterns - MEDIUM PRIORITY
|
||||
this.addPatterns(NounType.Location, 0.74, [
|
||||
/\b(?:city|town|village|country|nation|state|province)\b/i,
|
||||
/\b(?:building|tower|center|complex|headquarters)\b/i,
|
||||
/\b(?:north|south|east|west|central)\s+[A-Z][a-z]+/i
|
||||
])
|
||||
|
||||
// Event patterns - MEDIUM PRIORITY
|
||||
this.addPatterns(NounType.Event, 0.72, [
|
||||
/\b(?:meeting|session|call|standup|retrospective|sprint)\b/i,
|
||||
/\b(?:release|launch|deployment|rollout|update)\b/i,
|
||||
/\b(?:training|course|tutorial)\b/i
|
||||
])
|
||||
|
||||
// Person patterns - GENERIC (low confidence, catches full names but easily overridden)
|
||||
this.addPatterns(NounType.Person, 0.68, [
|
||||
/\b[A-Z][a-z]+\s+[A-Z][a-z]+(?:\s+[A-Z][a-z]+)?\b/, // Full names (generic, low priority)
|
||||
/\b(?:user|member|participant|attendee|speaker|presenter)\b/i
|
||||
])
|
||||
|
||||
// Technology patterns (Thing type)
|
||||
this.addPatterns(NounType.Thing, 0.82, [
|
||||
/\b(?:JavaScript|TypeScript|Python|Java|C\+\+|Go|Rust|Swift|Kotlin)\b/,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue