fix: exclude __words__ keyword index from corruption detection and getStats()
The __words__ keyword index stores 50-5000 entries per entity (one per word), which inflated avg entries/entity well above the corruption threshold of 100. This caused: 1. validateConsistency() to falsely detect corruption on every startup, triggering unnecessary clearAllIndexData() + rebuild() cycles 2. getStats() to log false "Metadata index may be corrupted" warnings and report inflated totalEntries/totalIds stats Both methods now skip __words__ when counting, so stats and health checks reflect metadata fields only (noun, type, createdAt, etc.). Keyword search is unaffected since the __words__ field index itself is not modified.
This commit is contained in:
parent
32dbdcec61
commit
364360d447
128 changed files with 5637 additions and 5682 deletions
|
|
@ -18,7 +18,7 @@ export interface BrainyInterface<T = unknown> {
|
|||
init(): Promise<void>
|
||||
|
||||
/**
|
||||
* Promise that resolves when initialization is complete (v7.3.0+)
|
||||
* Promise that resolves when initialization is complete
|
||||
* Can be awaited multiple times safely.
|
||||
*/
|
||||
readonly ready: Promise<void>
|
||||
|
|
@ -29,12 +29,12 @@ export interface BrainyInterface<T = unknown> {
|
|||
readonly isInitialized: boolean
|
||||
|
||||
/**
|
||||
* Check if all initialization including background tasks is complete (v7.3.0+)
|
||||
* Check if all initialization including background tasks is complete
|
||||
*/
|
||||
isFullyInitialized(): boolean
|
||||
|
||||
/**
|
||||
* Wait for all background initialization tasks to complete (v7.3.0+)
|
||||
* Wait for all background initialization tasks to complete
|
||||
* For cloud storage adapters, this waits for bucket validation and count sync.
|
||||
*/
|
||||
awaitBackgroundInit(): Promise<void>
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@
|
|||
* }
|
||||
* ```
|
||||
*
|
||||
* ## Stage 3 Changes from v5.4.0
|
||||
* ## Stage 3 Changes
|
||||
*
|
||||
* ### Nouns Added (+11)
|
||||
* agent, quality, timeInterval, function, proposition, socialGroup, institution,
|
||||
|
|
@ -323,7 +323,7 @@
|
|||
* createdBy (use inverse of creates), supervises (use inverse of reportsTo)
|
||||
*
|
||||
* **Net Change**: +9 nouns (31 → 40), +48 verbs (40 → 88) = +57 types total
|
||||
* **Coverage**: 60% (v5.4.0) → 95% (Stage 3)
|
||||
* **Coverage**: 60% → 95% (Stage 3)
|
||||
*/
|
||||
|
||||
// Common metadata types
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Type Migration Utilities for Stage 3 Taxonomy (v6.0.0)
|
||||
* Type Migration Utilities for Stage 3 Taxonomy
|
||||
*
|
||||
* Provides migration helpers for code using removed types from v5.x
|
||||
*
|
||||
|
|
@ -52,7 +52,7 @@ export function isRemovedVerbType(type: string): type is keyof typeof REMOVED_VE
|
|||
}
|
||||
|
||||
/**
|
||||
* Migrate a noun type from v5.x to v6.0 Stage 3
|
||||
* Migrate a noun type (Stage 3)
|
||||
* Returns the migrated type or the original if no migration needed
|
||||
*/
|
||||
export function migrateNounType(type: string): NounType {
|
||||
|
|
@ -64,7 +64,7 @@ export function migrateNounType(type: string): NounType {
|
|||
}
|
||||
|
||||
/**
|
||||
* Migrate a verb type from v5.x to v6.0 Stage 3
|
||||
* Migrate a verb type (Stage 3)
|
||||
* Returns the migrated type or the original if no migration needed
|
||||
*
|
||||
* WARNING: Some verbs require inverting source/target relationships!
|
||||
|
|
@ -138,7 +138,7 @@ export function migrateRelationship(params: {
|
|||
|
||||
/**
|
||||
* Stage 3 Type Compatibility Check
|
||||
* Helps developers identify code that needs updating for v6.0
|
||||
* Helps developers identify code that needs updating
|
||||
*/
|
||||
export function checkTypeCompatibility(nounTypes: string[], verbTypes: string[]): {
|
||||
valid: boolean
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue