@soulcraft/brainy 5.7.3 → 5.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/brainy.js +9 -24
- package/dist/import/ImportCoordinator.js +0 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [5.7.4](https://github.com/soulcraftlabs/brainy/compare/v5.7.3...v5.7.4) (2025-11-12)
|
|
6
|
+
|
|
7
|
+
- fix: resolve v5.7.3 race condition by persisting write-through cache (v5.7.4) (6e19ec8)
|
|
8
|
+
|
|
9
|
+
|
|
5
10
|
### [5.7.3](https://github.com/soulcraftlabs/brainy/compare/v5.7.2...v5.7.3) (2025-11-12)
|
|
6
11
|
|
|
7
12
|
|
package/dist/brainy.js
CHANGED
|
@@ -1613,21 +1613,6 @@ export class Brainy {
|
|
|
1613
1613
|
lastBatchTime = Date.now();
|
|
1614
1614
|
}
|
|
1615
1615
|
}
|
|
1616
|
-
// v5.7.3: Ensure nounTypeCache is populated for all successful entities
|
|
1617
|
-
// This prevents cache misses that trigger expensive 42-type searches
|
|
1618
|
-
// when entities are immediately queried (e.g., during brain.relate())
|
|
1619
|
-
const cacheWarmingNeeded = result.successful.filter(id => !this.storage.nounTypeCache?.has(id));
|
|
1620
|
-
if (cacheWarmingNeeded.length > 0) {
|
|
1621
|
-
// Warm the cache by fetching metadata for entities not in cache
|
|
1622
|
-
await Promise.all(cacheWarmingNeeded.map(async (id) => {
|
|
1623
|
-
try {
|
|
1624
|
-
await this.storage.getNounMetadata(id);
|
|
1625
|
-
}
|
|
1626
|
-
catch (error) {
|
|
1627
|
-
// Ignore errors during cache warming (entity may be invalid)
|
|
1628
|
-
}
|
|
1629
|
-
}));
|
|
1630
|
-
}
|
|
1631
1616
|
result.duration = Date.now() - startTime;
|
|
1632
1617
|
return result;
|
|
1633
1618
|
}
|
|
@@ -3094,15 +3079,15 @@ export class Brainy {
|
|
|
3094
3079
|
// 3. Flush graph adjacency index (relationship cache)
|
|
3095
3080
|
// Note: Graph structure is already persisted via storage.saveVerb() calls
|
|
3096
3081
|
// This just flushes the in-memory cache for performance
|
|
3097
|
-
this.graphIndex.flush()
|
|
3098
|
-
//
|
|
3099
|
-
// Cache persists
|
|
3100
|
-
//
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3082
|
+
this.graphIndex.flush()
|
|
3083
|
+
// Note: Write-through cache (storage.writeCache) is NOT cleared here
|
|
3084
|
+
// Cache persists indefinitely for read-after-write consistency
|
|
3085
|
+
// Provides safety net for:
|
|
3086
|
+
// - Cloud storage eventual consistency (S3, GCS, Azure, R2)
|
|
3087
|
+
// - Filesystem buffer cache timing
|
|
3088
|
+
// - Type cache warming period (nounTypeCache population)
|
|
3089
|
+
// Cache entries are removed only when explicitly deleted (deleteObjectFromBranch)
|
|
3090
|
+
// Memory footprint is negligible for typical workloads (<10MB for 100k entities)
|
|
3106
3091
|
]);
|
|
3107
3092
|
const elapsed = Date.now() - startTime;
|
|
3108
3093
|
console.log(`✅ All indexes flushed to disk in ${elapsed}ms`);
|
|
@@ -643,10 +643,6 @@ export class ImportCoordinator {
|
|
|
643
643
|
if (addResult.failed.length > 0) {
|
|
644
644
|
console.warn(`⚠️ ${addResult.failed.length} entities failed to create`);
|
|
645
645
|
}
|
|
646
|
-
// v5.7.3: Ensure all writes are flushed before creating relationships
|
|
647
|
-
// Fixes "Source entity not found" error in v5.7.0/v5.7.1/v5.7.2
|
|
648
|
-
// Guarantees entities are fully persisted and queryable before brain.relate() is called
|
|
649
|
-
await this.brain.flush();
|
|
650
646
|
// Create provenance links in batch
|
|
651
647
|
if (documentEntityId && options.createProvenanceLinks !== false && entities.length > 0) {
|
|
652
648
|
const provenanceParams = entities.map((entity, idx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "5.7.
|
|
3
|
+
"version": "5.7.4",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. Stage 3 CANONICAL: 42 nouns × 127 verbs covering 96-97% of all human knowledge.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|