@onlineapps/conn-orch-validator 2.0.0 → 2.0.1
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 +1 -1
- package/src/ValidationOrchestrator.js +28 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-orch-validator",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Validation orchestrator for OA Drive microservices - coordinates validation across all layers (base, infra, orch, business)",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,12 +41,12 @@ class ValidationOrchestrator {
|
|
|
41
41
|
* Checks if proof exists and is valid, or runs full validation
|
|
42
42
|
*/
|
|
43
43
|
async validate() {
|
|
44
|
-
|
|
44
|
+
console.log('[ValidationOrchestrator] Starting validation...');
|
|
45
45
|
|
|
46
46
|
// Check if proof exists and is valid
|
|
47
47
|
const existingProof = await this.loadExistingProof();
|
|
48
48
|
if (existingProof && await this.isProofValid(existingProof)) {
|
|
49
|
-
|
|
49
|
+
console.log('[ValidationOrchestrator] ✓ Valid proof found, skipping validation');
|
|
50
50
|
return {
|
|
51
51
|
success: true,
|
|
52
52
|
proofExists: true,
|
|
@@ -56,7 +56,7 @@ class ValidationOrchestrator {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// Run full validation
|
|
59
|
-
|
|
59
|
+
console.log('[ValidationOrchestrator] No valid proof, running validation...');
|
|
60
60
|
return await this.runFullValidation();
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -74,7 +74,7 @@ class ValidationOrchestrator {
|
|
|
74
74
|
|
|
75
75
|
return proof;
|
|
76
76
|
} catch (error) {
|
|
77
|
-
|
|
77
|
+
console.warn(`[ValidationOrchestrator] Failed to load proof: ${error.message}`);
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -90,7 +90,7 @@ class ValidationOrchestrator {
|
|
|
90
90
|
|
|
91
91
|
// Check if fingerprint matches
|
|
92
92
|
if (proof.fingerprint !== currentFingerprint) {
|
|
93
|
-
|
|
93
|
+
console.log('[ValidationOrchestrator] Fingerprint mismatch (service changed)');
|
|
94
94
|
return false;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -100,20 +100,20 @@ class ValidationOrchestrator {
|
|
|
100
100
|
const daysSinceValidation = (now - proofDate) / (1000 * 60 * 60 * 24);
|
|
101
101
|
|
|
102
102
|
if (daysSinceValidation > 30) {
|
|
103
|
-
|
|
103
|
+
console.log('[ValidationOrchestrator] Proof expired (>30 days old)');
|
|
104
104
|
return false;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Verify proof signature
|
|
108
108
|
const isValid = ValidationProofCodec.verify(proof);
|
|
109
109
|
if (!isValid) {
|
|
110
|
-
|
|
110
|
+
console.warn('[ValidationOrchestrator] Proof signature invalid');
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
return true;
|
|
115
115
|
} catch (error) {
|
|
116
|
-
|
|
116
|
+
console.error(`[ValidationOrchestrator] Proof validation error: ${error.message}`);
|
|
117
117
|
return false;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -170,7 +170,7 @@ class ValidationOrchestrator {
|
|
|
170
170
|
|
|
171
171
|
try {
|
|
172
172
|
// Step 1: Service Structure
|
|
173
|
-
|
|
173
|
+
console.log('[ValidationOrchestrator] Step 1/6: Service Structure');
|
|
174
174
|
results.steps.structure = await this.validateStructure();
|
|
175
175
|
if (!results.steps.structure.valid) {
|
|
176
176
|
results.success = false;
|
|
@@ -180,7 +180,7 @@ class ValidationOrchestrator {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
// Step 2: Config Files
|
|
183
|
-
|
|
183
|
+
console.log('[ValidationOrchestrator] Step 2/6: Config Files');
|
|
184
184
|
results.steps.config = await this.validateConfig();
|
|
185
185
|
if (!results.steps.config.valid) {
|
|
186
186
|
results.success = false;
|
|
@@ -188,7 +188,7 @@ class ValidationOrchestrator {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// Step 3: Operations Compliance
|
|
191
|
-
|
|
191
|
+
console.log('[ValidationOrchestrator] Step 3/6: Operations Compliance');
|
|
192
192
|
results.steps.operations = await this.validateOperations();
|
|
193
193
|
if (!results.steps.operations.valid) {
|
|
194
194
|
results.success = false;
|
|
@@ -196,7 +196,7 @@ class ValidationOrchestrator {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// Step 4: Cookbook Tests
|
|
199
|
-
|
|
199
|
+
console.log('[ValidationOrchestrator] Step 4/6: Cookbook Tests');
|
|
200
200
|
results.steps.cookbooks = await this.runCookbookTests();
|
|
201
201
|
results.totalTests += results.steps.cookbooks.total || 0;
|
|
202
202
|
results.passedTests += results.steps.cookbooks.passed || 0;
|
|
@@ -207,7 +207,7 @@ class ValidationOrchestrator {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// Step 5: Service Readiness
|
|
210
|
-
|
|
210
|
+
console.log('[ValidationOrchestrator] Step 5/6: Service Readiness');
|
|
211
211
|
results.steps.readiness = await this.validateReadiness();
|
|
212
212
|
if (!results.steps.readiness.valid) {
|
|
213
213
|
results.success = false;
|
|
@@ -215,7 +215,7 @@ class ValidationOrchestrator {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// Step 6: Connector Integration
|
|
218
|
-
|
|
218
|
+
console.log('[ValidationOrchestrator] Step 6/6: Connector Integration');
|
|
219
219
|
results.steps.connectors = this.validateConnectors();
|
|
220
220
|
if (!results.steps.connectors.valid) {
|
|
221
221
|
// Non-critical - just warnings
|
|
@@ -226,7 +226,7 @@ class ValidationOrchestrator {
|
|
|
226
226
|
return await this.finalizeResults(results, startTime);
|
|
227
227
|
|
|
228
228
|
} catch (error) {
|
|
229
|
-
|
|
229
|
+
console.error(`[ValidationOrchestrator] Validation failed: ${error.message}`);
|
|
230
230
|
results.success = false;
|
|
231
231
|
results.errors.push(`Validation error: ${error.message}`);
|
|
232
232
|
return this.finalizeResults(results, startTime);
|
|
@@ -240,7 +240,7 @@ class ValidationOrchestrator {
|
|
|
240
240
|
try {
|
|
241
241
|
const result = this.structureValidator.validate();
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
console.log(`[ValidationOrchestrator] ✓ Service structure: ${result.valid ? 'PASS' : 'FAIL'}`);
|
|
244
244
|
return result;
|
|
245
245
|
} catch (error) {
|
|
246
246
|
return {
|
|
@@ -278,7 +278,7 @@ class ValidationOrchestrator {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
console.log(`[ValidationOrchestrator] ✓ Config files: ${errors.length === 0 ? 'PASS' : 'FAIL'}`);
|
|
282
282
|
return {
|
|
283
283
|
valid: errors.length === 0,
|
|
284
284
|
errors: errors
|
|
@@ -322,7 +322,7 @@ class ValidationOrchestrator {
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
console.log(`[ValidationOrchestrator] ✓ Operations compliance: ${errors.length === 0 ? 'PASS' : 'FAIL'}`);
|
|
326
326
|
return {
|
|
327
327
|
valid: errors.length === 0,
|
|
328
328
|
errors: errors
|
|
@@ -343,7 +343,7 @@ class ValidationOrchestrator {
|
|
|
343
343
|
const cookbooksPath = path.join(this.serviceRoot, 'tests', 'cookbooks');
|
|
344
344
|
|
|
345
345
|
if (!fs.existsSync(cookbooksPath)) {
|
|
346
|
-
|
|
346
|
+
console.warn('[ValidationOrchestrator] No cookbook tests found (tests/cookbooks/ missing)');
|
|
347
347
|
return {
|
|
348
348
|
success: true,
|
|
349
349
|
total: 0,
|
|
@@ -355,7 +355,7 @@ class ValidationOrchestrator {
|
|
|
355
355
|
|
|
356
356
|
const result = await this.cookbookRunner.runCookbooks(cookbooksPath);
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
console.log(`[ValidationOrchestrator] ✓ Cookbook tests: ${result.passed}/${result.total} passed`);
|
|
359
359
|
return {
|
|
360
360
|
success: result.failed === 0,
|
|
361
361
|
total: result.total,
|
|
@@ -389,7 +389,7 @@ class ValidationOrchestrator {
|
|
|
389
389
|
operations: operations.operations
|
|
390
390
|
});
|
|
391
391
|
|
|
392
|
-
|
|
392
|
+
console.log(`[ValidationOrchestrator] ✓ Service readiness: ${result.ready ? 'PASS' : 'FAIL'}`);
|
|
393
393
|
return {
|
|
394
394
|
valid: result.ready,
|
|
395
395
|
errors: result.ready ? [] : result.errors || ['Service not ready']
|
|
@@ -410,7 +410,7 @@ class ValidationOrchestrator {
|
|
|
410
410
|
// This is validated implicitly through cookbook tests
|
|
411
411
|
// which test ServiceWrapper + all connectors
|
|
412
412
|
|
|
413
|
-
|
|
413
|
+
console.log('[ValidationOrchestrator] ✓ Connector integration: PASS (via cookbook tests)');
|
|
414
414
|
return {
|
|
415
415
|
valid: true,
|
|
416
416
|
warnings: []
|
|
@@ -464,16 +464,16 @@ class ValidationOrchestrator {
|
|
|
464
464
|
results.proof = encodedProof;
|
|
465
465
|
results.fingerprint = fingerprint;
|
|
466
466
|
|
|
467
|
-
|
|
468
|
-
|
|
467
|
+
console.log(`[ValidationOrchestrator] ✅ Validation PASSED (${duration}ms)`);
|
|
468
|
+
console.log(`[ValidationOrchestrator] Proof saved to: ${this.proofPath}`);
|
|
469
469
|
} catch (error) {
|
|
470
|
-
|
|
470
|
+
console.error(`[ValidationOrchestrator] Failed to generate proof: ${error.message}`);
|
|
471
471
|
results.success = false;
|
|
472
472
|
results.errors.push(`Proof generation failed: ${error.message}`);
|
|
473
473
|
}
|
|
474
474
|
} else {
|
|
475
|
-
|
|
476
|
-
|
|
475
|
+
console.error(`[ValidationOrchestrator] ❌ Validation FAILED (${duration}ms)`);
|
|
476
|
+
console.error(`[ValidationOrchestrator] Errors: ${results.errors.join(', ')}`);
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
return results;
|
|
@@ -496,7 +496,7 @@ class ValidationOrchestrator {
|
|
|
496
496
|
// Save proof
|
|
497
497
|
fs.writeFileSync(this.proofPath, JSON.stringify(proof, null, 2));
|
|
498
498
|
|
|
499
|
-
|
|
499
|
+
console.log(`[ValidationOrchestrator] Proof saved: ${this.proofPath}`);
|
|
500
500
|
} catch (error) {
|
|
501
501
|
throw new Error(`Failed to save proof: ${error.message}`);
|
|
502
502
|
}
|