@soulcraft/brainy 6.2.5 β†’ 6.2.6

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.
@@ -388,6 +388,11 @@ export class AzureBlobStorage extends BaseStorage {
388
388
  // Use write buffer in high-volume mode
389
389
  if (this.highVolumeMode && this.nounWriteBuffer) {
390
390
  this.logger.trace(`πŸ“ BUFFERING: Adding noun ${node.id} to write buffer (high-volume mode active)`);
391
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
392
+ // Without this, add() returns but relate() can't find the entity (cloud storage production bug)
393
+ if (node.vector && Array.isArray(node.vector) && node.vector.length > 0) {
394
+ this.nounCacheManager.set(node.id, node);
395
+ }
391
396
  await this.nounWriteBuffer.add(node.id, node);
392
397
  return;
393
398
  }
@@ -779,6 +784,8 @@ export class AzureBlobStorage extends BaseStorage {
779
784
  // Use write buffer in high-volume mode
780
785
  if (this.highVolumeMode && this.verbWriteBuffer) {
781
786
  this.logger.trace(`πŸ“ BUFFERING: Adding verb ${edge.id} to write buffer`);
787
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
788
+ this.verbCacheManager.set(edge.id, edge);
782
789
  await this.verbWriteBuffer.add(edge.id, edge);
783
790
  return;
784
791
  }
@@ -313,6 +313,12 @@ export class GcsStorage extends BaseStorage {
313
313
  // Use write buffer in high-volume mode
314
314
  if (this.highVolumeMode && this.nounWriteBuffer) {
315
315
  this.logger.trace(`πŸ“ BUFFERING: Adding noun ${node.id} to write buffer (high-volume mode active)`);
316
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
317
+ // Without this, add() returns but relate() can't find the entity (GCS production bug)
318
+ // The buffer flushes asynchronously, but cache ensures immediate reads succeed
319
+ if (node.vector && Array.isArray(node.vector) && node.vector.length > 0) {
320
+ this.nounCacheManager.set(node.id, node);
321
+ }
316
322
  await this.nounWriteBuffer.add(node.id, node);
317
323
  return;
318
324
  }
@@ -648,6 +654,9 @@ export class GcsStorage extends BaseStorage {
648
654
  // Use write buffer in high-volume mode
649
655
  if (this.highVolumeMode && this.verbWriteBuffer) {
650
656
  this.logger.trace(`πŸ“ BUFFERING: Adding verb ${edge.id} to write buffer`);
657
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
658
+ // Without this, relate() might not find the verb immediately after creation
659
+ this.verbCacheManager.set(edge.id, edge);
651
660
  await this.verbWriteBuffer.add(edge.id, edge);
652
661
  return;
653
662
  }
@@ -355,6 +355,11 @@ export class R2Storage extends BaseStorage {
355
355
  // Use write buffer in high-volume mode
356
356
  if (this.highVolumeMode && this.nounWriteBuffer) {
357
357
  this.logger.trace(`πŸ“ BUFFERING: Adding noun ${node.id} to write buffer`);
358
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
359
+ // Without this, add() returns but relate() can't find the entity (cloud storage production bug)
360
+ if (node.vector && Array.isArray(node.vector) && node.vector.length > 0) {
361
+ this.nounCacheManager.set(node.id, node);
362
+ }
358
363
  await this.nounWriteBuffer.add(node.id, node);
359
364
  return;
360
365
  }
@@ -571,6 +576,8 @@ export class R2Storage extends BaseStorage {
571
576
  await this.ensureInitialized();
572
577
  this.checkVolumeMode();
573
578
  if (this.highVolumeMode && this.verbWriteBuffer) {
579
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
580
+ this.verbCacheManager.set(edge.id, edge);
574
581
  await this.verbWriteBuffer.add(edge.id, edge);
575
582
  return;
576
583
  }
@@ -810,6 +810,12 @@ export class S3CompatibleStorage extends BaseStorage {
810
810
  // Use write buffer in high-volume mode
811
811
  if (this.highVolumeMode && this.nounWriteBuffer) {
812
812
  this.logger.trace(`πŸ“ BUFFERING: Adding noun ${node.id} to write buffer (high-volume mode active)`);
813
+ // v6.2.6: CRITICAL FIX - Populate cache BEFORE buffering for read-after-write consistency
814
+ // Without this, add() returns but relate() can't find the entity (cloud storage production bug)
815
+ // The buffer flushes asynchronously, but cache ensures immediate reads succeed
816
+ if (node.vector && Array.isArray(node.vector) && node.vector.length > 0) {
817
+ this.nounCacheManager.set(node.id, node);
818
+ }
813
819
  await this.nounWriteBuffer.add(node.id, node);
814
820
  return;
815
821
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "6.2.5",
3
+ "version": "6.2.6",
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",