-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_registry_coverage.py
More file actions
207 lines (181 loc) · 6.18 KB
/
verify_registry_coverage.py
File metadata and controls
207 lines (181 loc) · 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/usr/bin/env python3
"""Verification script to check action executor registry coverage.
This script:
1. Imports action_executors package to trigger all registrations
2. Gets all registered action types via get_registered_action_types()
3. Compares against the expected 30 action types
4. Reports coverage and missing action types
"""
import sys
from pathlib import Path
# Add src directory to path to enable imports
src_path = Path(__file__).parent / "src"
sys.path.insert(0, str(src_path))
def main():
"""Main verification function."""
print("=" * 80)
print("ACTION EXECUTOR REGISTRY COVERAGE VERIFICATION")
print("=" * 80)
print()
# Expected 30 action types from the analysis
expected_action_types = {
# Mouse (9)
"MOUSE_MOVE",
"MOUSE_DOWN",
"MOUSE_UP",
"MOUSE_SCROLL",
"SCROLL",
"CLICK",
"DOUBLE_CLICK",
"RIGHT_CLICK",
"DRAG",
# Keyboard (4)
"KEY_DOWN",
"KEY_UP",
"KEY_PRESS",
"TYPE",
# Vision (3)
"FIND",
"EXISTS",
"VANISH",
# Navigation (2)
"GO_TO_STATE",
"RUN_WORKFLOW",
# Utility (2)
"WAIT",
"SCREENSHOT",
# Control Flow (4)
"LOOP",
"IF",
"BREAK",
"CONTINUE",
# Data Operations (8)
"SET_VARIABLE",
"GET_VARIABLE",
"MAP",
"REDUCE",
"SORT",
"FILTER",
"STRING_OPERATION",
"MATH_OPERATION",
}
print(f"Expected action types: {len(expected_action_types)}")
print()
# Import action_executors to trigger all @register_executor decorators
print("Importing action_executors package to trigger registrations...")
try:
from qontinui.action_executors import get_executor_class, get_registered_action_types
print("✓ Import successful")
print()
except Exception as e:
print(f"✗ Failed to import action_executors: {e}")
import traceback
traceback.print_exc()
return 1
# Get all registered action types
print("Getting registered action types from registry...")
registered_types = set(get_registered_action_types())
print(f"✓ Found {len(registered_types)} registered action types")
print()
# Calculate coverage
coverage_count = len(expected_action_types & registered_types)
coverage_percent = (coverage_count / len(expected_action_types)) * 100
print("=" * 80)
print("COVERAGE SUMMARY")
print("=" * 80)
print(f"Total expected: {len(expected_action_types)}")
print(f"Total registered: {len(registered_types)}")
print(
f"Coverage: {coverage_count}/{len(expected_action_types)} ({coverage_percent:.1f}%)"
)
print()
# Check for missing action types
missing_types = expected_action_types - registered_types
extra_types = registered_types - expected_action_types
if missing_types:
print("=" * 80)
print(f"MISSING ACTION TYPES ({len(missing_types)})")
print("=" * 80)
# Categorize missing types
categories = {
"Mouse": [
"MOUSE_MOVE",
"MOUSE_DOWN",
"MOUSE_UP",
"MOUSE_SCROLL",
"SCROLL",
"CLICK",
"DOUBLE_CLICK",
"RIGHT_CLICK",
"DRAG",
],
"Keyboard": ["KEY_DOWN", "KEY_UP", "KEY_PRESS", "TYPE"],
"Vision": ["FIND", "EXISTS", "VANISH"],
"Navigation": ["GO_TO_STATE", "RUN_WORKFLOW"],
"Utility": ["WAIT", "SCREENSHOT"],
"Control Flow": ["LOOP", "IF", "BREAK", "CONTINUE"],
"Data Operations": [
"SET_VARIABLE",
"GET_VARIABLE",
"MAP",
"REDUCE",
"SORT",
"FILTER",
"STRING_OPERATION",
"MATH_OPERATION",
],
}
for category, category_types in categories.items():
missing_in_category = [t for t in category_types if t in missing_types]
if missing_in_category:
print(f"\n{category}:")
for action_type in missing_in_category:
print(f" ✗ {action_type}")
else:
print("✓ All expected action types are registered!")
if extra_types:
print()
print("=" * 80)
print(f"EXTRA REGISTERED TYPES (not in expected list): {len(extra_types)}")
print("=" * 80)
for action_type in sorted(extra_types):
executor_class = get_executor_class(action_type)
print(
f" + {action_type} -> {executor_class.__name__ if executor_class else 'Unknown'}"
)
# Report which executor handles each registered action type
print()
print("=" * 80)
print("REGISTERED ACTION TYPES BY EXECUTOR")
print("=" * 80)
# Group by executor class
executor_map = {}
for action_type in sorted(registered_types):
executor_class = get_executor_class(action_type)
executor_name = executor_class.__name__ if executor_class else "Unknown"
if executor_name not in executor_map:
executor_map[executor_name] = []
executor_map[executor_name].append(action_type)
for executor_name, action_types in sorted(executor_map.items()):
print(f"\n{executor_name} ({len(action_types)} action types):")
for action_type in action_types:
# Check if this is an expected type
status = "✓" if action_type in expected_action_types else "+"
print(f" {status} {action_type}")
print()
print("=" * 80)
print("LEGEND")
print("=" * 80)
print("✓ = Expected action type (covered)")
print("✗ = Expected action type (missing)")
print("+ = Extra action type (not in expected list)")
print()
# Return exit code based on coverage
if coverage_percent == 100.0:
print("SUCCESS: All expected action types are registered! 🎉")
return 0
else:
print(f"INCOMPLETE: {len(missing_types)} action types are missing.")
return 1
if __name__ == "__main__":
sys.exit(main())