vibecodingmachine-core 2026.2.20-438 → 2026.2.26-1739
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/README.md +240 -0
- package/package.json +10 -2
- package/src/agents/Agent.js +300 -0
- package/src/agents/AgentAdditionService.js +311 -0
- package/src/agents/AgentCheckService.js +690 -0
- package/src/agents/AgentInstallationService.js +140 -0
- package/src/agents/AgentSetupService.js +467 -0
- package/src/agents/AgentStatus.js +183 -0
- package/src/agents/AgentVerificationService.js +634 -0
- package/src/agents/ConfigurationSchemaValidator.js +543 -0
- package/src/agents/EnvironmentConfigurationManager.js +602 -0
- package/src/agents/InstallationErrorHandler.js +372 -0
- package/src/agents/InstallationLog.js +363 -0
- package/src/agents/InstallationMethod.js +510 -0
- package/src/agents/InstallationOrchestrator.js +352 -0
- package/src/agents/InstallationProgressReporter.js +372 -0
- package/src/agents/InstallationRetryManager.js +322 -0
- package/src/agents/InstallationType.js +254 -0
- package/src/agents/OperationTypes.js +310 -0
- package/src/agents/PerformanceMetricsCollector.js +493 -0
- package/src/agents/SecurityValidationService.js +534 -0
- package/src/agents/VerificationTest.js +354 -0
- package/src/agents/VerificationType.js +226 -0
- package/src/agents/WindowsPermissionHandler.js +518 -0
- package/src/agents/config/AgentConfigManager.js +393 -0
- package/src/agents/config/AgentDefaultsRegistry.js +373 -0
- package/src/agents/config/ConfigValidator.js +281 -0
- package/src/agents/discovery/AgentDiscoveryService.js +707 -0
- package/src/agents/logging/AgentLogger.js +511 -0
- package/src/agents/status/AgentStatusManager.js +481 -0
- package/src/agents/storage/FileManager.js +454 -0
- package/src/agents/verification/AgentCommunicationTester.js +474 -0
- package/src/agents/verification/BaseVerifier.js +430 -0
- package/src/agents/verification/CommandVerifier.js +480 -0
- package/src/agents/verification/FileOperationVerifier.js +453 -0
- package/src/agents/verification/ResultAnalyzer.js +707 -0
- package/src/agents/verification/TestRequirementManager.js +495 -0
- package/src/agents/verification/VerificationRunner.js +433 -0
- package/src/agents/windows/BaseWindowsInstaller.js +441 -0
- package/src/agents/windows/ChocolateyInstaller.js +509 -0
- package/src/agents/windows/DirectInstaller.js +443 -0
- package/src/agents/windows/InstallerFactory.js +391 -0
- package/src/agents/windows/NpmInstaller.js +505 -0
- package/src/agents/windows/PowerShellInstaller.js +458 -0
- package/src/agents/windows/WinGetInstaller.js +390 -0
- package/src/analysis/analysis-reporter.js +132 -0
- package/src/analysis/boundary-detector.js +712 -0
- package/src/analysis/categorizer.js +340 -0
- package/src/analysis/codebase-scanner.js +384 -0
- package/src/analysis/line-counter.js +513 -0
- package/src/analysis/priority-calculator.js +679 -0
- package/src/analysis/report/analysis-report.js +250 -0
- package/src/analysis/report/package-analyzer.js +278 -0
- package/src/analysis/report/recommendation-generator.js +382 -0
- package/src/analysis/report/statistics-generator.js +515 -0
- package/src/analysis/reports/analysis-report-model.js +101 -0
- package/src/analysis/reports/recommendation-generator.js +283 -0
- package/src/analysis/reports/report-generators.js +191 -0
- package/src/analysis/reports/statistics-calculator.js +231 -0
- package/src/analysis/reports/trend-analyzer.js +219 -0
- package/src/analysis/strategy-generator.js +814 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +836 -0
- package/src/config/refactoring-config.js +307 -0
- package/src/health-tracking/json-storage.js +38 -2
- package/src/ide-integration/applescript-manager-core.js +233 -0
- package/src/ide-integration/applescript-manager.cjs +357 -28
- package/src/ide-integration/applescript-manager.js +89 -3599
- package/src/ide-integration/cdp-manager.js +306 -0
- package/src/ide-integration/claude-code-cli-manager.cjs +1 -1
- package/src/ide-integration/continuation-handler.js +337 -0
- package/src/ide-integration/ide-status-checker.js +292 -0
- package/src/ide-integration/macos-ide-manager.js +627 -0
- package/src/ide-integration/macos-text-sender.js +528 -0
- package/src/ide-integration/response-reader.js +548 -0
- package/src/ide-integration/windows-automation-manager.js +121 -0
- package/src/ide-integration/windows-ide-manager.js +373 -0
- package/src/index.cjs +25 -3
- package/src/index.js +15 -1
- package/src/llm/direct-llm-manager.cjs +90 -2
- package/src/models/compliance-report.js +538 -0
- package/src/models/file-analysis.js +681 -0
- package/src/models/refactoring-plan.js +770 -0
- package/src/monitoring/alert-system.js +834 -0
- package/src/monitoring/compliance-progress-tracker.js +437 -0
- package/src/monitoring/continuous-scan-notifications.js +661 -0
- package/src/monitoring/continuous-scanner.js +279 -0
- package/src/monitoring/file-monitor/file-analyzer.js +262 -0
- package/src/monitoring/file-monitor/file-monitor.js +237 -0
- package/src/monitoring/file-monitor/watcher.js +194 -0
- package/src/monitoring/file-monitor.js +17 -0
- package/src/monitoring/notification-manager.js +437 -0
- package/src/monitoring/scanner-core.js +368 -0
- package/src/monitoring/scanner-events.js +214 -0
- package/src/monitoring/violation-notification-system.js +515 -0
- package/src/refactoring/boundaries/cohesion-analyzer.js +316 -0
- package/src/refactoring/boundaries/extraction-result.js +285 -0
- package/src/refactoring/boundaries/extraction-strategies.js +392 -0
- package/src/refactoring/boundaries/module-boundary.js +209 -0
- package/src/refactoring/boundary/boundary-detector.js +741 -0
- package/src/refactoring/boundary/boundary-types.js +405 -0
- package/src/refactoring/boundary/extraction-strategies.js +554 -0
- package/src/refactoring/boundary-extraction-result.js +77 -0
- package/src/refactoring/boundary-extraction-strategies.js +330 -0
- package/src/refactoring/boundary-extractor.js +384 -0
- package/src/refactoring/boundary-types.js +46 -0
- package/src/refactoring/circular/circular-dependency.js +88 -0
- package/src/refactoring/circular/cycle-detection.js +147 -0
- package/src/refactoring/circular/dependency-node.js +82 -0
- package/src/refactoring/circular/dependency-result.js +107 -0
- package/src/refactoring/circular/dependency-types.js +58 -0
- package/src/refactoring/circular/graph-builder.js +213 -0
- package/src/refactoring/circular/resolution-strategy.js +72 -0
- package/src/refactoring/circular/strategy-generator.js +229 -0
- package/src/refactoring/circular-dependency-resolver-original.js +809 -0
- package/src/refactoring/circular-dependency-resolver.js +200 -0
- package/src/refactoring/code-mover.js +761 -0
- package/src/refactoring/file-splitter.js +696 -0
- package/src/refactoring/functionality-validator.js +816 -0
- package/src/refactoring/import-manager.js +774 -0
- package/src/refactoring/module-boundary.js +107 -0
- package/src/refactoring/refactoring-executor.js +672 -0
- package/src/refactoring/refactoring-rollback.js +614 -0
- package/src/refactoring/test-validator.js +631 -0
- package/src/requirement-management/default-requirement-manager.js +321 -0
- package/src/requirement-management/requirement-file-parser.js +159 -0
- package/src/requirement-management/requirement-sequencer.js +221 -0
- package/src/rui/commands/AgentCommandParser.js +600 -0
- package/src/rui/commands/AgentCommands.js +487 -0
- package/src/rui/commands/AgentResponseFormatter.js +832 -0
- package/src/scripts/verify-full-compliance.js +269 -0
- package/src/sync/sync-engine-core.js +1 -0
- package/src/sync/sync-engine-remote-handlers.js +135 -0
- package/src/task-generation/automated-task-generator.js +351 -0
- package/src/task-generation/prioritizer.js +287 -0
- package/src/task-generation/task-list-updater.js +215 -0
- package/src/task-generation/task-management-integration.js +480 -0
- package/src/task-generation/task-manager-integration.js +270 -0
- package/src/task-generation/violation-task-generator.js +474 -0
- package/src/task-management/continuous-scan-integration.js +342 -0
- package/src/timeout-management/index.js +12 -3
- package/src/timeout-management/response-time-tracker.js +167 -0
- package/src/timeout-management/timeout-calculator.js +159 -0
- package/src/timeout-management/timeout-config-manager.js +172 -0
- package/src/utils/ast-analyzer.js +417 -0
- package/src/utils/current-requirement-manager.js +276 -0
- package/src/utils/current-requirement-operations.js +472 -0
- package/src/utils/dependency-mapper.js +456 -0
- package/src/utils/download-with-progress.js +4 -2
- package/src/utils/electron-update-checker.js +4 -1
- package/src/utils/file-size-analyzer.js +272 -0
- package/src/utils/import-updater.js +280 -0
- package/src/utils/refactoring-tools.js +512 -0
- package/src/utils/report-generator.js +569 -0
- package/src/utils/reports/report-analysis.js +218 -0
- package/src/utils/reports/report-types.js +55 -0
- package/src/utils/reports/summary-generators.js +102 -0
- package/src/utils/requirement-file-management.js +157 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +392 -0
- package/src/utils/requirement-helpers/requirement-mover.js +414 -0
- package/src/utils/requirement-helpers/requirement-parser.js +326 -0
- package/src/utils/requirement-helpers/requirement-status.js +320 -0
- package/src/utils/requirement-helpers-new.js +55 -0
- package/src/utils/requirement-helpers-refactored.js +367 -0
- package/src/utils/requirement-helpers.js +291 -1191
- package/src/utils/requirement-movement-operations.js +450 -0
- package/src/utils/requirement-movement.js +312 -0
- package/src/utils/requirement-parsing-helpers.js +56 -0
- package/src/utils/requirement-statistics.js +200 -0
- package/src/utils/requirement-text-utils.js +58 -0
- package/src/utils/rollback/rollback-handlers.js +125 -0
- package/src/utils/rollback/rollback-operation.js +63 -0
- package/src/utils/rollback/rollback-recorder.js +166 -0
- package/src/utils/rollback/rollback-state-manager.js +175 -0
- package/src/utils/rollback/rollback-types.js +33 -0
- package/src/utils/rollback/rollback-utils.js +110 -0
- package/src/utils/rollback-manager-original.js +569 -0
- package/src/utils/rollback-manager.js +202 -0
- package/src/utils/smoke-test-cli.js +362 -0
- package/src/utils/smoke-test-gui.js +351 -0
- package/src/utils/smoke-test-orchestrator.js +321 -0
- package/src/utils/smoke-test-runner.js +60 -0
- package/src/utils/smoke-test-web.js +347 -0
- package/src/utils/specification-helpers.js +39 -13
- package/src/utils/specification-migration.js +97 -0
- package/src/utils/test-runner.js +579 -0
- package/src/utils/validation-framework.js +518 -0
- package/src/validation/compliance-analyzer.js +197 -0
- package/src/validation/compliance-report-generator.js +343 -0
- package/src/validation/compliance-reporter.js +711 -0
- package/src/validation/compliance-rules.js +127 -0
- package/src/validation/constitution-validator-new.js +196 -0
- package/src/validation/constitution-validator.js +17 -0
- package/src/validation/file-validators.js +170 -0
- package/src/validation/line-limit/file-analyzer.js +201 -0
- package/src/validation/line-limit/line-limit-validator.js +208 -0
- package/src/validation/line-limit/validation-result.js +144 -0
- package/src/validation/line-limit-core.js +225 -0
- package/src/validation/line-limit-reporter.js +134 -0
- package/src/validation/line-limit-result.js +125 -0
- package/src/validation/line-limit-validator.js +41 -0
- package/src/validation/metrics-calculator.js +660 -0
- package/src/sync/sync-engine-backup.js +0 -559
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification Test Runner
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates multiple verification tests.
|
|
5
|
+
* Follows constitutional requirements: <555 lines, test-first approach.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const BaseVerifier = require('./BaseVerifier');
|
|
9
|
+
const FileOperationVerifier = require('./FileOperationVerifier');
|
|
10
|
+
const CommandVerifier = require('./CommandVerifier');
|
|
11
|
+
const { VerificationType } = require('../VerificationType');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Verification test runner class
|
|
15
|
+
*/
|
|
16
|
+
class VerificationRunner {
|
|
17
|
+
/**
|
|
18
|
+
* Create verification runner instance
|
|
19
|
+
* @param {Object} config - Runner configuration
|
|
20
|
+
*/
|
|
21
|
+
constructor(config = {}) {
|
|
22
|
+
this.logger = config.logger || null;
|
|
23
|
+
this.parallel = config.parallel !== false; // Default to parallel
|
|
24
|
+
this.maxConcurrency = config.maxConcurrency || 3;
|
|
25
|
+
this.timeout = config.timeout || 300000; // 5 minutes default
|
|
26
|
+
this.continueOnFailure = config.continueOnFailure !== false; // Default to continue
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Run verification tests for an agent
|
|
31
|
+
* @param {Object} agent - Agent configuration
|
|
32
|
+
* @param {Array<Object>} testConfigs - Test configurations
|
|
33
|
+
* @returns {Promise<Object>} - Verification results
|
|
34
|
+
*/
|
|
35
|
+
async runVerificationTests(agent, testConfigs) {
|
|
36
|
+
if (this.logger) {
|
|
37
|
+
await this.logger.info('Starting verification tests', {
|
|
38
|
+
agentId: agent.id,
|
|
39
|
+
testCount: testConfigs.length,
|
|
40
|
+
parallel: this.parallel
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
const results = {
|
|
46
|
+
agentId: agent.id,
|
|
47
|
+
totalTests: testConfigs.length,
|
|
48
|
+
passed: 0,
|
|
49
|
+
failed: 0,
|
|
50
|
+
skipped: 0,
|
|
51
|
+
duration: 0,
|
|
52
|
+
tests: [],
|
|
53
|
+
summary: {
|
|
54
|
+
allPassed: false,
|
|
55
|
+
hasFailures: false,
|
|
56
|
+
hasSkipped: false
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
if (this.parallel) {
|
|
62
|
+
// Run tests in parallel with concurrency limit
|
|
63
|
+
const batches = this.createBatches(testConfigs, this.maxConcurrency);
|
|
64
|
+
|
|
65
|
+
for (const batch of batches) {
|
|
66
|
+
const batchResults = await this.runBatchInParallel(batch, agent);
|
|
67
|
+
this.mergeResults(results, batchResults);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
// Run tests sequentially
|
|
71
|
+
for (const testConfig of testConfigs) {
|
|
72
|
+
const result = await this.runSingleTest(testConfig, agent);
|
|
73
|
+
this.addResult(results, result);
|
|
74
|
+
|
|
75
|
+
// Stop if test failed and continueOnFailure is false
|
|
76
|
+
if (!result.passed && !this.continueOnFailure) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (this.logger) {
|
|
83
|
+
await this.logger.error('Verification runner error', {
|
|
84
|
+
agentId: agent.id,
|
|
85
|
+
error: error.message
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Add error as a failed test
|
|
90
|
+
const errorResult = {
|
|
91
|
+
id: this.generateId(),
|
|
92
|
+
agentId: agent.id,
|
|
93
|
+
type: 'RUNNER_ERROR',
|
|
94
|
+
description: 'Verification runner error',
|
|
95
|
+
passed: false,
|
|
96
|
+
error: error.message,
|
|
97
|
+
duration: Date.now() - startTime,
|
|
98
|
+
timestamp: new Date().toISOString()
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
this.addResult(results, errorResult);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
results.duration = Date.now() - startTime;
|
|
105
|
+
this.calculateSummary(results);
|
|
106
|
+
|
|
107
|
+
if (this.logger) {
|
|
108
|
+
await this.logger.info('Verification tests completed', {
|
|
109
|
+
agentId: agent.id,
|
|
110
|
+
totalTests: results.totalTests,
|
|
111
|
+
passed: results.passed,
|
|
112
|
+
failed: results.failed,
|
|
113
|
+
skipped: results.skipped,
|
|
114
|
+
duration: results.duration,
|
|
115
|
+
allPassed: results.summary.allPassed
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return results;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Run a batch of tests in parallel
|
|
124
|
+
* @param {Array<Object>} batch - Batch of test configurations
|
|
125
|
+
* @param {Object} agent - Agent configuration
|
|
126
|
+
* @returns {Promise<Array<Object>>} - Batch results
|
|
127
|
+
*/
|
|
128
|
+
async runBatchInParallel(batch, agent) {
|
|
129
|
+
const promises = batch.map(testConfig =>
|
|
130
|
+
this.runSingleTest(testConfig, agent)
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return Promise.allSettled(promises);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Run a single verification test
|
|
138
|
+
* @param {Object} testConfig - Test configuration
|
|
139
|
+
* @param {Object} agent - Agent configuration
|
|
140
|
+
* @returns {Promise<Object>} - Test result
|
|
141
|
+
*/
|
|
142
|
+
async runSingleTest(testConfig, agent) {
|
|
143
|
+
try {
|
|
144
|
+
const verifier = this.createVerifier(testConfig);
|
|
145
|
+
const context = { agentId: agent.id, agentCommand: agent.verificationCommands?.[0] };
|
|
146
|
+
|
|
147
|
+
const result = await verifier.verify({ context });
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
...result,
|
|
151
|
+
testConfig,
|
|
152
|
+
verifierType: testConfig.type
|
|
153
|
+
};
|
|
154
|
+
} catch (error) {
|
|
155
|
+
return {
|
|
156
|
+
id: this.generateId(),
|
|
157
|
+
agentId: agent.id,
|
|
158
|
+
type: testConfig.type || 'UNKNOWN',
|
|
159
|
+
description: testConfig.description || 'Unknown test',
|
|
160
|
+
passed: false,
|
|
161
|
+
error: error.message,
|
|
162
|
+
duration: 0,
|
|
163
|
+
timestamp: new Date().toISOString(),
|
|
164
|
+
testConfig,
|
|
165
|
+
verifierType: testConfig.type
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Create verifier instance based on configuration
|
|
172
|
+
* @param {Object} testConfig - Test configuration
|
|
173
|
+
* @returns {BaseVerifier} - Verifier instance
|
|
174
|
+
*/
|
|
175
|
+
createVerifier(testConfig) {
|
|
176
|
+
switch (testConfig.type) {
|
|
177
|
+
case VerificationType.FILE_OPERATION:
|
|
178
|
+
return FileOperationVerifier.fromConfig(testConfig, this.logger);
|
|
179
|
+
|
|
180
|
+
case VerificationType.COMMAND_EXECUTION:
|
|
181
|
+
return CommandVerifier.fromConfig(testConfig, this.logger);
|
|
182
|
+
|
|
183
|
+
case VerificationType.API_CALL:
|
|
184
|
+
// TODO: Implement ApiCallVerifier
|
|
185
|
+
throw new Error('ApiCallVerifier not yet implemented');
|
|
186
|
+
|
|
187
|
+
case VerificationType.NETWORK_TEST:
|
|
188
|
+
// TODO: Implement NetworkVerifier
|
|
189
|
+
throw new Error('NetworkVerifier not yet implemented');
|
|
190
|
+
|
|
191
|
+
default:
|
|
192
|
+
throw new Error(`Unknown verification type: ${testConfig.type}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Create batches for parallel execution
|
|
198
|
+
* @param {Array<Object>} items - Items to batch
|
|
199
|
+
* @param {number} batchSize - Maximum batch size
|
|
200
|
+
* @returns {Array<Array<Object>>} - Array of batches
|
|
201
|
+
*/
|
|
202
|
+
createBatches(items, batchSize) {
|
|
203
|
+
const batches = [];
|
|
204
|
+
|
|
205
|
+
for (let i = 0; i < items.length; i += batchSize) {
|
|
206
|
+
batches.push(items.slice(i, i + batchSize));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return batches;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Add result to results collection
|
|
214
|
+
* @param {Object} results - Results collection
|
|
215
|
+
* @param {Object} result - New result to add
|
|
216
|
+
*/
|
|
217
|
+
addResult(results, result) {
|
|
218
|
+
results.tests.push(result);
|
|
219
|
+
|
|
220
|
+
if (result.passed) {
|
|
221
|
+
results.passed++;
|
|
222
|
+
} else {
|
|
223
|
+
results.failed++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Merge batch results into main results
|
|
229
|
+
* @param {Object} results - Main results
|
|
230
|
+
* @param {Array<Object>} batchResults - Batch results
|
|
231
|
+
*/
|
|
232
|
+
mergeResults(results, batchResults) {
|
|
233
|
+
for (const batchResult of batchResults) {
|
|
234
|
+
if (batchResult.status === 'fulfilled') {
|
|
235
|
+
this.addResult(results, batchResult.value);
|
|
236
|
+
} else {
|
|
237
|
+
// Handle rejected promise
|
|
238
|
+
const errorResult = {
|
|
239
|
+
id: this.generateId(),
|
|
240
|
+
agentId: results.agentId,
|
|
241
|
+
type: 'PROMISE_REJECTED',
|
|
242
|
+
description: 'Test execution promise rejected',
|
|
243
|
+
passed: false,
|
|
244
|
+
error: batchResult.reason?.message || 'Unknown error',
|
|
245
|
+
duration: 0,
|
|
246
|
+
timestamp: new Date().toISOString()
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
this.addResult(results, errorResult);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Calculate summary statistics
|
|
256
|
+
* @param {Object} results - Results collection
|
|
257
|
+
*/
|
|
258
|
+
calculateSummary(results) {
|
|
259
|
+
results.summary = {
|
|
260
|
+
allPassed: results.failed === 0 && results.passed === results.totalTests,
|
|
261
|
+
hasFailures: results.failed > 0,
|
|
262
|
+
hasSkipped: results.skipped > 0,
|
|
263
|
+
passRate: results.totalTests > 0 ? (results.passed / results.totalTests) * 100 : 0,
|
|
264
|
+
failureRate: results.totalTests > 0 ? (results.failed / results.totalTests) * 100 : 0
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Generate unique test ID
|
|
270
|
+
* @returns {string} - Unique identifier
|
|
271
|
+
*/
|
|
272
|
+
generateId() {
|
|
273
|
+
const timestamp = Date.now();
|
|
274
|
+
const random = Math.random().toString(36).substr(2, 9);
|
|
275
|
+
return `verify-${timestamp}-${random}`;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Run verification tests with timeout protection
|
|
280
|
+
* @param {Object} agent - Agent configuration
|
|
281
|
+
* @param {Array<Object>} testConfigs - Test configurations
|
|
282
|
+
* @param {number} timeout - Overall timeout in milliseconds
|
|
283
|
+
* @returns {Promise<Object>} - Verification results with timeout handling
|
|
284
|
+
*/
|
|
285
|
+
async runVerificationTestsWithTimeout(agent, testConfigs, timeout = this.timeout) {
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
const timeoutId = setTimeout(() => {
|
|
288
|
+
reject(new Error(`Verification tests timed out after ${timeout}ms`));
|
|
289
|
+
}, timeout);
|
|
290
|
+
|
|
291
|
+
this.runVerificationTests(agent, testConfigs)
|
|
292
|
+
.then(results => {
|
|
293
|
+
clearTimeout(timeoutId);
|
|
294
|
+
resolve(results);
|
|
295
|
+
})
|
|
296
|
+
.catch(error => {
|
|
297
|
+
clearTimeout(timeoutId);
|
|
298
|
+
reject(error);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Get test execution statistics
|
|
305
|
+
* @param {Array<Object>} results - Test results
|
|
306
|
+
* @returns {Object} - Statistics
|
|
307
|
+
*/
|
|
308
|
+
getTestStatistics(results) {
|
|
309
|
+
const stats = {
|
|
310
|
+
totalTests: results.length,
|
|
311
|
+
passedTests: results.filter(r => r.passed).length,
|
|
312
|
+
failedTests: results.filter(r => !r.passed).length,
|
|
313
|
+
averageDuration: 0,
|
|
314
|
+
minDuration: Infinity,
|
|
315
|
+
maxDuration: 0,
|
|
316
|
+
testTypes: {},
|
|
317
|
+
errorTypes: {}
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
// Calculate duration statistics
|
|
321
|
+
const durations = results
|
|
322
|
+
.filter(r => r.duration > 0)
|
|
323
|
+
.map(r => r.duration);
|
|
324
|
+
|
|
325
|
+
if (durations.length > 0) {
|
|
326
|
+
stats.averageDuration = durations.reduce((a, b) => a + b, 0) / durations.length;
|
|
327
|
+
stats.minDuration = Math.min(...durations);
|
|
328
|
+
stats.maxDuration = Math.max(...durations);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Count test types
|
|
332
|
+
for (const result of results) {
|
|
333
|
+
stats.testTypes[result.type] = (stats.testTypes[result.type] || 0) + 1;
|
|
334
|
+
|
|
335
|
+
if (result.error) {
|
|
336
|
+
const errorType = result.error.split(':')[0] || 'UNKNOWN';
|
|
337
|
+
stats.errorTypes[errorType] = (stats.errorTypes[errorType] || 0) + 1;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return stats;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Filter tests by type
|
|
346
|
+
* @param {Array<Object>} tests - Test results
|
|
347
|
+
* @param {string} type - Test type to filter by
|
|
348
|
+
* @returns {Array<Object>} - Filtered tests
|
|
349
|
+
*/
|
|
350
|
+
filterTestsByType(tests, type) {
|
|
351
|
+
return tests.filter(test => test.type === type);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Get failed tests
|
|
356
|
+
* @param {Array<Object>} tests - Test results
|
|
357
|
+
* @returns {Array<Object>} - Failed tests
|
|
358
|
+
*/
|
|
359
|
+
getFailedTests(tests) {
|
|
360
|
+
return tests.filter(test => !test.passed);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Get passed tests
|
|
365
|
+
* @param {Array<Object>} tests - Test results
|
|
366
|
+
* @returns {Array<Object>} - Passed tests
|
|
367
|
+
*/
|
|
368
|
+
getPassedTests(tests) {
|
|
369
|
+
return tests.filter(test => test.passed);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Create verification runner with default configuration
|
|
374
|
+
* @param {Object} config - Configuration overrides
|
|
375
|
+
* @returns {VerificationRunner} - Runner instance
|
|
376
|
+
*/
|
|
377
|
+
static createDefault(config = {}) {
|
|
378
|
+
return new VerificationRunner({
|
|
379
|
+
parallel: true,
|
|
380
|
+
maxConcurrency: 3,
|
|
381
|
+
timeout: 300000,
|
|
382
|
+
continueOnFailure: true,
|
|
383
|
+
...config
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Create verification runner for sequential execution
|
|
389
|
+
* @param {Object} config - Configuration overrides
|
|
390
|
+
* @returns {VerificationRunner} - Sequential runner instance
|
|
391
|
+
*/
|
|
392
|
+
static createSequential(config = {}) {
|
|
393
|
+
return new VerificationRunner({
|
|
394
|
+
parallel: false,
|
|
395
|
+
maxConcurrency: 1,
|
|
396
|
+
timeout: 600000, // Longer timeout for sequential
|
|
397
|
+
continueOnFailure: false,
|
|
398
|
+
...config
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Get runner information
|
|
404
|
+
* @returns {Object} - Runner info
|
|
405
|
+
*/
|
|
406
|
+
getRunnerInfo() {
|
|
407
|
+
return {
|
|
408
|
+
parallel: this.parallel,
|
|
409
|
+
maxConcurrency: this.maxConcurrency,
|
|
410
|
+
timeout: this.timeout,
|
|
411
|
+
continueOnFailure: this.continueOnFailure,
|
|
412
|
+
supportedTestTypes: [
|
|
413
|
+
VerificationType.FILE_OPERATION,
|
|
414
|
+
VerificationType.COMMAND_EXECUTION
|
|
415
|
+
// TODO: Add API_CALL and NETWORK_TEST when implemented
|
|
416
|
+
],
|
|
417
|
+
features: [
|
|
418
|
+
'parallel execution',
|
|
419
|
+
'timeout protection',
|
|
420
|
+
'batch processing',
|
|
421
|
+
'error handling',
|
|
422
|
+
'statistics collection'
|
|
423
|
+
],
|
|
424
|
+
limitations: [
|
|
425
|
+
'limited to implemented verifiers',
|
|
426
|
+
'memory usage with parallel tests',
|
|
427
|
+
'timeout affects all tests'
|
|
428
|
+
]
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
module.exports = VerificationRunner;
|