@soulcraft/brainy 3.37.4 → 3.37.5
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.
|
@@ -392,6 +392,8 @@ export class GcsStorage extends BaseStorage {
|
|
|
392
392
|
this.logger.trace(`Getting node ${id}`);
|
|
393
393
|
// Get the GCS key with UUID-based sharding
|
|
394
394
|
const key = this.getNounKey(id);
|
|
395
|
+
// DIAGNOSTIC LOGGING: Show exact path being accessed
|
|
396
|
+
this.logger.trace(`Computed GCS key: ${key}`);
|
|
395
397
|
// Download from GCS
|
|
396
398
|
const file = this.bucket.file(key);
|
|
397
399
|
const [contents] = await file.download();
|
|
@@ -421,7 +423,12 @@ export class GcsStorage extends BaseStorage {
|
|
|
421
423
|
this.releaseBackpressure(false, requestId);
|
|
422
424
|
// Check if this is a "not found" error
|
|
423
425
|
if (error.code === 404) {
|
|
424
|
-
|
|
426
|
+
// DIAGNOSTIC LOGGING: Upgrade 404 errors to WARN level with full details
|
|
427
|
+
const key = this.getNounKey(id);
|
|
428
|
+
prodLog.warn(`[getNode] ❌ 404 NOT FOUND: File does not exist at GCS path: ${key}`);
|
|
429
|
+
prodLog.warn(`[getNode] UUID: ${id}`);
|
|
430
|
+
prodLog.warn(`[getNode] Bucket: ${this.bucketName}`);
|
|
431
|
+
prodLog.warn(`[getNode] This suggests a path mismatch or the file was not written correctly`);
|
|
425
432
|
return null;
|
|
426
433
|
}
|
|
427
434
|
// Handle throttling
|
|
@@ -785,6 +792,13 @@ export class GcsStorage extends BaseStorage {
|
|
|
785
792
|
await this.ensureInitialized(); // CRITICAL: Must initialize before using this.bucket
|
|
786
793
|
const limit = options.limit || 100;
|
|
787
794
|
const useCache = options.useCache !== false;
|
|
795
|
+
// DIAGNOSTIC LOGGING: Track pagination performance
|
|
796
|
+
prodLog.info(`[getNodesWithPagination] Starting pagination: limit=${limit}, cursor=${options.cursor || 'none'}`);
|
|
797
|
+
const startTime = Date.now();
|
|
798
|
+
let shardsChecked = 0;
|
|
799
|
+
let filesFound = 0;
|
|
800
|
+
let nodesLoaded = 0;
|
|
801
|
+
let nodesFailed = 0;
|
|
788
802
|
try {
|
|
789
803
|
const nodes = [];
|
|
790
804
|
// Parse cursor (format: "shardIndex:gcsPageToken")
|
|
@@ -799,6 +813,7 @@ export class GcsStorage extends BaseStorage {
|
|
|
799
813
|
for (let shardIndex = startShardIndex; shardIndex < TOTAL_SHARDS; shardIndex++) {
|
|
800
814
|
const shardId = getShardIdByIndex(shardIndex);
|
|
801
815
|
const shardPrefix = `${this.nounPrefix}${shardId}/`;
|
|
816
|
+
shardsChecked++;
|
|
802
817
|
// List objects in this shard
|
|
803
818
|
// Cap maxResults to GCS API limit to prevent "Invalid unsigned integer" errors
|
|
804
819
|
const requestedPageSize = limit - nodes.length;
|
|
@@ -808,6 +823,12 @@ export class GcsStorage extends BaseStorage {
|
|
|
808
823
|
maxResults: cappedPageSize,
|
|
809
824
|
pageToken: shardIndex === startShardIndex ? gcsPageToken : undefined
|
|
810
825
|
});
|
|
826
|
+
// DIAGNOSTIC LOGGING: Show files found per shard (only log non-empty shards)
|
|
827
|
+
if (files && files.length > 0) {
|
|
828
|
+
filesFound += files.length;
|
|
829
|
+
prodLog.info(`[Shard ${shardId}] Found ${files.length} files in "${shardPrefix}"`);
|
|
830
|
+
prodLog.info(`[Shard ${shardId}] Sample file names: ${files.slice(0, 3).map((f) => f.name).join(', ')}`);
|
|
831
|
+
}
|
|
811
832
|
// Extract node IDs from file names
|
|
812
833
|
if (files && files.length > 0) {
|
|
813
834
|
const nodeIds = files
|
|
@@ -824,11 +845,21 @@ export class GcsStorage extends BaseStorage {
|
|
|
824
845
|
return name;
|
|
825
846
|
})
|
|
826
847
|
.filter((id) => id && id.length > 0);
|
|
848
|
+
// DIAGNOSTIC LOGGING: Show extracted UUIDs
|
|
849
|
+
prodLog.info(`[Shard ${shardId}] Extracted ${nodeIds.length} UUIDs: ${nodeIds.slice(0, 3).join(', ')}...`);
|
|
827
850
|
// Load nodes
|
|
828
851
|
for (const id of nodeIds) {
|
|
852
|
+
// DIAGNOSTIC LOGGING: Show each getNode() attempt
|
|
853
|
+
prodLog.info(`[Shard ${shardId}] Calling getNode("${id}")...`);
|
|
829
854
|
const node = await this.getNode(id);
|
|
830
855
|
if (node) {
|
|
831
856
|
nodes.push(node);
|
|
857
|
+
nodesLoaded++;
|
|
858
|
+
prodLog.info(`[Shard ${shardId}] ✅ Successfully loaded node ${id}`);
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
nodesFailed++;
|
|
862
|
+
prodLog.warn(`[Shard ${shardId}] ❌ getNode("${id}") returned null!`);
|
|
832
863
|
}
|
|
833
864
|
if (nodes.length >= limit) {
|
|
834
865
|
break;
|
|
@@ -861,6 +892,14 @@ export class GcsStorage extends BaseStorage {
|
|
|
861
892
|
// Continue to next shard
|
|
862
893
|
}
|
|
863
894
|
// No more shards or nodes
|
|
895
|
+
// DIAGNOSTIC LOGGING: Final summary
|
|
896
|
+
const elapsedTime = Date.now() - startTime;
|
|
897
|
+
prodLog.info(`[getNodesWithPagination] COMPLETED in ${elapsedTime}ms:`);
|
|
898
|
+
prodLog.info(` - Shards checked: ${shardsChecked}/${TOTAL_SHARDS}`);
|
|
899
|
+
prodLog.info(` - Files found: ${filesFound}`);
|
|
900
|
+
prodLog.info(` - Nodes loaded: ${nodesLoaded}`);
|
|
901
|
+
prodLog.info(` - Nodes failed: ${nodesFailed}`);
|
|
902
|
+
prodLog.info(` - Success rate: ${filesFound > 0 ? ((nodesLoaded / filesFound) * 100).toFixed(1) : 'N/A'}%`);
|
|
864
903
|
return {
|
|
865
904
|
nodes,
|
|
866
905
|
totalCount: this.totalNounCount,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "3.37.
|
|
3
|
+
"version": "3.37.5",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|