@teevee98/synapse-hub 4.1.3 → 4.1.4
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/.agents/skills/01-web-automation/clean-pom-crafter/examples/standard_test_case.groovy +3 -0
- package/.agents/skills/01-web-automation/clean-pom-crafter/references/pom_patterns.groovy +3 -0
- package/.agents/skills/01-web-automation/e2e-testing-patterns/examples/playwright_sharded_config.ts +3 -0
- package/.agents/skills/01-web-automation/playwright-webapp-testing/examples/server_lifecycle_playwright.py +3 -0
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +3 -0
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/references/dast_recipes.ts +3 -0
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +3 -0
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +3 -0
- package/.agents/skills/11-ai-and-prompting/qa-aci-interface/examples/surgical_code_window_walkthrough.md +1 -1
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/PERFORMANCE_AUDIT_REPORT.md +2 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/generate_skill_examples.py +3 -0
- package/scripts/package_dist.py +3 -0
- package/skills_manifest.json +1 -1
- package/synapse.config.json +1 -1
- package/tools/.infer_baseline.json +3 -796
- package/tools/__init__.py +4 -1
- package/tools/agent_canary.py +3 -0
- package/tools/analyze_project.py +3 -0
- package/tools/api_drift_sentinel.py +3 -0
- package/tools/api_fuzzer.py +3 -0
- package/tools/ast_cache.py +4 -2
- package/tools/author_integrity.py +53 -1
- package/tools/auto_heal.py +7 -2
- package/tools/autogen_qa_broker.py +14 -15
- package/tools/browser_helpers.js +2 -2
- package/tools/bug_reporter.py +3 -0
- package/tools/build_consolidated_report.py +3 -0
- package/tools/bump_version.py +4 -1
- package/tools/cache_resolver.py +7 -3
- package/tools/check_env.py +3 -0
- package/tools/check_version_sync.py +3 -0
- package/tools/ci_healing_hook.py +3 -0
- package/tools/cli.py +10 -7
- package/tools/config_decoupler.py +3 -0
- package/tools/core/__init__.py +3 -0
- package/tools/core/file_lock.py +23 -14
- package/tools/core/i18n.py +9 -7
- package/tools/core/memory_bus.py +6 -3
- package/tools/core/process_supervisor.py +28 -18
- package/tools/core/token_estimator.py +55 -18
- package/tools/count_tokens.py +11 -7
- package/tools/create_mock_docx.py +3 -0
- package/tools/dashboard_generator.py +17 -15
- package/tools/db_sandbox.py +4 -1
- package/tools/debt_harvester.py +2 -2
- package/tools/diagram_architect.py +3 -0
- package/tools/distill_log.py +22 -2
- package/tools/e2e_flow_prober.py +3 -0
- package/tools/export_postman_collection.py +3 -0
- package/tools/flaky_detector.py +3 -0
- package/tools/fsm_enforcer.py +2 -2
- package/tools/fuzz_payloads.py +3 -0
- package/tools/generate_allure_report.py +3 -0
- package/tools/generate_api_matrix.py +3 -0
- package/tools/generate_jmx_plan.py +3 -0
- package/tools/generate_tc_from_story.py +3 -0
- package/tools/generate_test_reports.py +3 -0
- package/tools/git_pre_commit_guard.py +13 -3
- package/tools/git_worktree_manager.py +3 -0
- package/tools/heal/__init__.py +3 -0
- package/tools/heal_pr_automator.py +3 -0
- package/tools/heuristic_locator_matcher.py +3 -0
- package/tools/hub_publisher.py +3 -3
- package/tools/infer_linter.py +19 -9
- package/tools/init_config.py +6 -9
- package/tools/jtl_analyzer.py +3 -0
- package/tools/lint/__init__.py +3 -0
- package/tools/lint_ai_docs.py +3 -0
- package/tools/lookup_tc.py +3 -0
- package/tools/lookup_xpath.py +3 -0
- package/tools/matrix_sharder.py +3 -0
- package/tools/mcp/__init__.py +3 -0
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +4 -1
- package/tools/mcp_server.py +4 -1
- package/tools/md_to_xlsx.py +3 -0
- package/tools/mechanical_ui_gate.py +3 -0
- package/tools/micro_mutator.py +9 -5
- package/tools/network_mock_shield.py +3 -0
- package/tools/newman_analyzer.py +3 -0
- package/tools/omni_emitter.py +3 -0
- package/tools/omni_parser.py +3 -0
- package/tools/omni_transpiler.py +3 -0
- package/tools/output_formatter.py +3 -0
- package/tools/package_release.py +6 -6
- package/tools/pairwise_generator.py +3 -0
- package/tools/pentest_scope_guard.py +2 -2
- package/tools/perf/__init__.py +3 -0
- package/tools/pinpoint_failure.py +3 -0
- package/tools/project_state.py +3 -0
- package/tools/repo_map.py +3 -0
- package/tools/report/__init__.py +3 -0
- package/tools/rules_router.py +42 -10
- package/tools/runaway_stopper.py +3 -0
- package/tools/safety_firewall.py +3 -0
- package/tools/setup_project.py +9 -4
- package/tools/skill_collision_guard.py +2 -2
- package/tools/skillspector.py +2 -1
- package/tools/smart_visual_masker.py +3 -0
- package/tools/telemetry_correlator.py +3 -0
- package/tools/template_excel_exporter.py +2 -2
- package/tools/test_impact.py +3 -0
- package/tools/trace_data_flow.py +3 -0
- package/tools/traffic_session_converter.py +3 -0
- package/tools/ui_server.py +2 -2
- package/tools/universal_ir.py +3 -0
- package/tools/update_sentinel.py +15 -9
- package/tools/validate_groovy_scripts.py +3 -0
- package/tools/verify_all.py +27 -20
- package/tools/visual_diff_canvas.py +3 -0
- package/tools/visual_som_helper.py +3 -0
- package/tools/watch_mode.py +4 -4
- package/tools/wcag_audit.py +3 -0
- package/tools/welcome_page.py +1 -1
|
@@ -64,21 +64,22 @@ def kill_process_tree(pid: int, timeout: float = 2.0) -> bool:
|
|
|
64
64
|
for child in children:
|
|
65
65
|
try:
|
|
66
66
|
child.terminate()
|
|
67
|
-
except (psutil.NoSuchProcess, psutil.AccessDenied)
|
|
68
|
-
|
|
67
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
68
|
+
continue
|
|
69
69
|
parent.terminate()
|
|
70
70
|
|
|
71
71
|
gone, alive = psutil.wait_procs(children + [parent], timeout=timeout)
|
|
72
72
|
for p in alive:
|
|
73
73
|
try:
|
|
74
74
|
p.kill()
|
|
75
|
-
except (psutil.NoSuchProcess, psutil.AccessDenied)
|
|
76
|
-
|
|
75
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
76
|
+
continue
|
|
77
77
|
return True
|
|
78
78
|
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
79
79
|
return True
|
|
80
80
|
except ImportError as err:
|
|
81
|
-
|
|
81
|
+
import logging
|
|
82
|
+
logging.getLogger("process_supervisor").debug("psutil import error: %s", err)
|
|
82
83
|
|
|
83
84
|
# 2. Platform-native fallback
|
|
84
85
|
if sys.platform == "win32":
|
|
@@ -116,7 +117,9 @@ def kill_process_tree(pid: int, timeout: float = 2.0) -> bool:
|
|
|
116
117
|
descendant_pids.append(cp)
|
|
117
118
|
to_check.append(cp)
|
|
118
119
|
except Exception as err:
|
|
119
|
-
|
|
120
|
+
import logging
|
|
121
|
+
logging.getLogger("process_supervisor").debug("Process tree inspection error: %s", err)
|
|
122
|
+
continue
|
|
120
123
|
|
|
121
124
|
try:
|
|
122
125
|
caller_pgrp = os.getpgrp() if hasattr(os, "getpgrp") else None
|
|
@@ -128,7 +131,8 @@ def kill_process_tree(pid: int, timeout: float = 2.0) -> bool:
|
|
|
128
131
|
else:
|
|
129
132
|
pgid = None
|
|
130
133
|
except OSError as err:
|
|
131
|
-
|
|
134
|
+
import logging
|
|
135
|
+
logging.getLogger("process_supervisor").debug("getpgid failed: %s", err)
|
|
132
136
|
pgid = None
|
|
133
137
|
|
|
134
138
|
sig_term = getattr(signal, "SIGTERM", 15)
|
|
@@ -139,12 +143,13 @@ def kill_process_tree(pid: int, timeout: float = 2.0) -> bool:
|
|
|
139
143
|
try:
|
|
140
144
|
os.killpg(pgid, sig_term)
|
|
141
145
|
except OSError as err:
|
|
142
|
-
|
|
146
|
+
import logging
|
|
147
|
+
logging.getLogger("process_supervisor").debug("SIGTERM to pgid %s failed: %s", pgid, err)
|
|
143
148
|
for p in [pid] + descendant_pids:
|
|
144
149
|
try:
|
|
145
150
|
os.kill(p, sig_term)
|
|
146
|
-
except OSError
|
|
147
|
-
|
|
151
|
+
except OSError:
|
|
152
|
+
continue
|
|
148
153
|
|
|
149
154
|
# Bounded polling wait before force kill
|
|
150
155
|
start = time.time()
|
|
@@ -155,32 +160,36 @@ def kill_process_tree(pid: int, timeout: float = 2.0) -> bool:
|
|
|
155
160
|
os.killpg(pgid, 0)
|
|
156
161
|
alive = True
|
|
157
162
|
except OSError as err:
|
|
158
|
-
|
|
163
|
+
import logging
|
|
164
|
+
logging.getLogger("process_supervisor").debug("killpg 0 probe failed: %s", err)
|
|
159
165
|
for p in [pid] + descendant_pids:
|
|
160
166
|
try:
|
|
161
167
|
os.kill(p, 0)
|
|
162
168
|
alive = True
|
|
163
169
|
except OSError as err:
|
|
164
|
-
|
|
170
|
+
import logging
|
|
171
|
+
logging.getLogger("process_supervisor").debug("killpg 0 probe failed: %s", err)
|
|
165
172
|
if not alive:
|
|
166
173
|
return True
|
|
167
|
-
time.sleep(0.05)
|
|
174
|
+
time.sleep(0.05) # synapse-ignore: HARD_DELAY_ANTI_PATTERN
|
|
168
175
|
|
|
169
176
|
# Stage 2: Forceful SIGKILL to eradicate all remaining processes
|
|
170
177
|
for p in descendant_pids + [pid]:
|
|
171
178
|
try:
|
|
172
179
|
os.kill(p, sig_kill)
|
|
173
|
-
except OSError
|
|
174
|
-
|
|
180
|
+
except OSError:
|
|
181
|
+
continue
|
|
175
182
|
if pgid is not None:
|
|
176
183
|
try:
|
|
177
184
|
os.killpg(pgid, sig_kill)
|
|
178
185
|
except OSError as err:
|
|
179
|
-
|
|
186
|
+
import logging
|
|
187
|
+
logging.getLogger("process_supervisor").debug("SIGKILL to pgid %s failed: %s", pgid, err)
|
|
180
188
|
try:
|
|
181
189
|
subprocess.run(["pkill", "-KILL", "-P", str(pid)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=2.0)
|
|
182
190
|
except Exception as err:
|
|
183
|
-
|
|
191
|
+
import logging
|
|
192
|
+
logging.getLogger("process_supervisor").debug("pkill subprocess failed: %s", err)
|
|
184
193
|
return True
|
|
185
194
|
|
|
186
195
|
|
|
@@ -338,7 +347,8 @@ class ProcessSupervisor:
|
|
|
338
347
|
stdout_data = _to_str(stdout_raw)
|
|
339
348
|
stderr_data = _to_str(stderr_raw)
|
|
340
349
|
except Exception as comm_err:
|
|
341
|
-
|
|
350
|
+
import logging
|
|
351
|
+
logging.getLogger("process_supervisor").debug("Process communicate error: %s", comm_err)
|
|
342
352
|
returncode = 124
|
|
343
353
|
except Exception as exc:
|
|
344
354
|
kill_process_tree(proc.pid)
|
|
@@ -39,15 +39,30 @@ try:
|
|
|
39
39
|
except ImportError:
|
|
40
40
|
_TIKTOKEN_ENCODER = None
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
# Cache mapping canonical manifest_path -> (mtime, parsed_manifest)
|
|
43
|
+
_SKILLS_MANIFEST_CACHE: Dict[str, Any] = {}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def clear_skills_manifest_cache() -> None:
|
|
47
|
+
"""Clears the in-memory skills manifest cache."""
|
|
48
|
+
global _SKILLS_MANIFEST_CACHE
|
|
49
|
+
_SKILLS_MANIFEST_CACHE.clear()
|
|
43
50
|
|
|
44
51
|
|
|
45
52
|
def get_estimator_info() -> Dict[str, Any]:
|
|
46
53
|
"""Returns active tokenizer engine metadata, exactness status, and model hint."""
|
|
54
|
+
pkg_version = None
|
|
55
|
+
if _TIKTOKEN_ENCODER is not None:
|
|
56
|
+
try:
|
|
57
|
+
pkg_version = getattr(tiktoken, "__version__", None)
|
|
58
|
+
except Exception:
|
|
59
|
+
pkg_version = None
|
|
60
|
+
|
|
47
61
|
return {
|
|
48
62
|
"engine": "cl100k_base" if _TIKTOKEN_ENCODER is not None else "heuristic_polyglot",
|
|
49
63
|
"is_exact": _TIKTOKEN_ENCODER is not None,
|
|
50
64
|
"encoding": "cl100k_base",
|
|
65
|
+
"package_version": pkg_version,
|
|
51
66
|
"calibrated_ratios": {
|
|
52
67
|
"ascii_chars_per_token": 3.85,
|
|
53
68
|
"non_ascii_chars_per_token": 1.80,
|
|
@@ -70,7 +85,8 @@ def count_tokens(text: str, model_hint: str = "cl100k") -> int:
|
|
|
70
85
|
try:
|
|
71
86
|
return len(_TIKTOKEN_ENCODER.encode(text, disallowed_special=()))
|
|
72
87
|
except Exception as err:
|
|
73
|
-
|
|
88
|
+
import sys
|
|
89
|
+
sys.stderr.write(f"Warning: tiktoken encoding error, fallback to heuristic: {err}\n")
|
|
74
90
|
|
|
75
91
|
# Heuristic calibrated against standard LLM subword tokenizers
|
|
76
92
|
non_ascii_chars = len([c for c in text if ord(c) > 127])
|
|
@@ -100,24 +116,45 @@ def count_file_tokens(file_path: str) -> int:
|
|
|
100
116
|
|
|
101
117
|
|
|
102
118
|
def _get_skills_manifest(repo_root: str) -> Dict[str, Dict[str, Any]]:
|
|
103
|
-
"""
|
|
119
|
+
"""
|
|
120
|
+
Loads and caches skills_manifest.json mapping skill_id to metadata.
|
|
121
|
+
Cache is keyed by the canonical realpath of the manifest file and validated
|
|
122
|
+
against file modification time (mtime) to support multi-repo isolation,
|
|
123
|
+
runtime manifest mutations, and deletions.
|
|
124
|
+
"""
|
|
104
125
|
global _SKILLS_MANIFEST_CACHE
|
|
105
|
-
|
|
106
|
-
return _SKILLS_MANIFEST_CACHE
|
|
126
|
+
manifest_path = os.path.realpath(os.path.join(repo_root, "skills_manifest.json"))
|
|
107
127
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
if not os.path.isfile(manifest_path):
|
|
129
|
+
_SKILLS_MANIFEST_CACHE.pop(manifest_path, None)
|
|
130
|
+
return {}
|
|
131
|
+
|
|
132
|
+
try:
|
|
133
|
+
current_mtime = os.path.getmtime(manifest_path)
|
|
134
|
+
except OSError:
|
|
135
|
+
_SKILLS_MANIFEST_CACHE.pop(manifest_path, None)
|
|
136
|
+
return {}
|
|
137
|
+
|
|
138
|
+
if manifest_path in _SKILLS_MANIFEST_CACHE:
|
|
139
|
+
cached_mtime, cached_data = _SKILLS_MANIFEST_CACHE[manifest_path]
|
|
140
|
+
if cached_mtime == current_mtime:
|
|
141
|
+
return cached_data
|
|
142
|
+
|
|
143
|
+
manifest_data: Dict[str, Dict[str, Any]] = {}
|
|
144
|
+
try:
|
|
145
|
+
with open(manifest_path, "r", encoding="utf-8") as f:
|
|
146
|
+
data = json.load(f)
|
|
147
|
+
for s in data.get("skills", []):
|
|
148
|
+
sid = s.get("id")
|
|
149
|
+
if sid:
|
|
150
|
+
manifest_data[sid] = s
|
|
151
|
+
_SKILLS_MANIFEST_CACHE[manifest_path] = (current_mtime, manifest_data)
|
|
152
|
+
except (OSError, json.JSONDecodeError) as err:
|
|
153
|
+
import sys
|
|
154
|
+
sys.stderr.write(f"Warning: Failed to load manifest at {manifest_path}: {err}\n")
|
|
155
|
+
_SKILLS_MANIFEST_CACHE.pop(manifest_path, None)
|
|
156
|
+
|
|
157
|
+
return manifest_data
|
|
121
158
|
|
|
122
159
|
|
|
123
160
|
def serialize_skill_summary(skill_name: str, meta: Optional[Dict[str, Any]] = None) -> str:
|
package/tools/count_tokens.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Cross-Platform Token & Cost Auditor (Synapse-Hub)
|
|
4
7
|
Author: Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
@@ -147,8 +150,9 @@ def get_budget_config() -> Dict[str, int]:
|
|
|
147
150
|
"budget_5h": data.get("budget_5h", DEFAULT_5H_BUDGET),
|
|
148
151
|
"budget_7d": data.get("budget_7d", DEFAULT_7D_BUDGET),
|
|
149
152
|
}
|
|
150
|
-
except (OSError, json.JSONDecodeError):
|
|
151
|
-
|
|
153
|
+
except (OSError, json.JSONDecodeError) as err:
|
|
154
|
+
import logging
|
|
155
|
+
logging.getLogger("count_tokens").debug("Failed to read budget config: %s", err)
|
|
152
156
|
return {
|
|
153
157
|
"budget_5h": DEFAULT_5H_BUDGET,
|
|
154
158
|
"budget_7d": DEFAULT_7D_BUDGET,
|
|
@@ -221,8 +225,9 @@ class AntigravityAdapter:
|
|
|
221
225
|
}
|
|
222
226
|
finally:
|
|
223
227
|
conn.close()
|
|
224
|
-
except (sqlite3.Error, OSError):
|
|
225
|
-
|
|
228
|
+
except (sqlite3.Error, OSError) as err:
|
|
229
|
+
import logging
|
|
230
|
+
logging.getLogger("count_tokens").debug("Failed to query database: %s", err)
|
|
226
231
|
|
|
227
232
|
conversations = []
|
|
228
233
|
for entry in os.listdir(brain_dir):
|
|
@@ -402,7 +407,7 @@ class AntigravityAdapter:
|
|
|
402
407
|
usage_hours["cache"] += cache_tok
|
|
403
408
|
usage_hours["output"] += out_tok
|
|
404
409
|
except (OSError, UnicodeDecodeError):
|
|
405
|
-
|
|
410
|
+
continue
|
|
406
411
|
|
|
407
412
|
budgets = get_budget_config()
|
|
408
413
|
b_5h = budgets["budget_5h"]
|
|
@@ -679,8 +684,7 @@ def detect_platform_from_file(file_path: str) -> str:
|
|
|
679
684
|
if "claude" in line.lower():
|
|
680
685
|
return "claude"
|
|
681
686
|
except (OSError, UnicodeDecodeError):
|
|
682
|
-
|
|
683
|
-
return "antigravity"
|
|
687
|
+
return "antigravity"
|
|
684
688
|
|
|
685
689
|
|
|
686
690
|
def get_adapter(platform: str):
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""Generates a lightweight valid mock DOCX fixture (< 20 KB) for OpenXML Guard / Word reader tests."""
|
|
3
6
|
|
|
4
7
|
import os
|
|
@@ -183,8 +183,9 @@ def load_manifest(hub_root: str) -> Dict[str, Any]:
|
|
|
183
183
|
try:
|
|
184
184
|
with open(path, "r", encoding="utf-8") as f:
|
|
185
185
|
return json.load(f)
|
|
186
|
-
except (OSError, json.JSONDecodeError):
|
|
187
|
-
|
|
186
|
+
except (OSError, json.JSONDecodeError) as err:
|
|
187
|
+
import logging
|
|
188
|
+
logging.getLogger("dashboard_generator").debug("Failed to load skills_manifest: %s", err)
|
|
188
189
|
return {"totalSkills": 50, "skills": [], "categories": {}, "profiles": {}}
|
|
189
190
|
|
|
190
191
|
|
|
@@ -211,7 +212,7 @@ def load_benchmark_report(hub_root: str) -> Dict[str, Any]:
|
|
|
211
212
|
"available": True
|
|
212
213
|
}
|
|
213
214
|
except (OSError, UnicodeDecodeError):
|
|
214
|
-
|
|
215
|
+
continue
|
|
215
216
|
return {
|
|
216
217
|
"resolution_rate": "100.0%",
|
|
217
218
|
"mttr": "0.0s",
|
|
@@ -245,7 +246,7 @@ def load_health_report(target_dir: str) -> Dict[str, Any]:
|
|
|
245
246
|
"available": True
|
|
246
247
|
}
|
|
247
248
|
except (OSError, UnicodeDecodeError):
|
|
248
|
-
|
|
249
|
+
continue
|
|
249
250
|
return {
|
|
250
251
|
"dod_status": "100%_PASS",
|
|
251
252
|
"classes_count": 0,
|
|
@@ -310,8 +311,9 @@ def load_latest_execution_results(target_dir: str) -> Dict[str, Any]:
|
|
|
310
311
|
"timestamp": mtime_str,
|
|
311
312
|
"report_path": rel_path
|
|
312
313
|
}
|
|
313
|
-
except (ET.ParseError, OSError, ValueError, KeyError):
|
|
314
|
-
|
|
314
|
+
except (ET.ParseError, OSError, ValueError, KeyError) as err:
|
|
315
|
+
import logging
|
|
316
|
+
logging.getLogger("dashboard_generator").debug("Failed to parse JUnit XML report: %s", err)
|
|
315
317
|
|
|
316
318
|
# Check summaryTemp.txt if JUnit report not parsed
|
|
317
319
|
summary_files = list(target_path.glob("**/summaryTemp.txt"))
|
|
@@ -344,7 +346,7 @@ def load_latest_execution_results(target_dir: str) -> Dict[str, Any]:
|
|
|
344
346
|
"report_path": str(sf.relative_to(target_path))
|
|
345
347
|
}
|
|
346
348
|
except (OSError, ValueError):
|
|
347
|
-
|
|
349
|
+
continue
|
|
348
350
|
|
|
349
351
|
return {
|
|
350
352
|
"available": False,
|
|
@@ -404,7 +406,7 @@ def scan_target_project_assets(target_dir: str, stack_info: Dict[str, str]) -> D
|
|
|
404
406
|
if classes_list:
|
|
405
407
|
break
|
|
406
408
|
except (json.JSONDecodeError, OSError, KeyError):
|
|
407
|
-
|
|
409
|
+
continue
|
|
408
410
|
|
|
409
411
|
# Priority B: Parse repo_map.txt
|
|
410
412
|
if not classes_list:
|
|
@@ -491,7 +493,7 @@ def scan_target_project_assets(target_dir: str, stack_info: Dict[str, str]) -> D
|
|
|
491
493
|
"methods": m_list or ["(Defined in source)"]
|
|
492
494
|
})
|
|
493
495
|
except (OSError, UnicodeDecodeError):
|
|
494
|
-
|
|
496
|
+
continue
|
|
495
497
|
|
|
496
498
|
# 2. Discover Test Cases
|
|
497
499
|
test_files = []
|
|
@@ -1348,7 +1350,7 @@ def _build_target_translations(
|
|
|
1348
1350
|
"th_step_status": "Trạng Thái",
|
|
1349
1351
|
"th_step_details": "Chi Tiết Kỹ Thuật (OTel & AST)",
|
|
1350
1352
|
|
|
1351
|
-
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.1.
|
|
1353
|
+
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.1.4 • Bản quyền © Thế Vị (@TeeVee98) • Chuẩn Clean POM & Kiểm Thử Tự Chủ",
|
|
1352
1354
|
}
|
|
1353
1355
|
|
|
1354
1356
|
translations_en = {
|
|
@@ -1426,7 +1428,7 @@ def _build_target_translations(
|
|
|
1426
1428
|
"th_step_status": "Status",
|
|
1427
1429
|
"th_step_details": "Technical Details (OTel & AST)",
|
|
1428
1430
|
|
|
1429
|
-
"footer_text": "Generated automatically by Synapse-Hub v4.1.
|
|
1431
|
+
"footer_text": "Generated automatically by Synapse-Hub v4.1.4 • Copyright © Thế Vị (@TeeVee98) • Clean POM & Autonomous Testing",
|
|
1430
1432
|
}
|
|
1431
1433
|
|
|
1432
1434
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -1915,7 +1917,7 @@ def _build_hub_translations(
|
|
|
1915
1917
|
"""Builds bilingual dictionaries for Hub Dashboard."""
|
|
1916
1918
|
translations_vi = {
|
|
1917
1919
|
"header_title": "Bảng Điều Hành Chất Lượng Doanh Nghiệp",
|
|
1918
|
-
"header_subtitle": "Synapse-Hub v4.1.
|
|
1920
|
+
"header_subtitle": "Synapse-Hub v4.1.4 • Hệ Sinh Thái Kiểm Thử AI Agent Tự Chủ",
|
|
1919
1921
|
"nav_welcome": "Giới Thiệu",
|
|
1920
1922
|
"meta_mode": "🏷️ Chế độ: <strong>HỆ SINH THÁI QA HUB</strong>",
|
|
1921
1923
|
"meta_gen": f"🕒 Khởi tạo: <strong>{now_str}</strong>",
|
|
@@ -1985,12 +1987,12 @@ def _build_hub_translations(
|
|
|
1985
1987
|
"th_sk_ver": "Phiên Bản",
|
|
1986
1988
|
"th_sk_cap": "Khả Năng Nghiệp Vụ Cốt Lõi",
|
|
1987
1989
|
|
|
1988
|
-
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.1.
|
|
1990
|
+
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.1.4 • Bản quyền © Thế Vị (@TeeVee98) • Hệ Thống Kiểm Thử AI Agent Tự Chủ",
|
|
1989
1991
|
}
|
|
1990
1992
|
|
|
1991
1993
|
translations_en = {
|
|
1992
1994
|
"header_title": "Enterprise QA Executive Dashboard",
|
|
1993
|
-
"header_subtitle": "Synapse-Hub v4.1.
|
|
1995
|
+
"header_subtitle": "Synapse-Hub v4.1.4 • Autonomous AI Agent Testing Ecosystem",
|
|
1994
1996
|
"nav_welcome": "Welcome",
|
|
1995
1997
|
"meta_mode": "🏷️ Mode: <strong>QA HUB ECOSYSTEM</strong>",
|
|
1996
1998
|
"meta_gen": f"🕒 Generated: <strong>{now_str}</strong>",
|
|
@@ -2060,7 +2062,7 @@ def _build_hub_translations(
|
|
|
2060
2062
|
"th_sk_ver": "Version",
|
|
2061
2063
|
"th_sk_cap": "Core Capabilities",
|
|
2062
2064
|
|
|
2063
|
-
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.1.
|
|
2065
|
+
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.1.4 • Copyright © Thế Vị (@TeeVee98) • Autonomous AI Agent Testing Ecosystem",
|
|
2064
2066
|
}
|
|
2065
2067
|
|
|
2066
2068
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
package/tools/db_sandbox.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Zero-Pollution Database Sandbox & Ephemeral Teardown Engine
|
|
4
7
|
---------------------------------------------------------------------
|
|
@@ -550,7 +553,7 @@ def wait_for_ready(target: str, strategy: str = "auto", timeout_sec: float = 30.
|
|
|
550
553
|
"error": None,
|
|
551
554
|
}
|
|
552
555
|
last_error = detail
|
|
553
|
-
time.sleep(backoff)
|
|
556
|
+
time.sleep(backoff) # synapse-ignore: HARD_DELAY_ANTI_PATTERN
|
|
554
557
|
backoff = min(backoff * 2, 2.0)
|
|
555
558
|
|
|
556
559
|
return {
|
package/tools/debt_harvester.py
CHANGED
|
@@ -29,8 +29,8 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
29
29
|
try:
|
|
30
30
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
31
31
|
sys.stderr.reconfigure(encoding='utf-8')
|
|
32
|
-
except Exception
|
|
33
|
-
|
|
32
|
+
except Exception:
|
|
33
|
+
pass
|
|
34
34
|
|
|
35
35
|
# Default directories to ignore during scan
|
|
36
36
|
IGNORED_DIRS = {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/diagram_architect.py — Standalone Self-Contained SVG & HTML Diagram Builder
|
package/tools/distill_log.py
CHANGED
|
@@ -149,12 +149,16 @@ def distill(
|
|
|
149
149
|
max_lines: int = 40,
|
|
150
150
|
exit_code: Optional[int] = None,
|
|
151
151
|
raw_log_path: Optional[str] = None,
|
|
152
|
-
token_budget: int = 800,
|
|
152
|
+
token_budget: Optional[int] = 800,
|
|
153
153
|
) -> str:
|
|
154
154
|
"""
|
|
155
155
|
Distills raw execution logs down to high-signal failure blocks while guaranteeing
|
|
156
156
|
zero false passes, zero false-positive assertions on info logs, and enforcing token budgets.
|
|
157
157
|
"""
|
|
158
|
+
if token_budget is not None:
|
|
159
|
+
if isinstance(token_budget, bool) or not isinstance(token_budget, int) or token_budget < 0:
|
|
160
|
+
raise ValueError(f"token_budget must be a non-negative integer (>= 0), got {token_budget}")
|
|
161
|
+
|
|
158
162
|
raw_bytes = len(log_text.encode("utf-8"))
|
|
159
163
|
lines = log_text.splitlines()
|
|
160
164
|
total_raw_lines = len(lines)
|
|
@@ -440,13 +444,29 @@ def shrink_tokens(text: str, max_chars_per_line: int = 140) -> str:
|
|
|
440
444
|
return "\n".join(shrunk_lines)
|
|
441
445
|
|
|
442
446
|
|
|
447
|
+
def _non_negative_int(val: str) -> int:
|
|
448
|
+
try:
|
|
449
|
+
ival = int(val)
|
|
450
|
+
except ValueError:
|
|
451
|
+
raise argparse.ArgumentTypeError(f"Invalid integer value: {val!r}")
|
|
452
|
+
if ival < 0:
|
|
453
|
+
raise argparse.ArgumentTypeError(f"token-budget must be a non-negative integer (>= 0), got {ival}")
|
|
454
|
+
return ival
|
|
455
|
+
|
|
456
|
+
|
|
443
457
|
def main():
|
|
444
458
|
parser = argparse.ArgumentParser(description="Distill terminal execution logs into high-signal failure blocks.")
|
|
445
459
|
parser.add_argument("--file", "-f", help="Path to raw log file (reads from stdin if omitted).")
|
|
446
460
|
parser.add_argument("--exit-code", "-e", type=int, default=None, help="Process exit code from test runner.")
|
|
447
461
|
parser.add_argument("--save-raw", "-s", default=None, help="Path to preserve raw log.")
|
|
448
462
|
parser.add_argument("--max-lines", "-m", type=int, default=40, help="Maximum number of output lines.")
|
|
449
|
-
parser.add_argument(
|
|
463
|
+
parser.add_argument(
|
|
464
|
+
"--token-budget",
|
|
465
|
+
"-b",
|
|
466
|
+
type=_non_negative_int,
|
|
467
|
+
default=800,
|
|
468
|
+
help="Maximum token budget for distilled output (must be >= 0).",
|
|
469
|
+
)
|
|
450
470
|
parser.add_argument("--shrink", action="store_true", help="Apply caveman/shrink token compression.")
|
|
451
471
|
args = parser.parse_args()
|
|
452
472
|
|
package/tools/e2e_flow_prober.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise E2E Flow Prober & XPath Crawler Dispatcher (Cross-Platform)
|
|
4
7
|
----------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/export_postman_collection.py — Enterprise API to Postman Collection v2.1.0 Exporter (Postman Pinnacle)
|
package/tools/flaky_detector.py
CHANGED
package/tools/fsm_enforcer.py
CHANGED
|
@@ -135,8 +135,8 @@ def compute_artifact_hashes(artifacts: List[str], base_dir: Optional[str] = None
|
|
|
135
135
|
with open(target, "rb") as f:
|
|
136
136
|
file_bytes = f.read()
|
|
137
137
|
hashes[item] = hashlib.sha256(file_bytes).hexdigest()
|
|
138
|
-
except OSError
|
|
139
|
-
|
|
138
|
+
except OSError:
|
|
139
|
+
continue
|
|
140
140
|
return hashes
|
|
141
141
|
|
|
142
142
|
|
package/tools/fuzz_payloads.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Edge-Case Fuzzing & Input Sanitization Payload Catalog
|
|
4
7
|
------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Allure HTML Report Generator (Cross-Platform)
|
|
4
7
|
---------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/generate_api_matrix.py — OpenAPI / Swagger to E2E Testing Matrix Generator
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
# -*- coding: utf-8 -*-
|
|
3
6
|
"""
|
|
4
7
|
tools/generate_jmx_plan.py — Enterprise Apache JMeter 5.x Test Plan XML Generator (JMeter 360° Pinnacle)
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Test Report Aggregator & summaryTemp Generator (Cross-Platform)
|
|
4
7
|
-------------------------------------------------------------------------
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
2
5
|
"""
|
|
3
6
|
Enterprise Git Pre-Commit Architecture & Discipline Guard
|
|
4
7
|
--------------------------------------------------
|
|
@@ -23,7 +26,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
23
26
|
except Exception:
|
|
24
27
|
pass
|
|
25
28
|
|
|
26
|
-
FORBIDDEN_PATHS = ["/Users/", "C:\\Workspace\\", "D:\\Workspace\\", "file:///c:", "file:///d:"]
|
|
29
|
+
FORBIDDEN_PATHS = ["/Users/", "/home/", "C:\\Workspace\\", "D:\\Workspace\\", "file:///c:", "file:///d:"]
|
|
27
30
|
FORBIDDEN_HUB_PREFIXES = (
|
|
28
31
|
"Scripts/", "Keywords/", "Object Repository/", "Test Suites/", "Data Files/", "Include/",
|
|
29
32
|
"e2e/", "pages/", "cypress/"
|
|
@@ -94,13 +97,15 @@ def check_forbidden_paths(files):
|
|
|
94
97
|
if not os.path.exists(f) or os.path.isdir(f):
|
|
95
98
|
continue
|
|
96
99
|
# Skip this guard script itself and binary files
|
|
97
|
-
if
|
|
100
|
+
if os.path.basename(f) == "git_pre_commit_guard.py" or f.endswith(
|
|
101
|
+
(".db", ".png", ".jpg", ".jpeg", ".zip", ".tar", ".gz", ".ico", ".bin")
|
|
102
|
+
):
|
|
98
103
|
continue
|
|
99
104
|
try:
|
|
100
105
|
with open(f, "r", encoding="utf-8", errors="ignore") as fp:
|
|
101
106
|
for line_no, line in enumerate(fp, 1):
|
|
102
107
|
# Allow mention in historical report or gitignore
|
|
103
|
-
if "FINAL_REPORT.md" in f or ".gitignore" in f:
|
|
108
|
+
if "FINAL_REPORT.md" in f or "AUDIT_REPORT.md" in f or "PROJECT_HEALTH_REPORT.md" in f or ".gitignore" in f:
|
|
104
109
|
continue
|
|
105
110
|
for forbidden in FORBIDDEN_PATHS:
|
|
106
111
|
if forbidden in line:
|
|
@@ -115,6 +120,9 @@ def check_scripts_clean_pom(files):
|
|
|
115
120
|
xpath_pattern = re.compile(
|
|
116
121
|
r'(?<!:)//(?:\*|table|input|button|div|span|form|select|textarea|a(?=[\[/@\s\'"]|$))'
|
|
117
122
|
)
|
|
123
|
+
semantic_locator_pattern = re.compile(
|
|
124
|
+
r'(?:page|frame)\.(?:getByRole|getByLabel|getByPlaceholder|getByText|getByTestId|getByAltText|getByTitle)\s*\('
|
|
125
|
+
)
|
|
118
126
|
for f in files:
|
|
119
127
|
if not os.path.exists(f):
|
|
120
128
|
continue
|
|
@@ -133,6 +141,8 @@ def check_scripts_clean_pom(files):
|
|
|
133
141
|
violations.append((f, line_no, "Raw findTestObject is forbidden in test scripts"))
|
|
134
142
|
if "xpath=" in line:
|
|
135
143
|
violations.append((f, line_no, "Explicit xpath= locator is forbidden in test scripts"))
|
|
144
|
+
if semantic_locator_pattern.search(line):
|
|
145
|
+
violations.append((f, line_no, "Raw Playwright semantic locator is forbidden in test scripts (encapsulate in Page Class)"))
|
|
136
146
|
# Strip standard HTTP/HTTPS URLs before checking XPath syntax
|
|
137
147
|
line_no_urls = re.sub(r'https?://[^\s\'"]+', '', line)
|
|
138
148
|
if "//" in line_no_urls and xpath_pattern.search(line_no_urls):
|
package/tools/heal/__init__.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: © 2026 Thế Vị (@TeeVee98) <https://github.com/TeeVee98/Synapse-Hub>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
1
4
|
"""
|
|
2
5
|
Synapse Hub — Self-Healing & Autonomous Repair Engines (tools.heal)
|
|
3
6
|
-------------------------------------------------------------------
|