nounCountsByType (read by stats().entitiesByType / counts.byTypeEnum) was incremented in saveNoun_internal(), which runs on every noun write — including the HNSW index re-saving a node whenever its neighbor links change. So per-type counts grew with graph connectivity instead of entity count (an internal report saw 8 documents read as 44). Moved the increment into saveNounMetadata_internal(), gated on isNew + visibility, exactly parallel to the authoritative total; the visibility-flip path adjusts it in lockstep too. Tests: tests/unit/storage/stats-count-accuracy.test.ts (30 dense-type entities -> exactly 30 across stats/counts/getNounCount) + de-theatricalized the >=2 assertion in brainy-core.unit.test.ts to exact equality. Build green; 1455 unit green. Part of the 8.0 readiness audit Phase 1; cold-reopen count rehydration is still WIP. |
||
|---|---|---|
| .. | ||
| api | ||
| benchmarks | ||
| comprehensive | ||
| configs | ||
| fixtures/import | ||
| helpers | ||
| integration | ||
| integrations | ||
| performance | ||
| regression | ||
| scripts | ||
| transaction | ||
| unit | ||
| vfs | ||
| brainy-3.test.ts | ||
| critical-error-handling.test.ts | ||
| critical-neural-validation.test.ts | ||
| critical-performance-benchmark.test.ts | ||
| model-loading.test.ts | ||
| package-size-breakdown.test.ts | ||
| package-size-limit.test.ts | ||
| setup-integration.ts | ||
| setup-semantic.ts | ||
| setup-unit.ts | ||
| setup.ts | ||
| streaming-pipeline.test.ts | ||
| type-utils.test.ts | ||