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
|
|
@ -54,7 +54,7 @@ export class EntityIdMapper {
|
|||
async init(): Promise<void> {
|
||||
try {
|
||||
const metadata = await this.storage.getMetadata(this.storageKey)
|
||||
// v4.8.0: metadata IS the data (no nested 'data' property)
|
||||
// metadata IS the data (no nested 'data' property)
|
||||
if (metadata && (metadata as any).nextId !== undefined) {
|
||||
const data = metadata as any as EntityIdMapperData
|
||||
this.nextId = data.nextId
|
||||
|
|
@ -87,7 +87,7 @@ export class EntityIdMapper {
|
|||
}
|
||||
|
||||
/**
|
||||
* v7.5.0: Get integer ID for UUID with immediate persistence guarantee
|
||||
* Get integer ID for UUID with immediate persistence guarantee
|
||||
* Unlike getOrAssign(), this method flushes to storage immediately after assigning
|
||||
* a new ID. This prevents UUID→int mapping divergence if the process crashes
|
||||
* before a normal flush() occurs.
|
||||
|
|
@ -194,7 +194,7 @@ export class EntityIdMapper {
|
|||
}
|
||||
|
||||
// Convert maps to plain objects for serialization
|
||||
// v4.0.0: Add required 'noun' property for NounMetadata
|
||||
// Add required 'noun' property for NounMetadata
|
||||
const data = {
|
||||
noun: 'EntityIdMapper',
|
||||
nextId: this.nextId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue