agentic-qe 3.8.4 → 3.8.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.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/cli/bundle.js +694 -694
- package/dist/cli/commands/hooks-handlers/command-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/command-hooks.js +253 -0
- package/dist/cli/commands/hooks-handlers/editing-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/editing-hooks.js +161 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.d.ts +57 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +263 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +52 -0
- package/dist/cli/commands/hooks-handlers/hooks-shared.js +223 -0
- package/dist/cli/commands/hooks-handlers/routing-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/routing-hooks.js +107 -0
- package/dist/cli/commands/hooks-handlers/session-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/session-hooks.js +171 -0
- package/dist/cli/commands/hooks-handlers/stats-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/stats-hooks.js +248 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.d.ts +12 -0
- package/dist/cli/commands/hooks-handlers/task-hooks.js +152 -0
- package/dist/cli/commands/hooks.d.ts +3 -23
- package/dist/cli/commands/hooks.js +16 -1459
- package/dist/coordination/mincut/phase-executor.d.ts +27 -0
- package/dist/coordination/mincut/phase-executor.js +70 -0
- package/dist/coordination/mincut/time-crystal-analysis.d.ts +35 -0
- package/dist/coordination/mincut/time-crystal-analysis.js +237 -0
- package/dist/coordination/mincut/time-crystal-persistence.d.ts +35 -0
- package/dist/coordination/mincut/time-crystal-persistence.js +81 -0
- package/dist/coordination/mincut/time-crystal-scheduling.d.ts +34 -0
- package/dist/coordination/mincut/time-crystal-scheduling.js +213 -0
- package/dist/coordination/mincut/time-crystal-types.d.ts +278 -0
- package/dist/coordination/mincut/time-crystal-types.js +67 -0
- package/dist/coordination/mincut/time-crystal.d.ts +8 -438
- package/dist/coordination/mincut/time-crystal.js +87 -905
- package/dist/domains/base-domain-coordinator.d.ts +0 -15
- package/dist/domains/base-domain-coordinator.js +7 -5
- package/dist/domains/chaos-resilience/coordinator.d.ts +0 -4
- package/dist/domains/chaos-resilience/coordinator.js +24 -22
- package/dist/domains/chaos-resilience/services/chaos-engineer.d.ts +0 -4
- package/dist/domains/chaos-resilience/services/chaos-engineer.js +47 -45
- package/dist/domains/chaos-resilience/services/performance-profiler.d.ts +0 -4
- package/dist/domains/chaos-resilience/services/performance-profiler.js +10 -8
- package/dist/domains/code-intelligence/coordinator-consensus.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-consensus.js +8 -6
- package/dist/domains/code-intelligence/coordinator-gnn.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-gnn.js +8 -6
- package/dist/domains/code-intelligence/coordinator-hypergraph.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator-hypergraph.js +13 -11
- package/dist/domains/code-intelligence/coordinator.d.ts +0 -3
- package/dist/domains/code-intelligence/coordinator.js +21 -19
- package/dist/domains/code-intelligence/services/c4-model/index.d.ts +0 -3
- package/dist/domains/code-intelligence/services/c4-model/index.js +5 -3
- package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +0 -6
- package/dist/domains/code-intelligence/services/knowledge-graph.js +4 -2
- package/dist/domains/code-intelligence/services/product-factors-bridge.d.ts +0 -5
- package/dist/domains/code-intelligence/services/product-factors-bridge.js +9 -7
- package/dist/domains/contract-testing/coordinator.d.ts +0 -6
- package/dist/domains/contract-testing/coordinator.js +25 -23
- package/dist/domains/contract-testing/services/contract-validator.d.ts +0 -4
- package/dist/domains/contract-testing/services/contract-validator.js +4 -2
- package/dist/domains/contract-testing/services/schema-validator.js +1 -1
- package/dist/domains/coverage-analysis/coordinator.js +13 -11
- package/dist/domains/coverage-analysis/services/coverage-analyzer.js +4 -2
- package/dist/domains/coverage-analysis/services/gap-detector.js +3 -1
- package/dist/domains/coverage-analysis/services/hnsw-index.d.ts +0 -15
- package/dist/domains/coverage-analysis/services/hnsw-index.js +3 -1
- package/dist/domains/coverage-analysis/services/sublinear-analyzer.d.ts +0 -26
- package/dist/domains/coverage-analysis/services/sublinear-analyzer.js +3 -1
- package/dist/domains/defect-intelligence/coordinator.d.ts +1 -10
- package/dist/domains/defect-intelligence/coordinator.js +5 -3
- package/dist/domains/defect-intelligence/services/causal-root-cause-analyzer.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/causal-root-cause-analyzer.js +3 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/defect-predictor.js +5 -3
- package/dist/domains/defect-intelligence/services/pattern-learner.d.ts +0 -4
- package/dist/domains/defect-intelligence/services/pattern-learner.js +3 -1
- package/dist/domains/defect-intelligence/services/root-cause-analyzer.d.ts +0 -6
- package/dist/domains/defect-intelligence/services/root-cause-analyzer.js +3 -1
- package/dist/domains/enterprise-integration/coordinator.js +6 -4
- package/dist/domains/learning-optimization/coordinator-consensus.d.ts +0 -3
- package/dist/domains/learning-optimization/coordinator-consensus.js +8 -6
- package/dist/domains/learning-optimization/coordinator.d.ts +0 -3
- package/dist/domains/learning-optimization/coordinator.js +15 -13
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +0 -4
- package/dist/domains/learning-optimization/services/learning-coordinator.js +4 -2
- package/dist/domains/quality-assessment/coordinator-claim-verifier.d.ts +0 -3
- package/dist/domains/quality-assessment/coordinator-claim-verifier.js +6 -4
- package/dist/domains/quality-assessment/coordinator-gate-evaluation.d.ts +0 -4
- package/dist/domains/quality-assessment/coordinator-gate-evaluation.js +9 -7
- package/dist/domains/quality-assessment/coordinator-rl-integration.d.ts +0 -3
- package/dist/domains/quality-assessment/coordinator-rl-integration.js +10 -8
- package/dist/domains/quality-assessment/coordinator.d.ts +0 -15
- package/dist/domains/quality-assessment/coordinator.js +14 -12
- package/dist/domains/quality-assessment/services/deployment-advisor.d.ts +0 -10
- package/dist/domains/quality-assessment/services/deployment-advisor.js +4 -2
- package/dist/domains/quality-assessment/services/quality-analyzer.d.ts +0 -6
- package/dist/domains/quality-assessment/services/quality-analyzer.js +4 -2
- package/dist/domains/requirements-validation/coordinator.d.ts +0 -3
- package/dist/domains/requirements-validation/coordinator.js +15 -13
- package/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.d.ts +0 -5
- package/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js +15 -13
- package/dist/domains/requirements-validation/services/product-factors-assessment/product-factors-service.d.ts +0 -6
- package/dist/domains/requirements-validation/services/product-factors-assessment/product-factors-service.js +9 -7
- package/dist/domains/requirements-validation/services/requirements-validator.d.ts +0 -6
- package/dist/domains/requirements-validation/services/requirements-validator.js +4 -2
- package/dist/domains/security-compliance/coordinator.js +24 -22
- package/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +0 -21
- package/dist/domains/security-compliance/services/scanners/dast-scanner.js +4 -2
- package/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts +0 -4
- package/dist/domains/security-compliance/services/scanners/sast-scanner.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-dast.d.ts +0 -4
- package/dist/domains/security-compliance/services/security-auditor-dast.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-sast.d.ts +0 -3
- package/dist/domains/security-compliance/services/security-auditor-sast.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor-secrets.d.ts +0 -3
- package/dist/domains/security-compliance/services/security-auditor-secrets.js +3 -1
- package/dist/domains/security-compliance/services/security-auditor.js +11 -9
- package/dist/domains/test-execution/coordinator.js +11 -9
- package/dist/domains/test-execution/services/auth-state-manager.d.ts +0 -3
- package/dist/domains/test-execution/services/auth-state-manager.js +4 -2
- package/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts +0 -14
- package/dist/domains/test-execution/services/e2e/e2e-coordinator.js +3 -1
- package/dist/domains/test-execution/services/flaky-detector.js +4 -2
- package/dist/domains/test-execution/services/retry-handler.js +3 -1
- package/dist/domains/test-execution/services/test-executor.js +3 -1
- package/dist/domains/test-generation/coordinator.d.ts +0 -17
- package/dist/domains/test-generation/coordinator.js +33 -31
- package/dist/domains/test-generation/pattern-injection/edge-case-injector.d.ts +0 -5
- package/dist/domains/test-generation/pattern-injection/edge-case-injector.js +3 -1
- package/dist/domains/test-generation/services/code-transform-integration.d.ts +0 -7
- package/dist/domains/test-generation/services/code-transform-integration.js +3 -1
- package/dist/domains/test-generation/services/coherence-gate-service.d.ts +0 -3
- package/dist/domains/test-generation/services/coherence-gate-service.js +3 -1
- package/dist/domains/test-generation/services/test-generator.d.ts +0 -8
- package/dist/domains/test-generation/services/test-generator.js +5 -3
- package/dist/domains/visual-accessibility/coordinator.d.ts +0 -3
- package/dist/domains/visual-accessibility/coordinator.js +14 -12
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.d.ts +0 -3
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.js +52 -50
- package/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/accessibility-tester.js +8 -6
- package/dist/domains/visual-accessibility/services/axe-core-integration.d.ts +0 -3
- package/dist/domains/visual-accessibility/services/axe-core-integration.js +20 -18
- package/dist/domains/visual-accessibility/services/browser-security-scanner.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/browser-security-scanner.js +6 -4
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.d.ts +0 -30
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.js +5 -3
- package/dist/domains/visual-accessibility/services/viewport-capture.d.ts +0 -27
- package/dist/domains/visual-accessibility/services/viewport-capture.js +6 -4
- package/dist/domains/visual-accessibility/services/visual-regression.d.ts +0 -26
- package/dist/domains/visual-accessibility/services/visual-regression.js +4 -2
- package/dist/domains/visual-accessibility/services/visual-tester.d.ts +0 -4
- package/dist/domains/visual-accessibility/services/visual-tester.js +4 -2
- package/dist/governance/deterministic-gateway-integration.js +1 -1
- package/dist/learning/agent-routing.d.ts +53 -0
- package/dist/learning/agent-routing.js +142 -0
- package/dist/learning/embedding-utils.d.ts +34 -0
- package/dist/learning/embedding-utils.js +95 -0
- package/dist/learning/pattern-promotion.d.ts +63 -0
- package/dist/learning/pattern-promotion.js +187 -0
- package/dist/learning/pretrained-patterns.d.ts +14 -0
- package/dist/learning/pretrained-patterns.js +726 -0
- package/dist/learning/qe-reasoning-bank-types.d.ts +174 -0
- package/dist/learning/qe-reasoning-bank-types.js +24 -0
- package/dist/learning/qe-reasoning-bank.d.ts +9 -192
- package/dist/learning/qe-reasoning-bank.js +48 -1093
- package/dist/mcp/bundle.js +335 -335
- package/dist/mcp/security/validators/command-validator.d.ts +1 -40
- package/dist/mcp/security/validators/command-validator.js +2 -122
- package/dist/mcp/security/validators/crypto-validator.d.ts +1 -39
- package/dist/mcp/security/validators/crypto-validator.js +2 -71
- package/dist/mcp/security/validators/input-sanitizer.d.ts +1 -55
- package/dist/mcp/security/validators/input-sanitizer.js +2 -156
- package/dist/mcp/security/validators/interfaces.d.ts +1 -163
- package/dist/mcp/security/validators/interfaces.js +2 -5
- package/dist/mcp/security/validators/path-traversal-validator.d.ts +1 -49
- package/dist/mcp/security/validators/path-traversal-validator.js +2 -241
- package/dist/mcp/security/validators/regex-safety-validator.d.ts +1 -49
- package/dist/mcp/security/validators/regex-safety-validator.js +2 -182
- package/dist/mcp/security/validators/validation-orchestrator.d.ts +1 -65
- package/dist/mcp/security/validators/validation-orchestrator.js +2 -145
- package/dist/shared/io/file-reader.js +1 -1
- package/dist/shared/security/command-validator.d.ts +44 -0
- package/dist/shared/security/command-validator.js +126 -0
- package/dist/shared/security/crypto-validator.d.ts +43 -0
- package/dist/shared/security/crypto-validator.js +75 -0
- package/dist/shared/security/index.d.ts +7 -0
- package/dist/shared/security/index.js +15 -0
- package/dist/shared/security/input-sanitizer.d.ts +59 -0
- package/dist/shared/security/input-sanitizer.js +160 -0
- package/dist/shared/security/path-traversal-validator.d.ts +53 -0
- package/dist/shared/security/path-traversal-validator.js +245 -0
- package/dist/shared/security/regex-safety-validator.d.ts +53 -0
- package/dist/shared/security/regex-safety-validator.js +186 -0
- package/dist/shared/security/validation-orchestrator.d.ts +69 -0
- package/dist/shared/security/validation-orchestrator.js +149 -0
- package/dist/shared/security/validators-interfaces.d.ts +167 -0
- package/dist/shared/security/validators-interfaces.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Time Crystal Scheduling Algorithms
|
|
3
|
+
* ADR-047: MinCut Self-Organizing QE Integration - Phase 4
|
|
4
|
+
*
|
|
5
|
+
* Pure functions for computing optimal execution order, topological sorting,
|
|
6
|
+
* parallel execution groups, and schedule optimization decisions.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Compute optimal execution order based on priority and execution time
|
|
10
|
+
*/
|
|
11
|
+
export function computeOptimalOrder(lattice) {
|
|
12
|
+
const nodes = Array.from(lattice.nodes.values());
|
|
13
|
+
// Sort by priority (higher first), then by execution time (shorter first)
|
|
14
|
+
nodes.sort((a, b) => {
|
|
15
|
+
if (b.priority !== a.priority) {
|
|
16
|
+
return b.priority - a.priority;
|
|
17
|
+
}
|
|
18
|
+
return a.avgExecutionTime - b.avgExecutionTime;
|
|
19
|
+
});
|
|
20
|
+
// Apply topological sort for dependencies
|
|
21
|
+
return topologicalSort(nodes.map(n => n.id), lattice);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Topological sort respecting dependencies (Kahn's algorithm)
|
|
25
|
+
*/
|
|
26
|
+
export function topologicalSort(nodeIds, lattice) {
|
|
27
|
+
const inDegree = new Map();
|
|
28
|
+
const adjacency = new Map();
|
|
29
|
+
// Initialize
|
|
30
|
+
for (const id of nodeIds) {
|
|
31
|
+
inDegree.set(id, 0);
|
|
32
|
+
adjacency.set(id, []);
|
|
33
|
+
}
|
|
34
|
+
// Build adjacency and in-degree from dependencies
|
|
35
|
+
for (const dep of lattice.dependencies) {
|
|
36
|
+
if (dep.type === 'must-precede' || dep.type === 'should-precede') {
|
|
37
|
+
const targets = adjacency.get(dep.sourceId) || [];
|
|
38
|
+
targets.push(dep.targetId);
|
|
39
|
+
adjacency.set(dep.sourceId, targets);
|
|
40
|
+
const degree = inDegree.get(dep.targetId) || 0;
|
|
41
|
+
inDegree.set(dep.targetId, degree + 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Kahn's algorithm
|
|
45
|
+
const queue = nodeIds.filter(id => (inDegree.get(id) || 0) === 0);
|
|
46
|
+
const result = [];
|
|
47
|
+
while (queue.length > 0) {
|
|
48
|
+
const node = queue.shift();
|
|
49
|
+
result.push(node);
|
|
50
|
+
for (const neighbor of adjacency.get(node) || []) {
|
|
51
|
+
const degree = (inDegree.get(neighbor) || 1) - 1;
|
|
52
|
+
inDegree.set(neighbor, degree);
|
|
53
|
+
if (degree === 0) {
|
|
54
|
+
queue.push(neighbor);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Add any remaining nodes (in case of cycles)
|
|
59
|
+
for (const id of nodeIds) {
|
|
60
|
+
if (!result.includes(id)) {
|
|
61
|
+
result.push(id);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Compute parallel execution groups respecting dependencies and conflicts
|
|
68
|
+
*/
|
|
69
|
+
export function computeParallelGroups(lattice, maxParallelGroups) {
|
|
70
|
+
const groups = [];
|
|
71
|
+
const scheduled = new Set();
|
|
72
|
+
const nodes = Array.from(lattice.nodes.values());
|
|
73
|
+
while (scheduled.size < nodes.length) {
|
|
74
|
+
const group = [];
|
|
75
|
+
for (const node of nodes) {
|
|
76
|
+
if (scheduled.has(node.id))
|
|
77
|
+
continue;
|
|
78
|
+
// Check if all dependencies are satisfied
|
|
79
|
+
const canSchedule = lattice.dependencies
|
|
80
|
+
.filter(d => d.targetId === node.id && (d.type === 'must-precede' || d.type === 'should-precede'))
|
|
81
|
+
.every(d => scheduled.has(d.sourceId));
|
|
82
|
+
// Check for conflicts with current group
|
|
83
|
+
const hasConflict = lattice.dependencies
|
|
84
|
+
.filter(d => d.type === 'conflicts')
|
|
85
|
+
.some(d => (d.sourceId === node.id && group.includes(d.targetId)) ||
|
|
86
|
+
(d.targetId === node.id && group.includes(d.sourceId)));
|
|
87
|
+
if (canSchedule && !hasConflict && group.length < maxParallelGroups) {
|
|
88
|
+
group.push(node.id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (group.length === 0) {
|
|
92
|
+
// No progress - break to avoid infinite loop
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
groups.push(group);
|
|
96
|
+
for (const id of group) {
|
|
97
|
+
scheduled.add(id);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return groups;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Check if two execution orders differ significantly (>20% positions changed)
|
|
104
|
+
*/
|
|
105
|
+
export function ordersDiffer(a, b) {
|
|
106
|
+
if (a.length !== b.length)
|
|
107
|
+
return true;
|
|
108
|
+
let differences = 0;
|
|
109
|
+
for (let i = 0; i < a.length; i++) {
|
|
110
|
+
if (a[i] !== b[i]) {
|
|
111
|
+
differences++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Consider different if more than 20% of positions changed
|
|
115
|
+
return differences > a.length * 0.2;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Determine the optimal schedule optimization action
|
|
119
|
+
*/
|
|
120
|
+
export function determineOptimization(lattice, observations, causalGraph, maxParallelGroups) {
|
|
121
|
+
// Check if optimization is needed
|
|
122
|
+
const lastObs = observations[observations.length - 1];
|
|
123
|
+
if (!lastObs || lastObs.attractor === 'stable' && lastObs.anomalies.length === 0) {
|
|
124
|
+
return { type: 'no_change', reason: 'System is stable with no anomalies' };
|
|
125
|
+
}
|
|
126
|
+
// Analyze execution order for optimization
|
|
127
|
+
const optimizedOrder = computeOptimalOrder(lattice);
|
|
128
|
+
if (ordersDiffer(optimizedOrder, lattice.executionOrder)) {
|
|
129
|
+
return { type: 'reorder', newOrder: optimizedOrder };
|
|
130
|
+
}
|
|
131
|
+
// Analyze parallelization opportunities
|
|
132
|
+
const parallelGroups = computeParallelGroups(lattice, maxParallelGroups);
|
|
133
|
+
if (parallelGroups.length > lattice.parallelGroups.length) {
|
|
134
|
+
return { type: 'parallelize', groups: parallelGroups };
|
|
135
|
+
}
|
|
136
|
+
// Check for flaky tests to skip
|
|
137
|
+
if (causalGraph) {
|
|
138
|
+
const recentFailures = causalGraph.getAllFailures()
|
|
139
|
+
.filter(f => Date.now() - f.timestamp.getTime() < 3600000); // Last hour
|
|
140
|
+
const failureCounts = new Map();
|
|
141
|
+
for (const failure of recentFailures) {
|
|
142
|
+
const count = failureCounts.get(failure.testId) || 0;
|
|
143
|
+
failureCounts.set(failure.testId, count + 1);
|
|
144
|
+
}
|
|
145
|
+
// Find repeatedly failing tests
|
|
146
|
+
for (const [testId, count] of Array.from(failureCounts.entries())) {
|
|
147
|
+
if (count >= 3) {
|
|
148
|
+
return {
|
|
149
|
+
type: 'skip',
|
|
150
|
+
nodeId: testId,
|
|
151
|
+
reason: `Test has failed ${count} times in the last hour`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return { type: 'no_change', reason: 'No optimization opportunities found' };
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Rebuild lattice from a causal graph's failure data
|
|
160
|
+
*/
|
|
161
|
+
export function rebuildLatticeFromCausalGraph(lattice, causalGraph, maxParallelGroups) {
|
|
162
|
+
const failures = causalGraph.getAllFailures();
|
|
163
|
+
const testIds = new Set();
|
|
164
|
+
for (const failure of failures) {
|
|
165
|
+
testIds.add(failure.testId);
|
|
166
|
+
}
|
|
167
|
+
const testIdArray = Array.from(testIds);
|
|
168
|
+
// Create nodes for each test
|
|
169
|
+
for (const testId of testIdArray) {
|
|
170
|
+
const testFailures = failures.filter(f => f.testId === testId);
|
|
171
|
+
const avgDuration = 5000; // Default
|
|
172
|
+
const failureRate = testFailures.length / Math.max(1, failures.length / testIds.size);
|
|
173
|
+
lattice.nodes.set(testId, {
|
|
174
|
+
id: testId,
|
|
175
|
+
type: 'test',
|
|
176
|
+
avgExecutionTime: avgDuration,
|
|
177
|
+
failureProbability: Math.min(1, failureRate),
|
|
178
|
+
priority: 1 - failureRate, // Lower priority for flaky tests
|
|
179
|
+
resources: { cpu: 1, memory: 256, io: 1 },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// Build dependencies from causal links
|
|
183
|
+
for (const testId of testIdArray) {
|
|
184
|
+
const testFailures = failures.filter(f => f.testId === testId);
|
|
185
|
+
for (const failure of testFailures) {
|
|
186
|
+
const effects = causalGraph.getEffects(failure.id);
|
|
187
|
+
for (const effect of effects) {
|
|
188
|
+
if (testId !== effect.testId) {
|
|
189
|
+
// Check if dependency already exists
|
|
190
|
+
const existing = lattice.dependencies.find(d => d.sourceId === testId && d.targetId === effect.testId);
|
|
191
|
+
if (existing) {
|
|
192
|
+
existing.observationCount++;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
lattice.dependencies.push({
|
|
196
|
+
sourceId: testId,
|
|
197
|
+
targetId: effect.testId,
|
|
198
|
+
type: 'should-precede',
|
|
199
|
+
strength: 0.5,
|
|
200
|
+
latencyMs: effect.timestamp.getTime() - failure.timestamp.getTime(),
|
|
201
|
+
observationCount: 1,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Recompute execution order and parallel groups
|
|
209
|
+
lattice.executionOrder = computeOptimalOrder(lattice);
|
|
210
|
+
lattice.parallelGroups = computeParallelGroups(lattice, maxParallelGroups);
|
|
211
|
+
lattice.lastOptimized = new Date();
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=time-crystal-scheduling.js.map
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Time Crystal Types & Interfaces
|
|
3
|
+
* ADR-047: MinCut Self-Organizing QE Integration - Phase 4
|
|
4
|
+
*
|
|
5
|
+
* All types, interfaces, and configuration constants for the Time Crystal
|
|
6
|
+
* CI/CD coordination system.
|
|
7
|
+
*/
|
|
8
|
+
import type { CPGConfig, CPGTestPhase, CPGPhaseResult } from './kuramoto-cpg';
|
|
9
|
+
import type { DomainName } from '../../shared/types';
|
|
10
|
+
/** Domain name for time crystal events */
|
|
11
|
+
export declare const TIME_CRYSTAL_SOURCE: DomainName;
|
|
12
|
+
/**
|
|
13
|
+
* Temporal attractors - states the CI/CD system naturally evolves toward
|
|
14
|
+
*/
|
|
15
|
+
export type TemporalAttractor = 'stable' | 'degraded' | 'chaotic';
|
|
16
|
+
/**
|
|
17
|
+
* Phase state in the time crystal
|
|
18
|
+
*/
|
|
19
|
+
export type PhaseState = 'dormant' | 'activating' | 'active' | 'completing' | 'cooldown';
|
|
20
|
+
/**
|
|
21
|
+
* CI/CD execution metrics for a time window
|
|
22
|
+
*/
|
|
23
|
+
export interface ExecutionMetrics {
|
|
24
|
+
/** Timestamp of the metrics */
|
|
25
|
+
readonly timestamp: Date;
|
|
26
|
+
/** Number of builds executed */
|
|
27
|
+
readonly buildCount: number;
|
|
28
|
+
/** Number of successful builds */
|
|
29
|
+
readonly successfulBuilds: number;
|
|
30
|
+
/** Number of tests executed */
|
|
31
|
+
readonly testCount: number;
|
|
32
|
+
/** Number of tests passed */
|
|
33
|
+
readonly testsPassed: number;
|
|
34
|
+
/** Number of tests failed */
|
|
35
|
+
readonly testsFailed: number;
|
|
36
|
+
/** Average build duration (ms) */
|
|
37
|
+
readonly avgBuildDuration: number;
|
|
38
|
+
/** Average test duration (ms) */
|
|
39
|
+
readonly avgTestDuration: number;
|
|
40
|
+
/** Resource utilization (0-1) */
|
|
41
|
+
readonly resourceUtilization: number;
|
|
42
|
+
/** Queue depth (pending items) */
|
|
43
|
+
readonly queueDepth: number;
|
|
44
|
+
/** Throughput (items/minute) */
|
|
45
|
+
readonly throughput: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Time crystal phase representing a periodic CI/CD pattern
|
|
49
|
+
*/
|
|
50
|
+
export interface TimeCrystalPhase {
|
|
51
|
+
/** Phase ID */
|
|
52
|
+
readonly id: string;
|
|
53
|
+
/** Phase name */
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** Phase state */
|
|
56
|
+
state: PhaseState;
|
|
57
|
+
/** Phase period (ms) - how long a complete cycle takes */
|
|
58
|
+
readonly periodMs: number;
|
|
59
|
+
/** Phase offset (ms) - when this phase starts within a cycle */
|
|
60
|
+
readonly offsetMs: number;
|
|
61
|
+
/** Expected duration (ms) */
|
|
62
|
+
readonly expectedDuration: number;
|
|
63
|
+
/** Optimal parallelism for this phase */
|
|
64
|
+
readonly optimalParallelism: number;
|
|
65
|
+
/** Test types typically run in this phase */
|
|
66
|
+
readonly testTypes: string[];
|
|
67
|
+
/** Historical success rate (0-1) */
|
|
68
|
+
successRate: number;
|
|
69
|
+
/** Average actual duration (ms) */
|
|
70
|
+
avgActualDuration: number;
|
|
71
|
+
/** Execution count */
|
|
72
|
+
executionCount: number;
|
|
73
|
+
/** Last activation timestamp */
|
|
74
|
+
lastActivation?: Date;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Temporal dependency between execution units
|
|
78
|
+
*/
|
|
79
|
+
export interface TemporalDependency {
|
|
80
|
+
/** Source execution unit ID */
|
|
81
|
+
readonly sourceId: string;
|
|
82
|
+
/** Target execution unit ID */
|
|
83
|
+
readonly targetId: string;
|
|
84
|
+
/** Dependency type */
|
|
85
|
+
readonly type: 'must-precede' | 'should-precede' | 'independent' | 'conflicts';
|
|
86
|
+
/** Dependency strength (0-1) */
|
|
87
|
+
readonly strength: number;
|
|
88
|
+
/** Historical latency between executions (ms) */
|
|
89
|
+
readonly latencyMs: number;
|
|
90
|
+
/** Observation count */
|
|
91
|
+
observationCount: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Crystal lattice - network of temporal dependencies
|
|
95
|
+
*/
|
|
96
|
+
export interface CrystalLattice {
|
|
97
|
+
/** All execution units in the lattice */
|
|
98
|
+
readonly nodes: Map<string, LatticeNode>;
|
|
99
|
+
/** Dependencies between nodes */
|
|
100
|
+
readonly dependencies: TemporalDependency[];
|
|
101
|
+
/** Computed execution order (mutable for optimization) */
|
|
102
|
+
executionOrder: string[];
|
|
103
|
+
/** Parallel execution groups (mutable for optimization) */
|
|
104
|
+
parallelGroups: string[][];
|
|
105
|
+
/** Last optimization timestamp */
|
|
106
|
+
lastOptimized: Date;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Node in the crystal lattice
|
|
110
|
+
*/
|
|
111
|
+
export interface LatticeNode {
|
|
112
|
+
/** Node ID (test or build unit) */
|
|
113
|
+
readonly id: string;
|
|
114
|
+
/** Node type */
|
|
115
|
+
readonly type: 'test' | 'build' | 'deploy' | 'validate';
|
|
116
|
+
/** Average execution time (ms) */
|
|
117
|
+
avgExecutionTime: number;
|
|
118
|
+
/** Failure probability (0-1) */
|
|
119
|
+
failureProbability: number;
|
|
120
|
+
/** Priority (higher = execute earlier) */
|
|
121
|
+
priority: number;
|
|
122
|
+
/** Resource requirements */
|
|
123
|
+
readonly resources: {
|
|
124
|
+
cpu: number;
|
|
125
|
+
memory: number;
|
|
126
|
+
io: number;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Observation from CI/CD execution
|
|
131
|
+
*/
|
|
132
|
+
export interface CrystalObservation {
|
|
133
|
+
/** Observation ID */
|
|
134
|
+
readonly id: string;
|
|
135
|
+
/** Timestamp */
|
|
136
|
+
readonly timestamp: Date;
|
|
137
|
+
/** Current attractor state */
|
|
138
|
+
readonly attractor: TemporalAttractor;
|
|
139
|
+
/** Execution metrics */
|
|
140
|
+
readonly metrics: ExecutionMetrics;
|
|
141
|
+
/** Active phases */
|
|
142
|
+
readonly activePhases: string[];
|
|
143
|
+
/** Detected anomalies */
|
|
144
|
+
readonly anomalies: CrystalAnomaly[];
|
|
145
|
+
/** Predicted next phase */
|
|
146
|
+
readonly predictedNextPhase?: string;
|
|
147
|
+
/** Confidence in prediction */
|
|
148
|
+
readonly predictionConfidence: number;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Anomaly detected in CI/CD patterns
|
|
152
|
+
*/
|
|
153
|
+
export interface CrystalAnomaly {
|
|
154
|
+
/** Anomaly type */
|
|
155
|
+
readonly type: 'phase-drift' | 'cascade-failure' | 'resource-contention' | 'timeout-spike' | 'throughput-drop';
|
|
156
|
+
/** Severity (0-1) */
|
|
157
|
+
readonly severity: number;
|
|
158
|
+
/** Affected phase/node IDs */
|
|
159
|
+
readonly affected: string[];
|
|
160
|
+
/** Description */
|
|
161
|
+
readonly description: string;
|
|
162
|
+
/** Suggested action */
|
|
163
|
+
readonly suggestion: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Optimization action for the scheduler
|
|
167
|
+
*/
|
|
168
|
+
export type ScheduleOptimization = {
|
|
169
|
+
readonly type: 'reorder';
|
|
170
|
+
readonly newOrder: string[];
|
|
171
|
+
} | {
|
|
172
|
+
readonly type: 'parallelize';
|
|
173
|
+
readonly groups: string[][];
|
|
174
|
+
} | {
|
|
175
|
+
readonly type: 'delay';
|
|
176
|
+
readonly nodeId: string;
|
|
177
|
+
readonly delayMs: number;
|
|
178
|
+
} | {
|
|
179
|
+
readonly type: 'skip';
|
|
180
|
+
readonly nodeId: string;
|
|
181
|
+
readonly reason: string;
|
|
182
|
+
} | {
|
|
183
|
+
readonly type: 'retry';
|
|
184
|
+
readonly nodeId: string;
|
|
185
|
+
readonly maxAttempts: number;
|
|
186
|
+
} | {
|
|
187
|
+
readonly type: 'no_change';
|
|
188
|
+
readonly reason: string;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Stabilization action to move toward stable attractor
|
|
192
|
+
*/
|
|
193
|
+
export type StabilizationAction = {
|
|
194
|
+
readonly type: 'reduce_parallelism';
|
|
195
|
+
readonly by: number;
|
|
196
|
+
} | {
|
|
197
|
+
readonly type: 'increase_parallelism';
|
|
198
|
+
readonly by: number;
|
|
199
|
+
} | {
|
|
200
|
+
readonly type: 'isolate_flaky';
|
|
201
|
+
readonly testIds: string[];
|
|
202
|
+
} | {
|
|
203
|
+
readonly type: 'warm_cache';
|
|
204
|
+
readonly cacheKeys: string[];
|
|
205
|
+
} | {
|
|
206
|
+
readonly type: 'clear_queue';
|
|
207
|
+
readonly reason: string;
|
|
208
|
+
} | {
|
|
209
|
+
readonly type: 'throttle';
|
|
210
|
+
readonly durationMs: number;
|
|
211
|
+
} | {
|
|
212
|
+
readonly type: 'no_action';
|
|
213
|
+
readonly reason: string;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Interface for executing test phases
|
|
217
|
+
* Allows dependency injection of test execution strategy
|
|
218
|
+
*/
|
|
219
|
+
export interface PhaseExecutor {
|
|
220
|
+
/**
|
|
221
|
+
* Execute tests for a given phase
|
|
222
|
+
* @param phase - The CPG test phase to execute
|
|
223
|
+
* @returns Promise resolving to phase execution result
|
|
224
|
+
*/
|
|
225
|
+
execute(phase: CPGTestPhase): Promise<CPGPhaseResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Check if executor is ready to run tests
|
|
228
|
+
*/
|
|
229
|
+
isReady(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Get executor name for logging
|
|
232
|
+
*/
|
|
233
|
+
getName(): string;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Time crystal controller configuration
|
|
237
|
+
*/
|
|
238
|
+
export interface TimeCrystalConfig {
|
|
239
|
+
/** Enable time crystal coordination */
|
|
240
|
+
enabled: boolean;
|
|
241
|
+
/** Observation interval (ms) */
|
|
242
|
+
observationIntervalMs: number;
|
|
243
|
+
/** Phase detection window (ms) */
|
|
244
|
+
phaseDetectionWindowMs: number;
|
|
245
|
+
/** Minimum observations for pattern detection */
|
|
246
|
+
minObservationsForPattern: number;
|
|
247
|
+
/** Anomaly detection sensitivity (0-1, higher = more sensitive) */
|
|
248
|
+
anomalySensitivity: number;
|
|
249
|
+
/** Stability threshold for attractor detection */
|
|
250
|
+
stabilityThreshold: number;
|
|
251
|
+
/** Maximum parallel execution groups */
|
|
252
|
+
maxParallelGroups: number;
|
|
253
|
+
/** Prediction horizon (ms) */
|
|
254
|
+
predictionHorizonMs: number;
|
|
255
|
+
/** Enable automatic optimization */
|
|
256
|
+
autoOptimize: boolean;
|
|
257
|
+
/** Enable automatic stabilization */
|
|
258
|
+
autoStabilize: boolean;
|
|
259
|
+
/** Enable Kuramoto CPG-driven phase scheduling */
|
|
260
|
+
useCPGScheduling: boolean;
|
|
261
|
+
/** CPG configuration override (uses DEFAULT_CPG_CONFIG if not provided) */
|
|
262
|
+
cpgConfig?: Partial<CPGConfig>;
|
|
263
|
+
/** CPG test phases override (uses DEFAULT_CPG_TEST_PHASES if not provided) */
|
|
264
|
+
cpgPhases?: CPGTestPhase[];
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Default time crystal configuration
|
|
268
|
+
*/
|
|
269
|
+
export declare const DEFAULT_TIME_CRYSTAL_CONFIG: TimeCrystalConfig;
|
|
270
|
+
/**
|
|
271
|
+
* Time crystal event types
|
|
272
|
+
*/
|
|
273
|
+
export type TimeCrystalEventType = 'crystal.observation' | 'crystal.phase.activated' | 'crystal.phase.completed' | 'crystal.attractor.changed' | 'crystal.anomaly.detected' | 'crystal.optimization.applied' | 'crystal.stabilization.applied' | 'crystal.cpg.tick' | 'crystal.cpg.transition' | 'crystal.cpg.started' | 'crystal.cpg.stopped' | 'crystal.cpg.repair';
|
|
274
|
+
/**
|
|
275
|
+
* Default CI/CD phase definitions for time crystal initialization
|
|
276
|
+
*/
|
|
277
|
+
export declare const DEFAULT_CRYSTAL_PHASES: Omit<TimeCrystalPhase, 'state' | 'successRate' | 'avgActualDuration' | 'executionCount'>[];
|
|
278
|
+
//# sourceMappingURL=time-crystal-types.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic QE v3 - Time Crystal Types & Interfaces
|
|
3
|
+
* ADR-047: MinCut Self-Organizing QE Integration - Phase 4
|
|
4
|
+
*
|
|
5
|
+
* All types, interfaces, and configuration constants for the Time Crystal
|
|
6
|
+
* CI/CD coordination system.
|
|
7
|
+
*/
|
|
8
|
+
/** Domain name for time crystal events */
|
|
9
|
+
export const TIME_CRYSTAL_SOURCE = 'coordination';
|
|
10
|
+
/**
|
|
11
|
+
* Default time crystal configuration
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_TIME_CRYSTAL_CONFIG = {
|
|
14
|
+
enabled: true,
|
|
15
|
+
observationIntervalMs: 30000, // 30 seconds
|
|
16
|
+
phaseDetectionWindowMs: 3600000, // 1 hour
|
|
17
|
+
minObservationsForPattern: 10,
|
|
18
|
+
anomalySensitivity: 0.7,
|
|
19
|
+
stabilityThreshold: 0.8,
|
|
20
|
+
maxParallelGroups: 8,
|
|
21
|
+
predictionHorizonMs: 600000, // 10 minutes
|
|
22
|
+
autoOptimize: true,
|
|
23
|
+
autoStabilize: true,
|
|
24
|
+
useCPGScheduling: true, // Enable CPG by default
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Default CI/CD phase definitions for time crystal initialization
|
|
28
|
+
*/
|
|
29
|
+
export const DEFAULT_CRYSTAL_PHASES = [
|
|
30
|
+
{
|
|
31
|
+
id: 'unit-tests',
|
|
32
|
+
name: 'Unit Tests',
|
|
33
|
+
periodMs: 60000,
|
|
34
|
+
offsetMs: 0,
|
|
35
|
+
expectedDuration: 30000,
|
|
36
|
+
optimalParallelism: 8,
|
|
37
|
+
testTypes: ['unit'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'integration-tests',
|
|
41
|
+
name: 'Integration Tests',
|
|
42
|
+
periodMs: 120000,
|
|
43
|
+
offsetMs: 30000,
|
|
44
|
+
expectedDuration: 60000,
|
|
45
|
+
optimalParallelism: 4,
|
|
46
|
+
testTypes: ['integration'],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'e2e-tests',
|
|
50
|
+
name: 'End-to-End Tests',
|
|
51
|
+
periodMs: 300000,
|
|
52
|
+
offsetMs: 90000,
|
|
53
|
+
expectedDuration: 180000,
|
|
54
|
+
optimalParallelism: 2,
|
|
55
|
+
testTypes: ['e2e', 'visual'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'performance-tests',
|
|
59
|
+
name: 'Performance Tests',
|
|
60
|
+
periodMs: 600000,
|
|
61
|
+
offsetMs: 270000,
|
|
62
|
+
expectedDuration: 120000,
|
|
63
|
+
optimalParallelism: 1,
|
|
64
|
+
testTypes: ['performance', 'load'],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
//# sourceMappingURL=time-crystal-types.js.map
|