@teevee98/synapse-hub 4.3.1 → 4.4.0
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/agents/api-engineer.md +8 -0
- package/.agents/agents/perf-engineer.md +10 -2
- package/.agents/rules/performance_testing_rules.md +4 -3
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +6 -3
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +3 -1
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +11 -5
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +4 -1
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/references/performance_test_plan_29119.md +106 -0
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +75 -14
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +13 -2
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +4 -1
- package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +8 -1
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +4 -1
- package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +8 -0
- package/.agents/templates/performance-test-plan-template.md +106 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +95 -2
- package/docs/ARCHITECTURE.md +86 -2
- package/docs/TOOL_CATALOG.md +11 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +1 -1
- package/synapse.config.json +1 -1
- package/tools/.infer_baseline.json +44 -3
- package/tools/TOOLS_RUNBOOK.md +237 -0
- package/tools/TOOL_CATALOG.json +138 -3
- package/tools/__init__.py +1 -1
- package/tools/ai_eval_sentinel.py +403 -0
- package/tools/asvs_auditor.py +410 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/chaos_resilience_probe.py +362 -0
- package/tools/cldr_l10n_verifier.py +309 -0
- package/tools/cli.py +187 -3
- package/tools/cvss_calculator.py +412 -0
- package/tools/dashboard_generator.py +8 -8
- package/tools/etl_data_reconciler.py +460 -0
- package/tools/generate_jmx_plan.py +12 -4
- package/tools/jtl_analyzer.py +23 -1
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +1 -1
- package/tools/mobile_resilience_sentinel.py +273 -0
- package/tools/observability_tester.py +235 -0
- package/tools/payment_interop_simulator.py +337 -0
- package/tools/pre_push_guard.py +306 -0
- package/tools/regulatory_compliance.py +336 -0
- package/tools/rules_router.py +1 -1
- package/tools/tmmi_auditor.py +172 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/vpat_exporter.py +428 -0
- package/tools/welcome_page.py +1 -1
|
@@ -1033,7 +1033,7 @@ def _get_target_gates() -> List[Dict[str, str]]:
|
|
|
1033
1033
|
"id": "Gate 2",
|
|
1034
1034
|
"name_vi": "Đường Dẫn Linh Hoạt (Path Portability)",
|
|
1035
1035
|
"name_en": "Path Portability",
|
|
1036
|
-
"desc_vi": "Không gắn cứng đường dẫn máy tính cá nhân
|
|
1036
|
+
"desc_vi": "Không gắn cứng đường dẫn máy tính cá nhân tuyệt đối, chạy mượt trên mọi môi trường",
|
|
1037
1037
|
"desc_en": "Zero machine-specific absolute paths in project test sources",
|
|
1038
1038
|
"status": "PASS",
|
|
1039
1039
|
},
|
|
@@ -1350,7 +1350,7 @@ def _build_target_translations(
|
|
|
1350
1350
|
"th_step_status": "Trạng Thái",
|
|
1351
1351
|
"th_step_details": "Chi Tiết Kỹ Thuật (OTel & AST)",
|
|
1352
1352
|
|
|
1353
|
-
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.
|
|
1353
|
+
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.4.0 • Bản quyền © Thế Vị (@TeeVee98) • Chuẩn Clean POM & Kiểm Thử Tự Chủ",
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
1356
|
translations_en = {
|
|
@@ -1428,7 +1428,7 @@ def _build_target_translations(
|
|
|
1428
1428
|
"th_step_status": "Status",
|
|
1429
1429
|
"th_step_details": "Technical Details (OTel & AST)",
|
|
1430
1430
|
|
|
1431
|
-
"footer_text": "Generated automatically by Synapse-Hub v4.
|
|
1431
|
+
"footer_text": "Generated automatically by Synapse-Hub v4.4.0 • Copyright © Thế Vị (@TeeVee98) • Clean POM & Autonomous Testing",
|
|
1432
1432
|
}
|
|
1433
1433
|
|
|
1434
1434
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -1734,7 +1734,7 @@ def _get_hub_gates() -> List[Dict[str, str]]:
|
|
|
1734
1734
|
"id": "Gate 2",
|
|
1735
1735
|
"name_vi": "Đường Dẫn Linh Hoạt (Path Portability)",
|
|
1736
1736
|
"name_en": "Path Portability",
|
|
1737
|
-
"desc_vi": "Không gắn cứng đường dẫn máy tính cá nhân
|
|
1737
|
+
"desc_vi": "Không gắn cứng đường dẫn máy tính cá nhân tuyệt đối, chạy mượt trên mọi môi trường",
|
|
1738
1738
|
"desc_en": "Zero absolute machine paths across repository",
|
|
1739
1739
|
"status": "PASS",
|
|
1740
1740
|
},
|
|
@@ -1917,7 +1917,7 @@ def _build_hub_translations(
|
|
|
1917
1917
|
"""Builds bilingual dictionaries for Hub Dashboard."""
|
|
1918
1918
|
translations_vi = {
|
|
1919
1919
|
"header_title": "Bảng Điều Hành Chất Lượng Doanh Nghiệp",
|
|
1920
|
-
"header_subtitle": "Synapse-Hub v4.
|
|
1920
|
+
"header_subtitle": "Synapse-Hub v4.4.0 • Hệ Sinh Thái Kiểm Thử AI Agent Tự Chủ",
|
|
1921
1921
|
"nav_welcome": "Giới Thiệu",
|
|
1922
1922
|
"meta_mode": "🏷️ Chế độ: <strong>HỆ SINH THÁI QA HUB</strong>",
|
|
1923
1923
|
"meta_gen": f"🕒 Khởi tạo: <strong>{now_str}</strong>",
|
|
@@ -1987,12 +1987,12 @@ def _build_hub_translations(
|
|
|
1987
1987
|
"th_sk_ver": "Phiên Bản",
|
|
1988
1988
|
"th_sk_cap": "Khả Năng Nghiệp Vụ Cốt Lõi",
|
|
1989
1989
|
|
|
1990
|
-
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.
|
|
1990
|
+
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.4.0 • Bản quyền © Thế Vị (@TeeVee98) • Hệ Thống Kiểm Thử AI Agent Tự Chủ",
|
|
1991
1991
|
}
|
|
1992
1992
|
|
|
1993
1993
|
translations_en = {
|
|
1994
1994
|
"header_title": "Enterprise QA Executive Dashboard",
|
|
1995
|
-
"header_subtitle": "Synapse-Hub v4.
|
|
1995
|
+
"header_subtitle": "Synapse-Hub v4.4.0 • Autonomous AI Agent Testing Ecosystem",
|
|
1996
1996
|
"nav_welcome": "Welcome",
|
|
1997
1997
|
"meta_mode": "🏷️ Mode: <strong>QA HUB ECOSYSTEM</strong>",
|
|
1998
1998
|
"meta_gen": f"🕒 Generated: <strong>{now_str}</strong>",
|
|
@@ -2062,7 +2062,7 @@ def _build_hub_translations(
|
|
|
2062
2062
|
"th_sk_ver": "Version",
|
|
2063
2063
|
"th_sk_cap": "Core Capabilities",
|
|
2064
2064
|
|
|
2065
|
-
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.
|
|
2065
|
+
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.4.0 • Copyright © Thế Vị (@TeeVee98) • Autonomous AI Agent Testing Ecosystem",
|
|
2066
2066
|
}
|
|
2067
2067
|
|
|
2068
2068
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee98). All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# Project: Synapse-Hub (https://github.com/TeeVee98/Synapse-Hub)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
tools/etl_data_reconciler.py — Enterprise Data Quality & ETL Reconciliation Engine
|
|
8
|
+
-----------------------------------------------------------------------------------
|
|
9
|
+
Implements standards for Data Quality & Migration Verification:
|
|
10
|
+
1. ISO/IEC 25012 Data Quality Model: Evaluates 5 core inherent characteristics:
|
|
11
|
+
- Accuracy (syntactic & semantic conformance)
|
|
12
|
+
- Completeness (record count, null/empty ratio)
|
|
13
|
+
- Consistency (uniqueness, referential and cross-field logic)
|
|
14
|
+
- Currentness / Freshness (timestamp SLA vs threshold)
|
|
15
|
+
- Validity (domain range & enum conformance)
|
|
16
|
+
2. DAMA-DMBOK ETL & Migration Reconciliation:
|
|
17
|
+
- Row count comparison (Source vs Target)
|
|
18
|
+
- Key delta detection (Dropped rows vs Ghost/Orphaned rows)
|
|
19
|
+
- Column value hash & cell-level difference analysis
|
|
20
|
+
- Numeric aggregation parity (SUM, AVG, MIN, MAX comparison)
|
|
21
|
+
- Schema drift & data truncation detection
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
python tools/etl_data_reconciler.py --quality-audit data.json
|
|
25
|
+
python tools/etl_data_reconciler.py --reconcile --source source.json --target target.json --key id
|
|
26
|
+
python tools/etl_data_reconciler.py --reconcile --source source.csv --target target.csv --key id --gate
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
import os
|
|
30
|
+
import sys
|
|
31
|
+
import json
|
|
32
|
+
import csv
|
|
33
|
+
import hashlib
|
|
34
|
+
import argparse
|
|
35
|
+
from datetime import datetime, timezone
|
|
36
|
+
from typing import Dict, List, Any, Optional
|
|
37
|
+
|
|
38
|
+
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
39
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
40
|
+
try:
|
|
41
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
42
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
43
|
+
except Exception:
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# ==============================================================================
|
|
48
|
+
# DATA INGESTION HELPERS
|
|
49
|
+
# ==============================================================================
|
|
50
|
+
|
|
51
|
+
def load_dataset(file_path: str) -> List[Dict[str, Any]]:
|
|
52
|
+
"""Loads a dataset from JSON or CSV file into a list of row dicts."""
|
|
53
|
+
if not os.path.exists(file_path):
|
|
54
|
+
raise FileNotFoundError(f"Dataset file not found: {file_path}")
|
|
55
|
+
|
|
56
|
+
ext = os.path.splitext(file_path)[1].lower()
|
|
57
|
+
if ext == ".json":
|
|
58
|
+
with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
|
|
59
|
+
data = json.load(f)
|
|
60
|
+
if isinstance(data, list):
|
|
61
|
+
return data
|
|
62
|
+
elif isinstance(data, dict):
|
|
63
|
+
# Search for first list in dict
|
|
64
|
+
for v in data.values():
|
|
65
|
+
if isinstance(v, list) and v and isinstance(v[0], dict):
|
|
66
|
+
return v
|
|
67
|
+
return [data]
|
|
68
|
+
elif ext in (".csv", ".tsv"):
|
|
69
|
+
delimiter = "\t" if ext == ".tsv" else ","
|
|
70
|
+
rows = []
|
|
71
|
+
with open(file_path, "r", encoding="utf-8", errors="ignore") as f:
|
|
72
|
+
reader = csv.DictReader(f, delimiter=delimiter)
|
|
73
|
+
for row in reader:
|
|
74
|
+
rows.append(dict(row))
|
|
75
|
+
return rows
|
|
76
|
+
else:
|
|
77
|
+
raise ValueError(f"Unsupported file format '{ext}'. Expected .json or .csv.")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def compute_row_hash(row: Dict[str, Any], excluded_keys: Optional[List[str]] = None) -> str:
|
|
81
|
+
"""Computes a deterministic SHA-256 hash of a normalized row dictionary."""
|
|
82
|
+
excluded = set(excluded_keys or [])
|
|
83
|
+
canonical = {k: str(row[k]).strip() for k in sorted(row.keys()) if k not in excluded}
|
|
84
|
+
serialized = json.dumps(canonical, sort_keys=True, ensure_ascii=False)
|
|
85
|
+
return hashlib.sha256(serialized.encode("utf-8")).hexdigest()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
# ==============================================================================
|
|
89
|
+
# ISO/IEC 25012 DATA QUALITY EVALUATOR
|
|
90
|
+
# ==============================================================================
|
|
91
|
+
|
|
92
|
+
def evaluate_iso_25012_quality(
|
|
93
|
+
rows: List[Dict[str, Any]],
|
|
94
|
+
schema_spec: Optional[Dict[str, Any]] = None,
|
|
95
|
+
max_freshness_hours: float = 24.0,
|
|
96
|
+
timestamp_col: Optional[str] = None,
|
|
97
|
+
) -> Dict[str, Any]:
|
|
98
|
+
"""
|
|
99
|
+
Evaluates dataset against ISO/IEC 25012 Inherent Data Quality characteristics.
|
|
100
|
+
Returns quantitative scores (0.0 to 100.0%) and detailed violation lists.
|
|
101
|
+
"""
|
|
102
|
+
if not rows:
|
|
103
|
+
return {
|
|
104
|
+
"standard": "ISO/IEC 25012",
|
|
105
|
+
"overall_score": 0.0,
|
|
106
|
+
"total_rows": 0,
|
|
107
|
+
"characteristics": {},
|
|
108
|
+
"verdict": "FAIL_EMPTY_DATASET",
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
total_rows = len(rows)
|
|
112
|
+
all_columns = list(rows[0].keys())
|
|
113
|
+
schema = schema_spec or {}
|
|
114
|
+
|
|
115
|
+
# 1. COMPLETENESS: Ratio of non-null, non-empty cells
|
|
116
|
+
total_cells = total_rows * len(all_columns)
|
|
117
|
+
null_cells = 0
|
|
118
|
+
null_per_col = {col: 0 for col in all_columns}
|
|
119
|
+
|
|
120
|
+
for r in rows:
|
|
121
|
+
for col in all_columns:
|
|
122
|
+
val = r.get(col)
|
|
123
|
+
if val is None or str(val).strip() in ("", "NULL", "null", "None", "NaN"):
|
|
124
|
+
null_cells += 1
|
|
125
|
+
null_per_col[col] += 1
|
|
126
|
+
|
|
127
|
+
completeness_score = round(((total_cells - null_cells) / total_cells) * 100, 2)
|
|
128
|
+
|
|
129
|
+
# 2. CONSISTENCY: Uniqueness & Cross-field logic
|
|
130
|
+
# Check duplicate primary keys or full rows
|
|
131
|
+
seen_hashes = set()
|
|
132
|
+
duplicate_rows = 0
|
|
133
|
+
for r in rows:
|
|
134
|
+
h = compute_row_hash(r)
|
|
135
|
+
if h in seen_hashes:
|
|
136
|
+
duplicate_rows += 1
|
|
137
|
+
seen_hashes.add(h)
|
|
138
|
+
|
|
139
|
+
consistency_score = round(max(0.0, ((total_rows - duplicate_rows) / total_rows) * 100), 2)
|
|
140
|
+
|
|
141
|
+
# 3. ACCURACY & VALIDITY: Type & Schema conformance
|
|
142
|
+
invalid_cells = 0
|
|
143
|
+
validity_errors = []
|
|
144
|
+
|
|
145
|
+
for idx, r in enumerate(rows):
|
|
146
|
+
for col, col_rules in schema.items():
|
|
147
|
+
if col not in r:
|
|
148
|
+
continue
|
|
149
|
+
val = r[col]
|
|
150
|
+
if val is None or str(val).strip() == "":
|
|
151
|
+
continue
|
|
152
|
+
|
|
153
|
+
expected_type = col_rules.get("type")
|
|
154
|
+
if expected_type == "int":
|
|
155
|
+
try:
|
|
156
|
+
int(val)
|
|
157
|
+
except ValueError:
|
|
158
|
+
invalid_cells += 1
|
|
159
|
+
validity_errors.append({"row": idx, "col": col, "val": val, "expected": "int"})
|
|
160
|
+
elif expected_type == "float":
|
|
161
|
+
try:
|
|
162
|
+
float(val)
|
|
163
|
+
except ValueError:
|
|
164
|
+
invalid_cells += 1
|
|
165
|
+
validity_errors.append({"row": idx, "col": col, "val": val, "expected": "float"})
|
|
166
|
+
|
|
167
|
+
allowed_enums = col_rules.get("enum")
|
|
168
|
+
if allowed_enums and str(val).strip() not in allowed_enums:
|
|
169
|
+
invalid_cells += 1
|
|
170
|
+
validity_errors.append({"row": idx, "col": col, "val": val, "allowed": allowed_enums})
|
|
171
|
+
|
|
172
|
+
accuracy_score = round(max(0.0, ((total_cells - invalid_cells) / total_cells) * 100), 2)
|
|
173
|
+
|
|
174
|
+
# 4. CURRENTNESS / FRESHNESS: Timestamp SLA
|
|
175
|
+
currentness_score = 100.0
|
|
176
|
+
freshness_details = "Not evaluated (no timestamp column specified)"
|
|
177
|
+
ts_key = timestamp_col
|
|
178
|
+
if not ts_key:
|
|
179
|
+
for candidate in ("created_at", "updated_at", "timestamp", "date", "created_date"):
|
|
180
|
+
if candidate in all_columns:
|
|
181
|
+
ts_key = candidate
|
|
182
|
+
break
|
|
183
|
+
|
|
184
|
+
if ts_key:
|
|
185
|
+
newest_ts: Optional[datetime] = None
|
|
186
|
+
for r in rows:
|
|
187
|
+
raw_ts = r.get(ts_key)
|
|
188
|
+
if raw_ts:
|
|
189
|
+
try:
|
|
190
|
+
dt = datetime.fromisoformat(str(raw_ts).replace("Z", "+00:00"))
|
|
191
|
+
if newest_ts is None or dt > newest_ts:
|
|
192
|
+
newest_ts = dt
|
|
193
|
+
except Exception:
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
if newest_ts:
|
|
197
|
+
now = datetime.now(timezone.utc)
|
|
198
|
+
if newest_ts.tzinfo is None:
|
|
199
|
+
newest_ts = newest_ts.replace(tzinfo=timezone.utc)
|
|
200
|
+
hours_old = max(0.0, (now - newest_ts).total_seconds() / 3600.0)
|
|
201
|
+
if hours_old > max_freshness_hours:
|
|
202
|
+
decay = min(100.0, (hours_old - max_freshness_hours) * 2.0)
|
|
203
|
+
currentness_score = round(max(0.0, 100.0 - decay), 2)
|
|
204
|
+
freshness_details = f"Latest record age: {round(hours_old, 1)} hrs (SLA: <= {max_freshness_hours} hrs)"
|
|
205
|
+
|
|
206
|
+
# Overall Composite Score
|
|
207
|
+
weights = {"completeness": 0.30, "accuracy": 0.30, "consistency": 0.25, "currentness": 0.15}
|
|
208
|
+
overall_score = round(
|
|
209
|
+
(weights["completeness"] * completeness_score)
|
|
210
|
+
+ (weights["accuracy"] * accuracy_score)
|
|
211
|
+
+ (weights["consistency"] * consistency_score)
|
|
212
|
+
+ (weights["currentness"] * currentness_score),
|
|
213
|
+
2,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
return {
|
|
217
|
+
"standard": "ISO/IEC 25012 Data Quality Model",
|
|
218
|
+
"overall_score": overall_score,
|
|
219
|
+
"total_rows": total_rows,
|
|
220
|
+
"total_columns": len(all_columns),
|
|
221
|
+
"characteristics": {
|
|
222
|
+
"completeness": {"score": completeness_score, "null_cells": null_cells, "null_by_column": null_per_col},
|
|
223
|
+
"consistency": {"score": consistency_score, "duplicate_rows": duplicate_rows},
|
|
224
|
+
"accuracy_and_validity": {"score": accuracy_score, "invalid_cells": invalid_cells, "sample_errors": validity_errors[:5]},
|
|
225
|
+
"currentness": {"score": currentness_score, "details": freshness_details},
|
|
226
|
+
},
|
|
227
|
+
"verdict": "PASS" if overall_score >= 85.0 else "FAIL_QUALITY_BELOW_SLA",
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# ==============================================================================
|
|
232
|
+
# DAMA-DMBOK ETL RECONCILIATION & DATA MIGRATION DIFF ENGINE
|
|
233
|
+
# ==============================================================================
|
|
234
|
+
|
|
235
|
+
def reconcile_etl_datasets(
|
|
236
|
+
source_rows: List[Dict[str, Any]],
|
|
237
|
+
target_rows: List[Dict[str, Any]],
|
|
238
|
+
primary_key: str,
|
|
239
|
+
numeric_columns: Optional[List[str]] = None,
|
|
240
|
+
tolerance: float = 1e-4,
|
|
241
|
+
) -> Dict[str, Any]:
|
|
242
|
+
"""
|
|
243
|
+
Performs comprehensive DAMA-DMBOK Source vs Target ETL reconciliation:
|
|
244
|
+
1. Row Count Parity
|
|
245
|
+
2. Key Delta (Dropped vs Ghost records)
|
|
246
|
+
3. Row Value Drift & Cell Differences
|
|
247
|
+
4. Aggregate Financial / Numeric Parity (SUM, AVG)
|
|
248
|
+
5. Schema Drift
|
|
249
|
+
"""
|
|
250
|
+
source_count = len(source_rows)
|
|
251
|
+
target_count = len(target_rows)
|
|
252
|
+
|
|
253
|
+
# 1. Schema Drift Check
|
|
254
|
+
source_cols = set(source_rows[0].keys()) if source_rows else set()
|
|
255
|
+
target_cols = set(target_rows[0].keys()) if target_rows else set()
|
|
256
|
+
missing_in_target_cols = list(source_cols - target_cols)
|
|
257
|
+
extra_in_target_cols = list(target_cols - source_cols)
|
|
258
|
+
|
|
259
|
+
# 2. Key Mapping & Delta Analysis
|
|
260
|
+
source_map: Dict[str, Dict[str, Any]] = {}
|
|
261
|
+
for r in source_rows:
|
|
262
|
+
k = str(r.get(primary_key, "")).strip()
|
|
263
|
+
if k:
|
|
264
|
+
source_map[k] = r
|
|
265
|
+
|
|
266
|
+
target_map: Dict[str, Dict[str, Any]] = {}
|
|
267
|
+
for r in target_rows:
|
|
268
|
+
k = str(r.get(primary_key, "")).strip()
|
|
269
|
+
if k:
|
|
270
|
+
target_map[k] = r
|
|
271
|
+
|
|
272
|
+
source_keys = set(source_map.keys())
|
|
273
|
+
target_keys = set(target_map.keys())
|
|
274
|
+
|
|
275
|
+
dropped_keys = list(source_keys - target_keys)
|
|
276
|
+
ghost_keys = list(target_keys - source_keys)
|
|
277
|
+
common_keys = source_keys.intersection(target_keys)
|
|
278
|
+
|
|
279
|
+
# 3. Value Drift / Cell Differences across common records
|
|
280
|
+
mutated_records = []
|
|
281
|
+
for k in sorted(common_keys):
|
|
282
|
+
s_row = source_map[k]
|
|
283
|
+
t_row = target_map[k]
|
|
284
|
+
diffs = {}
|
|
285
|
+
for col in source_cols.intersection(target_cols):
|
|
286
|
+
s_val = str(s_row.get(col, "")).strip()
|
|
287
|
+
t_val = str(t_row.get(col, "")).strip()
|
|
288
|
+
if s_val != t_val:
|
|
289
|
+
diffs[col] = {"source": s_val, "target": t_val}
|
|
290
|
+
|
|
291
|
+
if diffs:
|
|
292
|
+
mutated_records.append({
|
|
293
|
+
"key": k,
|
|
294
|
+
"differences_count": len(diffs),
|
|
295
|
+
"differences": diffs,
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
# 4. Numeric Aggregation Parity (e.g. Total Revenue, Quantities)
|
|
299
|
+
agg_parity = {}
|
|
300
|
+
if numeric_columns:
|
|
301
|
+
for num_col in numeric_columns:
|
|
302
|
+
if num_col in source_cols and num_col in target_cols:
|
|
303
|
+
s_vals = []
|
|
304
|
+
for r in source_rows:
|
|
305
|
+
try:
|
|
306
|
+
s_vals.append(float(r[num_col]))
|
|
307
|
+
except (ValueError, TypeError):
|
|
308
|
+
pass
|
|
309
|
+
|
|
310
|
+
t_vals = []
|
|
311
|
+
for r in target_rows:
|
|
312
|
+
try:
|
|
313
|
+
t_vals.append(float(r[num_col]))
|
|
314
|
+
except (ValueError, TypeError):
|
|
315
|
+
pass
|
|
316
|
+
|
|
317
|
+
s_sum = round(sum(s_vals), 4)
|
|
318
|
+
t_sum = round(sum(t_vals), 4)
|
|
319
|
+
diff = round(abs(s_sum - t_sum), 4)
|
|
320
|
+
is_equal = diff <= tolerance
|
|
321
|
+
|
|
322
|
+
agg_parity[num_col] = {
|
|
323
|
+
"source_sum": s_sum,
|
|
324
|
+
"target_sum": t_sum,
|
|
325
|
+
"difference": diff,
|
|
326
|
+
"is_balanced": is_equal,
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
# Reconciliation Verdict
|
|
330
|
+
is_reconciled = (
|
|
331
|
+
(source_count == target_count)
|
|
332
|
+
and (len(dropped_keys) == 0)
|
|
333
|
+
and (len(ghost_keys) == 0)
|
|
334
|
+
and (len(mutated_records) == 0)
|
|
335
|
+
and all(agg["is_balanced"] for agg in agg_parity.values())
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
return {
|
|
339
|
+
"standard": "DAMA-DMBOK Data Reconciliation & Migration Framework",
|
|
340
|
+
"is_reconciled": is_reconciled,
|
|
341
|
+
"primary_key": primary_key,
|
|
342
|
+
"row_counts": {
|
|
343
|
+
"source": source_count,
|
|
344
|
+
"target": target_count,
|
|
345
|
+
"variance": target_count - source_count,
|
|
346
|
+
},
|
|
347
|
+
"key_deltas": {
|
|
348
|
+
"dropped_in_target_count": len(dropped_keys),
|
|
349
|
+
"dropped_sample": dropped_keys[:5],
|
|
350
|
+
"ghost_in_target_count": len(ghost_keys),
|
|
351
|
+
"ghost_sample": ghost_keys[:5],
|
|
352
|
+
},
|
|
353
|
+
"data_mutations": {
|
|
354
|
+
"mutated_records_count": len(mutated_records),
|
|
355
|
+
"sample_mutations": mutated_records[:3],
|
|
356
|
+
},
|
|
357
|
+
"schema_drift": {
|
|
358
|
+
"missing_in_target_columns": missing_in_target_cols,
|
|
359
|
+
"extra_in_target_columns": extra_in_target_cols,
|
|
360
|
+
},
|
|
361
|
+
"numeric_aggregation_parity": agg_parity,
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
# ==============================================================================
|
|
366
|
+
# CLI HANDLER
|
|
367
|
+
# ==============================================================================
|
|
368
|
+
|
|
369
|
+
def main():
|
|
370
|
+
parser = argparse.ArgumentParser(
|
|
371
|
+
description="Synapse Hub Data Quality (ISO 25012) & ETL Reconciliation (DAMA-DMBOK) Engine",
|
|
372
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
373
|
+
)
|
|
374
|
+
parser.add_argument("--quality-audit", help="Path to JSON/CSV dataset to audit for ISO 25012 data quality")
|
|
375
|
+
parser.add_argument("--reconcile", action="store_true", help="Execute DAMA-DMBOK source vs target reconciliation")
|
|
376
|
+
parser.add_argument("--source", help="Path to Source dataset (JSON or CSV)")
|
|
377
|
+
parser.add_argument("--target", help="Path to Target dataset (JSON or CSV)")
|
|
378
|
+
parser.add_argument("--key", default="id", help="Primary Key column name for reconciliation (default: 'id')")
|
|
379
|
+
parser.add_argument("--num-cols", help="Comma-separated numeric columns to verify aggregation parity")
|
|
380
|
+
parser.add_argument("--gate", action="store_true", help="Quality Gate: Exit code 1 if reconciliation or quality fails")
|
|
381
|
+
parser.add_argument("--json", action="store_true", help="Output results in JSON format")
|
|
382
|
+
|
|
383
|
+
args = parser.parse_args()
|
|
384
|
+
|
|
385
|
+
if args.quality_audit:
|
|
386
|
+
try:
|
|
387
|
+
rows = load_dataset(args.quality_audit)
|
|
388
|
+
res = evaluate_iso_25012_quality(rows)
|
|
389
|
+
except Exception as e:
|
|
390
|
+
print(f"❌ Error loading dataset: {e}", file=sys.stderr)
|
|
391
|
+
return 2
|
|
392
|
+
|
|
393
|
+
if args.json:
|
|
394
|
+
print(json.dumps(res, indent=2, ensure_ascii=False))
|
|
395
|
+
else:
|
|
396
|
+
c = res["characteristics"]
|
|
397
|
+
print("=" * 72)
|
|
398
|
+
print(" SYNAPSE HUB — ISO/IEC 25012 DATA QUALITY SCORECARD")
|
|
399
|
+
print("=" * 72)
|
|
400
|
+
print(f" Target File : {args.quality_audit}")
|
|
401
|
+
print(f" Total Rows / Cols : {res['total_rows']} rows / {res['total_columns']} cols")
|
|
402
|
+
print(f" Overall Quality Score: \033[1m{res['overall_score']}%\033[0m ({res['verdict']})")
|
|
403
|
+
print("-" * 72)
|
|
404
|
+
print(f" - Completeness : {c['completeness']['score']}% ({c['completeness']['null_cells']} nulls)")
|
|
405
|
+
print(f" - Consistency : {c['consistency']['score']}% ({c['consistency']['duplicate_rows']} duplicates)")
|
|
406
|
+
print(f" - Accuracy & Validity: {c['accuracy_and_validity']['score']}%")
|
|
407
|
+
print(f" - Currentness SLA : {c['currentness']['score']}% ({c['currentness']['details']})")
|
|
408
|
+
print("=" * 72)
|
|
409
|
+
|
|
410
|
+
if args.gate and res["overall_score"] < 85.0:
|
|
411
|
+
print("🚨 Quality Gate Failed: ISO 25012 quality score below 85.0% SLA threshold!", file=sys.stderr)
|
|
412
|
+
return 1
|
|
413
|
+
return 0
|
|
414
|
+
|
|
415
|
+
if args.reconcile:
|
|
416
|
+
if not args.source or not args.target:
|
|
417
|
+
print("❌ Error: Both --source and --target datasets are required for reconciliation.", file=sys.stderr)
|
|
418
|
+
return 2
|
|
419
|
+
|
|
420
|
+
try:
|
|
421
|
+
s_rows = load_dataset(args.source)
|
|
422
|
+
t_rows = load_dataset(args.target)
|
|
423
|
+
except Exception as e:
|
|
424
|
+
print(f"❌ Error loading datasets: {e}", file=sys.stderr)
|
|
425
|
+
return 2
|
|
426
|
+
|
|
427
|
+
num_cols = [c.strip() for c in args.num_cols.split(",")] if args.num_cols else None
|
|
428
|
+
res = reconcile_etl_datasets(s_rows, t_rows, primary_key=args.key, numeric_columns=num_cols)
|
|
429
|
+
|
|
430
|
+
if args.json:
|
|
431
|
+
print(json.dumps(res, indent=2, ensure_ascii=False))
|
|
432
|
+
else:
|
|
433
|
+
status = "\033[92m[RECONCILED]\033[0m" if res["is_reconciled"] else "\033[91m[DISCREPANCY DETECTED]\033[0m"
|
|
434
|
+
print("=" * 74)
|
|
435
|
+
print(" SYNAPSE HUB — DAMA-DMBOK ETL & DATA MIGRATION RECONCILIATION")
|
|
436
|
+
print("=" * 74)
|
|
437
|
+
print(f" Reconciliation Status: {status}")
|
|
438
|
+
print(f" Source vs Target Rows: {res['row_counts']['source']} vs {res['row_counts']['target']} (Variance: {res['row_counts']['variance']})")
|
|
439
|
+
print(f" Dropped Records (Loss): {res['key_deltas']['dropped_in_target_count']}")
|
|
440
|
+
print(f" Ghost Records (Orphan): {res['key_deltas']['ghost_in_target_count']}")
|
|
441
|
+
print(f" Mutated Value Records : {res['data_mutations']['mutated_records_count']}")
|
|
442
|
+
if res["numeric_aggregation_parity"]:
|
|
443
|
+
print("-" * 74)
|
|
444
|
+
print(" Numeric Financial / Metric Balance:")
|
|
445
|
+
for col, bal in res["numeric_aggregation_parity"].items():
|
|
446
|
+
b_str = "\033[92mBALANCED\033[0m" if bal["is_balanced"] else "\033[91mUNBALANCED\033[0m"
|
|
447
|
+
print(f" - {col}: Src={bal['source_sum']} | Tgt={bal['target_sum']} | Diff={bal['difference']} -> {b_str}")
|
|
448
|
+
print("=" * 74)
|
|
449
|
+
|
|
450
|
+
if args.gate and not res["is_reconciled"]:
|
|
451
|
+
print("🚨 Quality Gate Failed: Data discrepancy detected during ETL reconciliation!", file=sys.stderr)
|
|
452
|
+
return 1
|
|
453
|
+
return 0
|
|
454
|
+
|
|
455
|
+
parser.print_help()
|
|
456
|
+
return 2
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
if __name__ == "__main__":
|
|
460
|
+
sys.exit(main())
|
|
@@ -71,14 +71,14 @@ def compute_workload_stages(workload_profile: str, vus: int, ramp_up: int, durat
|
|
|
71
71
|
(threads, ramp, hold, delay) so staged load works on vanilla JMeter 5.x
|
|
72
72
|
without plugins. Linear/soak return a single stage (behavior unchanged).
|
|
73
73
|
"""
|
|
74
|
-
if workload_profile
|
|
75
|
-
step_count = 4
|
|
74
|
+
if workload_profile in ("step", "scalability"):
|
|
75
|
+
step_count = 5 if workload_profile == "scalability" else 4
|
|
76
76
|
per_step = max(1, (vus + step_count - 1) // step_count)
|
|
77
77
|
window_ramp = max(1, min(10, ramp_up))
|
|
78
78
|
window_hold = max(30, duration // step_count)
|
|
79
79
|
stages = []
|
|
80
80
|
for i in range(step_count):
|
|
81
|
-
threads = min(per_step * (i + 1), vus)
|
|
81
|
+
threads = min(per_step * (i + 1), int(vus * 1.25) if workload_profile == "scalability" else vus)
|
|
82
82
|
stages.append({"threads": threads, "ramp": window_ramp,
|
|
83
83
|
"hold": window_hold, "delay": i * (window_ramp + window_hold)})
|
|
84
84
|
return stages
|
|
@@ -247,6 +247,11 @@ def build_jmx_xml(
|
|
|
247
247
|
' <stringProp name="Header.name">X-CSRF-Token</stringProp>',
|
|
248
248
|
' <stringProp name="Header.value">${CSRF_TOKEN}</stringProp>',
|
|
249
249
|
' </elementProp>',
|
|
250
|
+
' <!-- W3C Trace Context & OpenTelemetry Distributed Tracing (APM Standard) -->',
|
|
251
|
+
' <elementProp name="" elementType="Header">',
|
|
252
|
+
' <stringProp name="Header.name">traceparent</stringProp>',
|
|
253
|
+
' <stringProp name="Header.value">00-${__UUID()}-0000000000000001-01</stringProp>',
|
|
254
|
+
' </elementProp>',
|
|
250
255
|
' </collectionProp>',
|
|
251
256
|
' </HeaderManager>',
|
|
252
257
|
' <hashTree/>',
|
|
@@ -506,6 +511,9 @@ def build_jmx_xml(
|
|
|
506
511
|
'sampler.getHeaderManager().add(new org.apache.jmeter.protocol.http.control.Header("X-Signature", signature))',
|
|
507
512
|
'sampler.getHeaderManager().add(new org.apache.jmeter.protocol.http.control.Header("X-Timestamp", timestamp))',
|
|
508
513
|
'sampler.getHeaderManager().add(new org.apache.jmeter.protocol.http.control.Header("X-Correlation-ID", "CORR-" + UUID.randomUUID().toString()))',
|
|
514
|
+
'String traceId = UUID.randomUUID().toString().replace("-", "")',
|
|
515
|
+
'String spanId = UUID.randomUUID().toString().replace("-", "").substring(0, 16)',
|
|
516
|
+
'sampler.getHeaderManager().add(new org.apache.jmeter.protocol.http.control.Header("traceparent", "00-" + traceId + "-" + spanId + "-01"))',
|
|
509
517
|
']]></stringProp>',
|
|
510
518
|
' </JSR223PreProcessor>',
|
|
511
519
|
' <hashTree/>'
|
|
@@ -1149,7 +1157,7 @@ def main():
|
|
|
1149
1157
|
parser.add_argument("--csv-vars", default="username,password,entity_id", help="Comma-separated variable names for CSV Data Set.")
|
|
1150
1158
|
parser.add_argument("--group-transactions", action="store_true", help="Wrap endpoints in Transaction Controllers to measure end-to-end flow SLA.")
|
|
1151
1159
|
parser.add_argument("--weighted-mix", help="Traffic shaping weight mix, e.g. '70,20,10' or '70:Browse,20:Cart,10:Checkout'.")
|
|
1152
|
-
parser.add_argument("--workload", choices=["linear", "step", "spike", "soak"], default="linear", help="Workload profile shape.")
|
|
1160
|
+
parser.add_argument("--workload", choices=["linear", "step", "spike", "soak", "scalability"], default="linear", help="Workload profile shape.")
|
|
1153
1161
|
parser.add_argument("--jsr223-hmac", action="store_true", help="Inject JSR223 Groovy PreProcessor for HMAC-SHA256 payload signatures.")
|
|
1154
1162
|
parser.add_argument("--influxdb-url", help="InfluxDB HTTP metrics endpoint for live Grafana APM dashboard streaming.")
|
|
1155
1163
|
parser.add_argument("--perfmon-server", help="PerfMon Server Agent host:port (e.g. 192.168.1.100:4444) for hardware telemetry.")
|
package/tools/jtl_analyzer.py
CHANGED
|
@@ -69,6 +69,8 @@ class SamplerStats:
|
|
|
69
69
|
self.samples: int = 0
|
|
70
70
|
self.errors: int = 0
|
|
71
71
|
self.elapsed_times: List[float] = []
|
|
72
|
+
self.success_elapsed_times: List[float] = []
|
|
73
|
+
self.failed_elapsed_times: List[float] = []
|
|
72
74
|
self.total_bytes: int = 0
|
|
73
75
|
self.start_time: Optional[int] = None
|
|
74
76
|
self.end_time: Optional[int] = None
|
|
@@ -76,8 +78,11 @@ class SamplerStats:
|
|
|
76
78
|
|
|
77
79
|
def add_sample(self, elapsed: float, success: bool, timestamp: int, bytes_recv: int, response_code: str):
|
|
78
80
|
self.samples += 1
|
|
79
|
-
if
|
|
81
|
+
if success:
|
|
82
|
+
self.success_elapsed_times.append(elapsed)
|
|
83
|
+
else:
|
|
80
84
|
self.errors += 1
|
|
85
|
+
self.failed_elapsed_times.append(elapsed)
|
|
81
86
|
self.elapsed_times.append(elapsed)
|
|
82
87
|
self.total_bytes += bytes_recv
|
|
83
88
|
|
|
@@ -103,6 +108,10 @@ class SamplerStats:
|
|
|
103
108
|
"p90_ms": 0.0,
|
|
104
109
|
"p95_ms": 0.0,
|
|
105
110
|
"p99_ms": 0.0,
|
|
111
|
+
"p999_ms": 0.0,
|
|
112
|
+
"p95_success_ms": 0.0,
|
|
113
|
+
"p99_success_ms": 0.0,
|
|
114
|
+
"p95_failed_ms": 0.0,
|
|
106
115
|
"throughput_tps": 0.0,
|
|
107
116
|
"kb_per_sec": 0.0,
|
|
108
117
|
"response_codes": self.response_codes,
|
|
@@ -118,6 +127,15 @@ class SamplerStats:
|
|
|
118
127
|
p90 = calculate_percentile(sorted_times, 90.0)
|
|
119
128
|
p95 = calculate_percentile(sorted_times, 95.0)
|
|
120
129
|
p99 = calculate_percentile(sorted_times, 99.0)
|
|
130
|
+
p999 = calculate_percentile(sorted_times, 99.9)
|
|
131
|
+
|
|
132
|
+
# Google SRE Golden Signal: Disaggregate Latency by Success vs Failure
|
|
133
|
+
sorted_success = sorted(self.success_elapsed_times) if self.success_elapsed_times else []
|
|
134
|
+
p95_success = calculate_percentile(sorted_success, 95.0) if sorted_success else p95
|
|
135
|
+
p99_success = calculate_percentile(sorted_success, 99.0) if sorted_success else p99
|
|
136
|
+
|
|
137
|
+
sorted_failed = sorted(self.failed_elapsed_times) if self.failed_elapsed_times else []
|
|
138
|
+
p95_failed = calculate_percentile(sorted_failed, 95.0) if sorted_failed else 0.0
|
|
121
139
|
|
|
122
140
|
error_rate = (self.errors / count) * 100.0 if count > 0 else 0.0
|
|
123
141
|
|
|
@@ -141,6 +159,10 @@ class SamplerStats:
|
|
|
141
159
|
"p90_ms": round(p90, 2),
|
|
142
160
|
"p95_ms": round(p95, 2),
|
|
143
161
|
"p99_ms": round(p99, 2),
|
|
162
|
+
"p999_ms": round(p999, 2),
|
|
163
|
+
"p95_success_ms": round(p95_success, 2),
|
|
164
|
+
"p99_success_ms": round(p99_success, 2),
|
|
165
|
+
"p95_failed_ms": round(p95_failed, 2),
|
|
144
166
|
"throughput_tps": round(tps, 2),
|
|
145
167
|
"kb_per_sec": round(kb_sec, 2),
|
|
146
168
|
"response_codes": self.response_codes,
|
package/tools/mcp_docx_server.py
CHANGED
|
@@ -60,7 +60,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
60
60
|
except Exception:
|
|
61
61
|
pass
|
|
62
62
|
|
|
63
|
-
SERVER_VERSION = "4.
|
|
63
|
+
SERVER_VERSION = "4.4.0"
|
|
64
64
|
MAX_DOCX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
65
65
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
66
66
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|
|
@@ -55,7 +55,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
55
55
|
except Exception:
|
|
56
56
|
pass
|
|
57
57
|
|
|
58
|
-
SERVER_VERSION = "4.
|
|
58
|
+
SERVER_VERSION = "4.4.0"
|
|
59
59
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
60
60
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
61
61
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|