@onlineapps/conn-orch-registry 1.1.6 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-registry",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "license": "MIT",
5
5
  "description": "Connector-registry-client provides the core communication mechanism for microservices in this environment. It enables them to interact with a services_registry to receive and fulfill tasks by submitting heartbeats or their API descriptions.",
6
6
  "keywords": [
@@ -99,24 +99,65 @@ class ServiceRegistryClient extends EventEmitter {
99
99
  * @returns {Promise<void>}
100
100
  */
101
101
  async _loadValidationProof() {
102
+ const proofPath = path.join(process.cwd(), '.validation-proof.json');
103
+
104
+ // Log attempt with full context
105
+ console.log(`[RegistryClient] ${this.serviceName}: Loading validation proof from ${proofPath}`);
106
+ console.log(`[RegistryClient] ${this.serviceName}: Current working directory: ${process.cwd()}`);
107
+
102
108
  try {
103
- // Look for .validation-proof.json in process.cwd() (service root)
104
- const proofPath = path.join(process.cwd(), '.validation-proof.json');
105
-
106
- if (fs.existsSync(proofPath)) {
107
- const proofData = JSON.parse(fs.readFileSync(proofPath, 'utf8'));
108
-
109
- if (proofData.validationProof && proofData.validationData) {
110
- this.validationProof = {
111
- hash: proofData.validationProof,
112
- data: proofData.validationData
113
- };
114
- console.log(`[RegistryClient] Validation proof loaded: ${this.validationProof.hash.substring(0, 16)}...`);
115
- }
109
+ // Check file existence explicitly
110
+ if (!fs.existsSync(proofPath)) {
111
+ console.log(`[RegistryClient] ${this.serviceName}: ⚠️ Validation proof file NOT FOUND at ${proofPath}`);
112
+ console.log(`[RegistryClient] ${this.serviceName}: Service will use Tier 2 validation (online validation by Registry)`);
113
+ this.validationProof = null;
114
+ return;
116
115
  }
116
+
117
+ console.log(`[RegistryClient] ${this.serviceName}: ✓ Proof file exists, reading...`);
118
+
119
+ // Read and parse file
120
+ const fileContent = fs.readFileSync(proofPath, 'utf8');
121
+ console.log(`[RegistryClient] ${this.serviceName}: ✓ File read, size: ${fileContent.length} bytes`);
122
+
123
+ const proofData = JSON.parse(fileContent);
124
+ console.log(`[RegistryClient] ${this.serviceName}: ✓ JSON parsed successfully`);
125
+
126
+ // Validate structure
127
+ if (!proofData.validationProof) {
128
+ console.error(`[RegistryClient] ${this.serviceName}: ❌ ERROR: Missing 'validationProof' field in ${proofPath}`);
129
+ console.error(`[RegistryClient] ${this.serviceName}: Available fields: ${Object.keys(proofData).join(', ')}`);
130
+ this.validationProof = null;
131
+ return;
132
+ }
133
+
134
+ if (!proofData.validationData) {
135
+ console.error(`[RegistryClient] ${this.serviceName}: ❌ ERROR: Missing 'validationData' field in ${proofPath}`);
136
+ console.error(`[RegistryClient] ${this.serviceName}: Available fields: ${Object.keys(proofData).join(', ')}`);
137
+ this.validationProof = null;
138
+ return;
139
+ }
140
+
141
+ // Store proof
142
+ this.validationProof = {
143
+ hash: proofData.validationProof,
144
+ data: proofData.validationData
145
+ };
146
+
147
+ console.log(`[RegistryClient] ${this.serviceName}: ✅ SUCCESS - Validation proof loaded`);
148
+ console.log(`[RegistryClient] ${this.serviceName}: Proof hash: ${this.validationProof.hash.substring(0, 32)}...`);
149
+ console.log(`[RegistryClient] ${this.serviceName}: Validator: ${this.validationProof.data.validator}`);
150
+ console.log(`[RegistryClient] ${this.serviceName}: Tests passed: ${this.validationProof.data.testsPassed}/${this.validationProof.data.testsRun}`);
151
+ console.log(`[RegistryClient] ${this.serviceName}: Validated at: ${this.validationProof.data.validatedAt}`);
152
+
117
153
  } catch (error) {
118
154
  // Non-critical error - service can still register without proof (will trigger Tier 2 validation)
119
- console.warn(`[RegistryClient] Could not load validation proof: ${error.message}`);
155
+ console.error(`[RegistryClient] ${this.serviceName}: EXCEPTION while loading validation proof`);
156
+ console.error(`[RegistryClient] ${this.serviceName}: Error: ${error.message}`);
157
+ console.error(`[RegistryClient] ${this.serviceName}: Stack: ${error.stack}`);
158
+ console.error(`[RegistryClient] ${this.serviceName}: Path attempted: ${proofPath}`);
159
+ console.log(`[RegistryClient] ${this.serviceName}: Service will use Tier 2 validation (online validation by Registry)`);
160
+ this.validationProof = null;
120
161
  }
121
162
  }
122
163
 
@@ -207,7 +248,10 @@ class ServiceRegistryClient extends EventEmitter {
207
248
  if (this.validationProof) {
208
249
  msg.validationProof = this.validationProof.hash;
209
250
  msg.validationData = this.validationProof.data;
210
- console.log(`[RegistryClient] Including validation proof in registration: ${this.validationProof.hash.substring(0, 16)}...`);
251
+ console.log(`[RegistryClient] ${this.serviceName}: ✅ Including validation proof in registration message`);
252
+ console.log(`[RegistryClient] ${this.serviceName}: Proof hash: ${this.validationProof.hash.substring(0, 32)}...`);
253
+ } else {
254
+ console.log(`[RegistryClient] ${this.serviceName}: ⚠️ NO validation proof available - Registry will perform Tier 2 validation`);
211
255
  }
212
256
 
213
257
  // Create promise to wait for registration response