Sweeping the vestigial hnsw sharding machinery surfaced two real defects on the counts-recovery path (the code that rebuilds totalNounCount/totalVerbCount when counts.json is lost or corrupted — container restarts, partial copies): - initializeCountsFromDisk counted files in entities/*/hnsw/ — directories the 8.0 write path never populates — so an established store recovered to ZERO counts on real data: wrong getNounCount()/stats, a "New installation"-style boot log, and a mis-sized rebuild-strategy decision at open. The scan now walks the canonical entities/<kind>/<shard>/<id>/ tree (one entity per id directory), with the same sampled type-distribution estimate as before. - The sampler called getNounMetadata — whose ensureInitialized() re-enters init() — from INSIDE init(), a latent deadlock reachable the moment the scan found anything to sample. The sampled metadata files are now read directly with fs (gz-transparent), no guarded accessors inside init. The dead machinery itself (verified zero callers by reachability analysis before deletion): the nine 7.x hnsw-layout entity/edge CRUD methods, the sharding-depth prober + its depth-migration engine (unreachable — the probe always returned null on 8.0 stores), an orphaned streaming verb paginator, their path/scan helpers, and the now-unused type aliases and fields. The init block keeps the truthful new-vs-established boot log introduced in 8.0.13, now decided directly from the canonical layout. Net -1,138 lines; no public API touched. Adds a regression test: delete counts.json from a populated store, reopen, counts recover exactly from the canonical tree. |
||
|---|---|---|
| .. | ||
| aggregation | ||
| brainy | ||
| db | ||
| graph | ||
| hnsw | ||
| import | ||
| indexes/columnStore | ||
| neural | ||
| performance | ||
| storage | ||
| transaction | ||
| types | ||
| universal | ||
| utils | ||
| vfs | ||
| boundary-no-native.test.ts | ||
| brainy-core.unit.test.ts | ||
| brainy-get-optimization.test.ts | ||
| cold-open-rebuild-gate.test.ts | ||
| create-entities-default.test.ts | ||
| fieldTypeInference.test.ts | ||
| metadata-cold-read-guard.test.ts | ||
| migration-lock.test.ts | ||
| plugin-autodetect.test.ts | ||
| plugin-version-coupling.test.ts | ||
| plugin.test.ts | ||
| process-exit-sweep.test.ts | ||
| shutdown-hooks-lifecycle.test.ts | ||
| test-suite-coverage-guard.test.ts | ||
| type-filtering.unit.test.ts | ||
| vfs-multi-instance-diagnostic.test.ts | ||
| vfs-restart-fix.test.ts | ||
| where-operator-validation.test.ts | ||