synapse-hub 2.7.0 → 3.0.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/live-explorer.md +2 -0
- package/.agents/agents/pom-crafter.md +2 -0
- package/.agents/agents/test-runner.md +3 -0
- package/.agents/skills/lean-impact-scoreboard/SKILL.md +1 -1
- package/.agents/skills/repo-quality-audit/SKILL.md +1 -1
- package/.agents/skills/review-spec/SKILL.md +1 -1
- package/.agents/skills/senior-code-review/SKILL.md +1 -1
- package/.agents/skills/technical-debt-harvester/SKILL.md +1 -1
- package/CLAUDE.md +1 -1
- package/README.en.md +70 -291
- package/README.md +68 -303
- package/docs/ARCHITECTURE.md +48 -2
- package/docs/CONTRIBUTING.md +1 -1
- package/docs/QUALITY_GATES.md +113 -0
- package/package.json +1 -1
- package/scripts/package_dist.py +2 -1
- package/skills_manifest.json +6 -6
- package/synapse.config.json +1 -1
- package/templates/ai_bridges/CLAUDE.md +1 -1
- package/templates/ai_bridges/copilot-instructions.md +2 -2
- package/tools/__init__.py +18 -1
- package/tools/_openapi_parser.py +1 -1
- package/tools/agent_canary.py +42 -30
- package/tools/agentless_patcher.py +2 -2
- package/tools/analyze_project.py +3 -5
- package/tools/api_drift_sentinel.py +4 -4
- package/tools/api_fuzzer.py +8 -8
- package/tools/auto_heal.py +4 -5
- package/tools/auto_heal_reflexion.py +2 -2
- package/tools/autogen_qa_broker.py +2 -2
- package/tools/browser_helpers.js +2 -2
- package/tools/browsergym_eval.py +2 -3
- package/tools/bug_reporter.py +11 -13
- package/tools/bump_version.py +75 -5
- package/tools/cache_resolver.py +78 -83
- package/tools/check_env.py +9 -1
- package/tools/check_version_sync.py +40 -3
- package/tools/ci_healing_hook.py +4 -6
- package/tools/cli.py +5 -7
- package/tools/config_decoupler.py +2 -3
- package/tools/core/__init__.py +52 -0
- package/tools/count_tokens.py +22 -20
- package/tools/dashboard_generator.py +627 -998
- package/tools/db_sandbox.py +65 -53
- package/tools/debt_harvester.py +3 -3
- package/tools/distill_log.py +3 -3
- package/tools/dspy_qa_signatures.py +3 -4
- package/tools/export_postman_collection.py +8 -8
- package/tools/flaky_detector.py +2 -2
- package/tools/fuzz_payloads.py +5 -5
- package/tools/generate_allure_report.py +1 -1
- package/tools/generate_jmx_plan.py +4 -4
- package/tools/gherkin_suite.py +1 -1
- package/tools/git_pre_commit_guard.py +2 -2
- package/tools/goldfish_review.py +2 -2
- package/tools/heal/__init__.py +28 -0
- package/tools/heal_pr_automator.py +6 -6
- package/tools/heuristic_locator_matcher.py +2 -2
- package/tools/infer_linter.py +8 -8
- package/tools/interview_story.py +0 -1
- package/tools/jtl_analyzer.py +11 -11
- package/tools/lint/__init__.py +30 -0
- package/tools/lint_ai_docs.py +42 -0
- package/tools/lookup_tc.py +1 -1
- package/tools/matrix_sharder.py +15 -13
- package/tools/mcp/__init__.py +16 -0
- package/tools/mcp_excel_server.py +2 -2
- package/tools/mcp_server.py +3 -4
- package/tools/md_to_xlsx.py +26 -26
- package/tools/micro_mutator.py +11 -12
- package/tools/network_mock_shield.py +27 -27
- package/tools/newman_analyzer.py +2 -3
- package/tools/omni_emitter.py +5 -8
- package/tools/omni_parser.py +5 -5
- package/tools/omni_transpiler.py +5 -5
- package/tools/output_formatter.py +19 -0
- package/tools/perf/__init__.py +24 -0
- package/tools/pinpoint_failure.py +1 -1
- package/tools/project_state.py +0 -2
- package/tools/qa_event_stream.py +1 -1
- package/tools/repo_map.py +8 -8
- package/tools/report/__init__.py +32 -0
- package/tools/reversible_sandbox.py +1 -2
- package/tools/safety_firewall.py +2 -2
- package/tools/senior_code_review.py +2 -2
- package/tools/setup_project.py +10 -12
- package/tools/skill_collision_guard.py +3 -3
- package/tools/skill_vault.py +12 -3
- package/tools/skillspector.py +5 -7
- package/tools/smart_visual_masker.py +4 -6
- package/tools/spec_drift_sentinel.py +1 -2
- package/tools/swe_qa_aci.py +2 -2
- package/tools/synapse_qa_bench.py +3 -3
- package/tools/sync_agent_rules.py +17 -3
- package/tools/telemetry_correlator.py +3 -2
- package/tools/test_memory_os.py +15 -5
- package/tools/textgrad_mutation_optimizer.py +3 -3
- package/tools/tms_sync_bridge.py +5 -5
- package/tools/tot_exploratory_tester.py +5 -6
- package/tools/traffic_session_converter.py +9 -9
- package/tools/universal_ir.py +2 -3
- package/tools/update_sentinel.py +6 -9
- package/tools/verify_all.py +10 -0
- package/tools/visual_diff_canvas.py +1 -2
- package/tools/visual_som_helper.py +15 -13
- package/tools/watch_mode.py +1 -1
- package/tools/wcag_audit.py +22 -1
- package/tools/welcome_page.py +5 -6
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 🛡️ 10 Quality Gates Definition of Done (DoD) Standard
|
|
2
|
+
|
|
3
|
+
> **Scope:** Enterprise automated verification sentinel enforcing 10 non-negotiable Quality Gates across Synapse Hub and target client projects.
|
|
4
|
+
> **Command:** `python3 tools/verify_all.py` or `npx synapse-hub verify`
|
|
5
|
+
> **Integrity Guard:** Synapse Hub created by **Thế Vị (@TeeVee998)** (<https://github.com/TeeVee998/Synapse-Hub>) under MIT License.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Quality Gates Matrix Overview
|
|
10
|
+
|
|
11
|
+
| Gate | Name | Target Scope | Engine / Tool | Exit Code | Passing Criteria (DoD) |
|
|
12
|
+
|:---:|:---|:---|:---|:---:|:---|
|
|
13
|
+
| **Gate 0** | **Author Attribution & MIT Integrity** | Repository-wide | `tools/author_integrity.py` | 0 | MIT License notice and author attribution intact across all source files. |
|
|
14
|
+
| **Gate 1** | **UTF-8 No BOM Encoding** | All source & config files | `tools/verify_all.py` | 0 | Zero Byte Order Mark (`0xEF, 0xBB, 0xBF`) bytes across any file. |
|
|
15
|
+
| **Gate 2** | **Path Portability** | All source & test files | `tools/verify_all.py` | 0 | Zero hardcoded personal/machine absolute paths (`/Users/...`, `C:\...`). |
|
|
16
|
+
| **Gate 3** | **Clean POM & Flat Architecture** | Test scripts (`tests/`, `Scripts/`) | `tools/verify_all.py` | 0 | Zero raw XPaths or CSS selectors in test scripts; 100% locators encapsulated in Page Classes. |
|
|
17
|
+
| **Gate 4** | **AI Documentation & Anti-Drift** | `PROJECT_AI_GUIDE.md` & AST | `tools/lint_ai_docs.py` | 0 | 0 hallucinated PageClasses; 100% documented methods exist in codebase AST. |
|
|
18
|
+
| **Gate 5** | **Temporary Files Blacklist** | Repository tree | `tools/verify_all.py` | 0 | Zero scratch files, heap dumps, or temporary artifacts (`*.tmp`, `.ruff_cache`, memory dumps). |
|
|
19
|
+
| **Gate 6** | **Credential & Secret Security** | All files & git index | `tools/verify_all.py` | 0 | Zero plaintext passwords, API keys, private tokens, or AWS/JWT credentials committed. |
|
|
20
|
+
| **Gate 7** | **Static Defect & Fake-Pass Sentinel** | Test scripts & tools | `tools/infer_linter.py` | 0 | Zero empty assertions (0 assert), zero swallowed exceptions (`pass`), zero hardcoded sleeps (>= 3000ms). |
|
|
21
|
+
| **Gate 8** | **Assertion Sensitivity (Mutation Score)** | Test assertions | `tools/micro_mutator.py` | 0 | Mutation kill score >= 80% (heuristic static mutant detection catches >= 80% syntactic modifications). |
|
|
22
|
+
| **Gate 9** | **Skill Routing & Collision Guard** | Skill descriptions | `tools/skill_collision_guard.py` | 0 | Zero overlapping trigger collisions (semantic cosine similarity < 0.75 across all skill pairs). |
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 🔍 Detailed Gate Specifications
|
|
27
|
+
|
|
28
|
+
### Gate 0: Author Attribution & MIT License Integrity
|
|
29
|
+
- **Objective:** Protects open-source attribution provenance under MIT License.
|
|
30
|
+
- **Verification Rule:** Rejects any commit, pull request, or modification that attempts to strip copyright notices, false-claim authorship, or remove provenance headers referencing Thế Vị (@TeeVee998).
|
|
31
|
+
- **Remediation:** Restore license headers and canonical notice in `LICENSE` and `NOTICE`.
|
|
32
|
+
|
|
33
|
+
### Gate 1: UTF-8 No BOM Encoding Integrity
|
|
34
|
+
- **Objective:** Eliminates cross-platform file encoding corruption between Windows, macOS, and Linux CI/CD runners.
|
|
35
|
+
- **Verification Rule:** Inspects raw bytes of all text files. Any occurrence of BOM bytes (`0xEF, 0xBB, 0xBF`) causes immediate failure.
|
|
36
|
+
- **Remediation:** Run `python3 tools/verify_all.py --fix-bom` to strip BOM bytes automatically.
|
|
37
|
+
|
|
38
|
+
### Gate 2: Path Portability
|
|
39
|
+
- **Objective:** Guarantees test scripts and tooling execute seamlessly across team developer workstations, Docker containers, and CI pipelines.
|
|
40
|
+
- **Verification Rule:** Regex scans for machine-specific path roots (`/Users/`, `/home/`, `C:\`, `D:\`).
|
|
41
|
+
- **Remediation:** Replace absolute paths with dynamic workspace resolution (`Path(__file__).resolve().parent.parent` or `resolve_target_repo()`).
|
|
42
|
+
|
|
43
|
+
### Gate 3: Clean POM & Flat Architecture
|
|
44
|
+
- **Objective:** Enforces clean separation of concerns. Test scripts must contain solely business workflow actions, never DOM traversal.
|
|
45
|
+
- **Verification Rule:** Prohibits raw CSS selectors, XPaths, or `findTestObject` inside `tests/` or `Scripts/`. All UI operations must be delegated to methods on Page Classes extending `BasePage`.
|
|
46
|
+
- **Remediation:** Encapsulate locators and interaction logic inside dedicated Page Classes.
|
|
47
|
+
|
|
48
|
+
### Gate 4: AI Documentation & Anti-Drift Linter
|
|
49
|
+
- **Objective:** Prevents AI context drift where documentation refers to non-existent Page Classes or obsolete method signatures.
|
|
50
|
+
- **Verification Rule:** Extracts all documented Page Classes and methods from `PROJECT_AI_GUIDE.md` and verifies their physical AST existence in the codebase.
|
|
51
|
+
- **Remediation:** Run `python3 tools/lint_ai_docs.py` to identify drifts, then re-index via `python3 tools/repo_map.py`.
|
|
52
|
+
|
|
53
|
+
### Gate 5: Temporary Files Blacklist
|
|
54
|
+
- **Objective:** Maintains git hygiene and prevents polluting repositories with binary dumps or local IDE caches.
|
|
55
|
+
- **Verification Rule:** Scans for prohibited extensions: `*.tmp`, `*.dump`, `*.log`, `*.orig`, `*.bak`, `.ruff_cache/`, `.mypy_cache/`.
|
|
56
|
+
- **Remediation:** Add unignored patterns to `.gitignore` and delete temporary files.
|
|
57
|
+
|
|
58
|
+
### Gate 6: Credential Security Sentinel
|
|
59
|
+
- **Objective:** Prevents enterprise credential leaks (API tokens, database connection strings, private keys).
|
|
60
|
+
- **Verification Rule:** High-entropy regex scanner detecting AWS secret keys, Bearer tokens, private RSA keys, and hardcoded passwords.
|
|
61
|
+
- **Remediation:** Move credentials to environment variables or `.env` (ensuring `.env` is listed in `.gitignore`).
|
|
62
|
+
|
|
63
|
+
### Gate 7: Static Defect & Fake-Pass Sentinel
|
|
64
|
+
- **Objective:** Eliminates "fake passes" created by AI code generation (tests that pass trivially without asserting anything).
|
|
65
|
+
- **Verification Rule:**
|
|
66
|
+
- Flags tests containing 0 assertions.
|
|
67
|
+
- Flags empty catch blocks (`except Exception: pass`) swallowing failure exceptions.
|
|
68
|
+
- Flags hardcoded sleeps (`sleep(5000)`, `Thread.sleep(5000)`).
|
|
69
|
+
- Flags unawaited Playwright assertions (`expect(el).toBeVisible()` without `await`).
|
|
70
|
+
- **Remediation:** Add meaningful assertions; replace sleeps with smart waits (`waitForLoadState('networkidle')`, element visibility checks).
|
|
71
|
+
|
|
72
|
+
### Gate 8: Assertion Sensitivity & Syntactic Mutation Sentinel
|
|
73
|
+
- **Objective:** Guarantees assertions are sensitive enough to catch real defects, not tautological (always-true) expressions.
|
|
74
|
+
- **Verification Rule:** Injects syntactic mutations (reversing comparison operators `==` to `!=`, swapping boolean constants, altering return values). Requires Mutation Score >= 80%.
|
|
75
|
+
- **Remediation:** Run `python3 tools/micro_mutator.py --strict` to inspect surviving mutants and tighten test assertions.
|
|
76
|
+
|
|
77
|
+
### Gate 9: Tier-2 Skill Routing & Collision Guard
|
|
78
|
+
- **Objective:** Prevents AI agent prompt confusion caused by overlapping skill trigger descriptions.
|
|
79
|
+
- **Verification Rule:** Computes pairwise cosine similarity between all skill `SKILL.md` description fields. Similarity must remain strictly < 0.75.
|
|
80
|
+
- **Remediation:** Differentiate skill descriptions using the standardized formula `[Chức năng] + Use when [ngữ cảnh]` (<= 350 characters).
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🚀 Execution & CI/CD Integration
|
|
85
|
+
|
|
86
|
+
### Run Locally:
|
|
87
|
+
```bash
|
|
88
|
+
# Verify all 10 Gates on current repository
|
|
89
|
+
python3 tools/verify_all.py
|
|
90
|
+
|
|
91
|
+
# Verify target project from Hub
|
|
92
|
+
python3 tools/verify_all.py --target /path/to/project
|
|
93
|
+
|
|
94
|
+
# Output as JUnit XML for CI/CD reporting
|
|
95
|
+
python3 tools/verify_all.py --format junit --output reports/dod_gates.xml
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### GitHub Actions Pipeline (`.github/workflows/verify.yml`):
|
|
99
|
+
```yaml
|
|
100
|
+
name: Synapse Hub 10 DoD Quality Gates
|
|
101
|
+
on: [push, pull_request]
|
|
102
|
+
|
|
103
|
+
jobs:
|
|
104
|
+
quality-gates:
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v4
|
|
108
|
+
- uses: actions/setup-python@v5
|
|
109
|
+
with:
|
|
110
|
+
python-version: '3.11'
|
|
111
|
+
- name: Run 10 Quality Gates
|
|
112
|
+
run: python tools/verify_all.py --mode target
|
|
113
|
+
```
|
package/package.json
CHANGED
package/scripts/package_dist.py
CHANGED
|
@@ -37,6 +37,7 @@ EXCLUDE_DIRS = {
|
|
|
37
37
|
"__pycache__",
|
|
38
38
|
".pytest_cache",
|
|
39
39
|
".mypy_cache",
|
|
40
|
+
".ruff_cache",
|
|
40
41
|
".idea",
|
|
41
42
|
".vscode",
|
|
42
43
|
"agent_qa.egg-info",
|
|
@@ -280,7 +281,7 @@ def create_package(output_zip: str = "agent-skills.zip") -> Path:
|
|
|
280
281
|
total_size += full_path.stat().st_size
|
|
281
282
|
|
|
282
283
|
zip_size_mb = out_path.stat().st_size / (1024 * 1024)
|
|
283
|
-
print(
|
|
284
|
+
print("✅ Packaging complete:")
|
|
284
285
|
print(f" • Total files packaged : {total_files}")
|
|
285
286
|
print(f" • Uncompressed size : {total_size / (1024 * 1024):.2f} MB")
|
|
286
287
|
print(f" • Archive size (.zip) : {zip_size_mb:.2f} MB")
|
package/skills_manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"name": "Enterprise Agent Skills Hub",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"description": "Unified Catalog of 51 Specialized Skills for Autonomous AI Agents in Enterprise Software Quality Engineering, Performance, and Architecture.",
|
|
6
6
|
"totalSkills": 51,
|
|
7
7
|
"categories": {
|
|
@@ -492,7 +492,7 @@
|
|
|
492
492
|
"name": "Senior Code Review",
|
|
493
493
|
"category": "architecture_and_analysis",
|
|
494
494
|
"path": ".agents/skills/senior-code-review/SKILL.md",
|
|
495
|
-
"summary": "
|
|
495
|
+
"summary": "Review code changes across logic, security, concurrency, and test coverage. Use when conducting pull request reviews, diff inspections, or auditing commit changes before merge.",
|
|
496
496
|
"version": "1.0.0"
|
|
497
497
|
},
|
|
498
498
|
{
|
|
@@ -500,7 +500,7 @@
|
|
|
500
500
|
"name": "Repo Quality Audit",
|
|
501
501
|
"category": "architecture_and_analysis",
|
|
502
502
|
"path": ".agents/skills/repo-quality-audit/SKILL.md",
|
|
503
|
-
"summary": "
|
|
503
|
+
"summary": "Comprehensive codebase quality audit covering bugs, security, bottlenecks, and bloat. Use when auditing an entire project, evaluating repository health, or prioritizing technical debt.",
|
|
504
504
|
"version": "1.0.0"
|
|
505
505
|
},
|
|
506
506
|
{
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
"name": "Technical Debt Harvester",
|
|
509
509
|
"category": "architecture_and_analysis",
|
|
510
510
|
"path": ".agents/skills/technical-debt-harvester/SKILL.md",
|
|
511
|
-
"summary": "Harvest shortcut: comments into a tracked debt ledger
|
|
511
|
+
"summary": "Harvest shortcut: comments into a tracked technical debt ledger. Use when auditing code compromises, tracking deferred refactorings, or scanning for shortcut markers.",
|
|
512
512
|
"version": "1.0.0"
|
|
513
513
|
},
|
|
514
514
|
{
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
"name": "Lean Impact Scoreboard",
|
|
517
517
|
"category": "architecture_and_analysis",
|
|
518
518
|
"path": ".agents/skills/lean-impact-scoreboard/SKILL.md",
|
|
519
|
-
"summary": "Display
|
|
519
|
+
"summary": "Display empirical impact scoreboards (code reduction, token savings, mutation rigor). Use when reviewing lean engineering benchmarks, token throughput, or reporting quality metrics.",
|
|
520
520
|
"version": "1.0.0"
|
|
521
521
|
},
|
|
522
522
|
{
|
|
@@ -588,7 +588,7 @@
|
|
|
588
588
|
"name": "Review Spec (Goldfish Protocol)",
|
|
589
589
|
"category": "architecture_and_analysis",
|
|
590
590
|
"path": ".agents/skills/review-spec/SKILL.md",
|
|
591
|
-
"summary": "
|
|
591
|
+
"summary": "Stress-test specifications, user stories, and BDD feature files with zero-context rigor. Use when reviewing requirements, user stories, or acceptance criteria before code generation.",
|
|
592
592
|
"version": "1.0.0"
|
|
593
593
|
}
|
|
594
594
|
]
|
package/synapse.config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CLAUDE.md — Synapse-Hub Guidelines for Claude Code
|
|
2
2
|
|
|
3
|
-
> **Author & Creator:** Thế Vị (@TeeVee998) <https://github.com/TeeVee998/Synapse-Hub>
|
|
3
|
+
> **Author & Creator:** Thế Vị (@TeeVee998) <https://github.com/TeeVee998/Synapse-Hub>
|
|
4
4
|
> **License:** MIT License (Mandatory Attribution Preservation)
|
|
5
5
|
|
|
6
6
|
<!-- ============================================================================== -->
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<!-- ============================================================================== -->
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
> **Project:** Synapse-Hub Enterprise QA Automation
|
|
10
|
-
> **Author:** Thế Vị (@TeeVee998) — MIT License
|
|
9
|
+
> **Project:** Synapse-Hub Enterprise QA Automation
|
|
10
|
+
> **Author:** Thế Vị (@TeeVee998) — MIT License
|
|
11
11
|
|
|
12
12
|
## Coding Invariants
|
|
13
13
|
- Enforce Clean Page Object Model (POM) with Flat Architecture.
|
package/tools/__init__.py
CHANGED
|
@@ -4,12 +4,29 @@ Synapse Hub — Enterprise AI Agent Quality Engineering & Automated Testing Tool
|
|
|
4
4
|
Author: Thế Vị (@TeeVee998)
|
|
5
5
|
Repository: https://github.com/TeeVee998/Synapse-Hub
|
|
6
6
|
License: MIT
|
|
7
|
+
|
|
8
|
+
Domain Packages:
|
|
9
|
+
- tools.core: Execution engines, 10 DoD Quality Gates, setup, CLI, AST maps.
|
|
10
|
+
- tools.lint: Static code defect, encoding, author integrity, and AI doc sentinels.
|
|
11
|
+
- tools.report: HTML dashboards, spreadsheets, telemetry correlation, and metrics.
|
|
12
|
+
- tools.heal: Locator healing, episodic Reflexion memory, and agentless patching.
|
|
13
|
+
- tools.perf: Flakiness detection, JMeter plans, BFCL benchmarks, and matrix sharding.
|
|
14
|
+
- tools.mcp: Model Context Protocol servers (core QA and Excel manipulation).
|
|
7
15
|
"""
|
|
8
16
|
|
|
9
|
-
__version__ = "
|
|
17
|
+
__version__ = "3.0.0"
|
|
10
18
|
__author__ = "Thế Vị (@TeeVee998)"
|
|
11
19
|
|
|
20
|
+
# Expose domain packages
|
|
21
|
+
from tools import core, heal, lint, mcp, perf, report # noqa: F401
|
|
22
|
+
|
|
12
23
|
__all__ = [
|
|
24
|
+
"core",
|
|
25
|
+
"heal",
|
|
26
|
+
"lint",
|
|
27
|
+
"mcp",
|
|
28
|
+
"perf",
|
|
29
|
+
"report",
|
|
13
30
|
"verify_all",
|
|
14
31
|
"infer_linter",
|
|
15
32
|
"micro_mutator",
|
package/tools/_openapi_parser.py
CHANGED
package/tools/agent_canary.py
CHANGED
|
@@ -85,15 +85,20 @@ class OverlayInterceptVector(MutationVector):
|
|
|
85
85
|
healed = False
|
|
86
86
|
patch = None
|
|
87
87
|
if os.path.exists(CACHE_DB):
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
try:
|
|
89
|
+
conn = sqlite3.connect(CACHE_DB)
|
|
90
|
+
try:
|
|
91
|
+
cur = conn.cursor()
|
|
92
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%ElementClickIntercepted%' LIMIT 1")
|
|
93
|
+
row = cur.fetchone()
|
|
94
|
+
if row:
|
|
95
|
+
patch = row[0]
|
|
96
|
+
if "click" in patch and ("JavascriptExecutor" in patch or "jsClick" in patch or "clickJS" in patch):
|
|
97
|
+
healed = True
|
|
98
|
+
finally:
|
|
99
|
+
conn.close()
|
|
100
|
+
except sqlite3.Error:
|
|
101
|
+
healed = False
|
|
97
102
|
|
|
98
103
|
elapsed_ms = (time.time() - start) * 1000
|
|
99
104
|
return {
|
|
@@ -121,15 +126,20 @@ class LocatorDriftVector(MutationVector):
|
|
|
121
126
|
healed = False
|
|
122
127
|
patch = None
|
|
123
128
|
if os.path.exists(CACHE_DB):
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
try:
|
|
130
|
+
conn = sqlite3.connect(CACHE_DB)
|
|
131
|
+
try:
|
|
132
|
+
cur = conn.cursor()
|
|
133
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%StaleElement%' LIMIT 1")
|
|
134
|
+
row = cur.fetchone()
|
|
135
|
+
if row:
|
|
136
|
+
patch = row[0]
|
|
137
|
+
if "retry" in patch.lower() or "for (" in patch or "findElement" in patch:
|
|
138
|
+
healed = True
|
|
139
|
+
finally:
|
|
140
|
+
conn.close()
|
|
141
|
+
except sqlite3.Error:
|
|
142
|
+
healed = False
|
|
133
143
|
|
|
134
144
|
elapsed_ms = (time.time() - start) * 1000
|
|
135
145
|
return {
|
|
@@ -201,12 +211,14 @@ class DataCollisionVector(MutationVector):
|
|
|
201
211
|
if os.path.exists(CACHE_DB):
|
|
202
212
|
try:
|
|
203
213
|
conn = sqlite3.connect(CACHE_DB)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
try:
|
|
215
|
+
cur = conn.cursor()
|
|
216
|
+
cur.execute("SELECT groovy_patch FROM healing_cache WHERE error_signature LIKE '%Duplicate_Code%'")
|
|
217
|
+
row = cur.fetchone()
|
|
218
|
+
if row and ("uniqueCode" in row[0] or "currentTimeMillis" in row[0]):
|
|
219
|
+
healed = True
|
|
220
|
+
finally:
|
|
221
|
+
conn.close()
|
|
210
222
|
except sqlite3.Error:
|
|
211
223
|
healed = False
|
|
212
224
|
|
|
@@ -247,7 +259,7 @@ class BomContaminationVector(MutationVector):
|
|
|
247
259
|
# 1. Inject BOM
|
|
248
260
|
with open(test_file, "wb") as f:
|
|
249
261
|
f.write(b"\xef\xbb\xbf// Test BOM contamination\n")
|
|
250
|
-
|
|
262
|
+
|
|
251
263
|
# 2. Detect BOM
|
|
252
264
|
with open(test_file, "rb") as f:
|
|
253
265
|
header = f.read(3)
|
|
@@ -261,7 +273,7 @@ class BomContaminationVector(MutationVector):
|
|
|
261
273
|
cleaned = raw[3:]
|
|
262
274
|
with open(test_file, "wb") as f:
|
|
263
275
|
f.write(cleaned)
|
|
264
|
-
|
|
276
|
+
|
|
265
277
|
# Re-verify
|
|
266
278
|
with open(test_file, "rb") as f:
|
|
267
279
|
if f.read(3) != b"\xef\xbb\xbf":
|
|
@@ -297,7 +309,7 @@ class MachinePathLeakVector(MutationVector):
|
|
|
297
309
|
sample_path = "C:\\Workspace\\Project\\tools\\verify_all.py"
|
|
298
310
|
detected = "C:\\" in sample_path or sample_path.startswith("/")
|
|
299
311
|
healed = False
|
|
300
|
-
|
|
312
|
+
|
|
301
313
|
# Simulate relative path conversion
|
|
302
314
|
relative_path = os.path.relpath(os.path.join(REPO_ROOT, "tools", "verify_all.py"), REPO_ROOT)
|
|
303
315
|
if not relative_path.startswith("/") and "C:" not in relative_path:
|
|
@@ -328,7 +340,7 @@ class RawXPathInScriptVector(MutationVector):
|
|
|
328
340
|
start = time.time()
|
|
329
341
|
sample_bad_script = 'WebUI.click(findTestObject("Object Repository/button_Save"))'
|
|
330
342
|
detected = "findTestObject" in sample_bad_script or "By.xpath" in sample_bad_script
|
|
331
|
-
|
|
343
|
+
|
|
332
344
|
# Self-healing translation: convert to Clean POM method call
|
|
333
345
|
healed_script = "CommonCategoryPage.saveCareer(careerCode, careerName)"
|
|
334
346
|
healed = "findTestObject" not in healed_script and "CommonCategoryPage" in healed_script
|
|
@@ -393,7 +405,7 @@ class CanaryArena:
|
|
|
393
405
|
print(f"{BOLD}{CYAN} (Dry-Run Simulation Benchmark - Heuristic Evaluation) {RESET}")
|
|
394
406
|
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
395
407
|
print(f"Target Repository : {REPO_ROOT}")
|
|
396
|
-
print(
|
|
408
|
+
print("Evaluation Mode : Isolated Memory Sandbox & Offline Local Resolvers")
|
|
397
409
|
print(f"Total Vectors : {len(self.vectors)} Failure Vectors")
|
|
398
410
|
print(f"Timestamp : {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
399
411
|
|
|
@@ -442,7 +454,7 @@ class CanaryArena:
|
|
|
442
454
|
print(f" Autonomous Healing Rate : {GREEN if resolution_rate == 100 else RED}{resolution_rate:.1f}% ({healed_count}/{len(self.vectors)}){RESET}")
|
|
443
455
|
print(f" Mean Time To Repair (MTTR): {GREEN}{avg_mttr:.2f} ms{RESET} per incident")
|
|
444
456
|
print(f" Total Token Consumption : {GREEN}{total_tokens} tokens{RESET} (100% Offline Local)")
|
|
445
|
-
|
|
457
|
+
|
|
446
458
|
# Run verify_all gate
|
|
447
459
|
print(f"\n{BOLD}[POST-BENCHMARK DoD INTEGRITY CHECK]{RESET}")
|
|
448
460
|
verify_script = os.path.join(SCRIPT_DIR, "verify_all.py")
|
|
@@ -127,8 +127,8 @@ class AgentlessPatcher:
|
|
|
127
127
|
if method_name == "unknown_method":
|
|
128
128
|
# Scan backwards for enclosing def/function
|
|
129
129
|
for idx in range(line_no - 1, -1, -1):
|
|
130
|
-
|
|
131
|
-
fn_m = re.search(r'(?:def|async\s+function|function|public\s+def|\b([a-zA-Z0-9_]+)\s*\([^)]*\)\s*\{?)\s*([a-zA-Z0-9_]+)?',
|
|
130
|
+
line_content = lines[idx]
|
|
131
|
+
fn_m = re.search(r'(?:def|async\s+function|function|public\s+def|\b([a-zA-Z0-9_]+)\s*\([^)]*\)\s*\{?)\s*([a-zA-Z0-9_]+)?', line_content)
|
|
132
132
|
if fn_m:
|
|
133
133
|
method_name = fn_m.group(2) or fn_m.group(1) or "enclosing_scope"
|
|
134
134
|
break
|
package/tools/analyze_project.py
CHANGED
|
@@ -19,10 +19,8 @@ Generates & Updates In-Place inside the Target Project:
|
|
|
19
19
|
|
|
20
20
|
import os
|
|
21
21
|
import sys
|
|
22
|
-
import json
|
|
23
22
|
import argparse
|
|
24
23
|
from datetime import datetime
|
|
25
|
-
from pathlib import Path
|
|
26
24
|
|
|
27
25
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
28
26
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -232,9 +230,9 @@ def run_full_analysis(target_repo):
|
|
|
232
230
|
print(f" In-Project Report Path : {report_in_root if os.path.abspath(target_repo).lower() != os.path.abspath(HUB_ROOT).lower() else report_in_reports}")
|
|
233
231
|
if os.path.abspath(target_repo).lower() != os.path.abspath(HUB_ROOT).lower():
|
|
234
232
|
print(f" {YELLOW}💡 Post-Analysis Action: Push updated files to Git:{RESET}")
|
|
235
|
-
print(
|
|
236
|
-
print(
|
|
237
|
-
print(
|
|
233
|
+
print(" git add PROJECT_HEALTH_REPORT.md repo_map.txt")
|
|
234
|
+
print(" git commit -m \"docs(audit): update project health report and AST repo map\"")
|
|
235
|
+
print(" git push origin <branch>")
|
|
238
236
|
print(f"{BOLD}{CYAN}======================================================================{RESET}\n")
|
|
239
237
|
|
|
240
238
|
return 0 if gates_passed else 1
|
|
@@ -11,7 +11,7 @@ import os
|
|
|
11
11
|
import sys
|
|
12
12
|
import json
|
|
13
13
|
import argparse
|
|
14
|
-
from typing import Dict, List, Any
|
|
14
|
+
from typing import Dict, List, Any
|
|
15
15
|
|
|
16
16
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
17
17
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -91,7 +91,7 @@ def compare_specs(old_spec: Dict[str, Any], new_spec: Dict[str, Any]) -> Dict[st
|
|
|
91
91
|
"path": f"{method.upper()} {path}",
|
|
92
92
|
"detail": f"Parameter '{p_name}' was changed from optional to required"
|
|
93
93
|
})
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
old_type = old_p.get("type") or old_p.get("schema", {}).get("type")
|
|
96
96
|
new_type = new_p.get("type") or new_p.get("schema", {}).get("type")
|
|
97
97
|
if old_type and new_type and old_type != new_type:
|
|
@@ -145,8 +145,8 @@ def generate_markdown_report(analysis: Dict[str, Any], old_path: str, new_path:
|
|
|
145
145
|
f"- **Verdict:** {status_icon} (Health Score: `{analysis['contract_health_score']:.1f}%`)",
|
|
146
146
|
"",
|
|
147
147
|
"## Summary Metrics",
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
"| Breaking Changes | Warnings | Compatible Additions |",
|
|
149
|
+
"| :---: | :---: | :---: |",
|
|
150
150
|
f"| **{analysis['breaking_changes_count']}** | **{analysis['warnings_count']}** | **{analysis['additions_count']}** |",
|
|
151
151
|
""
|
|
152
152
|
]
|
package/tools/api_fuzzer.py
CHANGED
|
@@ -24,7 +24,7 @@ import urllib.request
|
|
|
24
24
|
import urllib.error
|
|
25
25
|
import urllib.parse
|
|
26
26
|
import argparse
|
|
27
|
-
from typing import Dict, Any, List, Optional
|
|
27
|
+
from typing import Dict, Any, List, Optional
|
|
28
28
|
|
|
29
29
|
# Enforce UTF-8 stdout encoding for Windows/macOS/Linux compatibility
|
|
30
30
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -578,13 +578,13 @@ class ApiFuzzer:
|
|
|
578
578
|
print(f" Verdict : {GREEN}[PASS] API resilient against input fuzzing & chaos.{RESET}")
|
|
579
579
|
else:
|
|
580
580
|
print(f" Verdict : {RED}[FAIL] {total_failures} defect alarms detected. Backend fixes required!{RESET}")
|
|
581
|
-
print(
|
|
581
|
+
print("======================================================================\n")
|
|
582
582
|
|
|
583
583
|
# Save Report
|
|
584
584
|
os.makedirs(REPORTS_DIR, exist_ok=True)
|
|
585
585
|
report_path = os.path.join(REPORTS_DIR, "api_fuzz_report.json")
|
|
586
|
-
with open(report_path, "w", encoding="utf-8") as
|
|
587
|
-
json.dump(scorecard,
|
|
586
|
+
with open(report_path, "w", encoding="utf-8") as out_file:
|
|
587
|
+
json.dump(scorecard, out_file, indent=2)
|
|
588
588
|
print(f"Full telemetry report saved to: {report_path}")
|
|
589
589
|
|
|
590
590
|
return scorecard
|
|
@@ -622,7 +622,7 @@ class ApiFuzzer:
|
|
|
622
622
|
if not is_protected and method.lower() in ("post", "put", "patch", "delete"):
|
|
623
623
|
severity = "HIGH" if re.search(r"admin|internal|user", path, re.IGNORECASE) else "MEDIUM"
|
|
624
624
|
findings.append({
|
|
625
|
-
"finding":
|
|
625
|
+
"finding": "AUTH_NOT_DECLARED: Mutating endpoint declares no security requirement",
|
|
626
626
|
"severity": severity,
|
|
627
627
|
"target": label,
|
|
628
628
|
"recommendation": "Declare securitySchemes/security for this operation or document why it is public.",
|
|
@@ -678,7 +678,7 @@ class ApiFuzzer:
|
|
|
678
678
|
print(f" Verdict : {RED}[FAIL] {blocking} HIGH/CRITICAL pre-flight finding(s).{RESET}")
|
|
679
679
|
else:
|
|
680
680
|
print(f" Verdict : {GREEN}[PASS] No HIGH/CRITICAL spec-level finding.{RESET}")
|
|
681
|
-
print(
|
|
681
|
+
print("======================================================================\n")
|
|
682
682
|
for f in findings:
|
|
683
683
|
print(f" - [{f['severity']}] {f['target']} - {f['finding']}")
|
|
684
684
|
print(f" 👉 {f['recommendation']}")
|
|
@@ -694,8 +694,8 @@ class ApiFuzzer:
|
|
|
694
694
|
"severity_summary": severity_summary,
|
|
695
695
|
"findings": findings,
|
|
696
696
|
}
|
|
697
|
-
with open(report_path, "w", encoding="utf-8") as
|
|
698
|
-
json.dump(scorecard,
|
|
697
|
+
with open(report_path, "w", encoding="utf-8") as out_file:
|
|
698
|
+
json.dump(scorecard, out_file, indent=2)
|
|
699
699
|
print(f"\nFull telemetry report saved to: {report_path}")
|
|
700
700
|
|
|
701
701
|
return scorecard
|
package/tools/auto_heal.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Enterprise Closed-Loop Autonomous Test Healer Engine
|
|
4
4
|
-----------------------------------------------------
|
|
5
|
-
Diagnoses test failures in 0.1s from JUnit XML and terminal logs, queries the
|
|
5
|
+
Diagnoses test failures in 0.1s from JUnit XML and terminal logs, queries the
|
|
6
6
|
semantic memory cache for proven patches, and orchestrates targeted re-tests.
|
|
7
7
|
Dispatched automatically by AI Agents when test runs encounter failures.
|
|
8
8
|
"""
|
|
@@ -12,7 +12,6 @@ import sys
|
|
|
12
12
|
import re
|
|
13
13
|
import json
|
|
14
14
|
import argparse
|
|
15
|
-
from pathlib import Path
|
|
16
15
|
|
|
17
16
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
18
17
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -103,7 +102,7 @@ def diagnose_and_plan_heal(target_dir, junit_xml_path=None):
|
|
|
103
102
|
"heuristic_match": None,
|
|
104
103
|
"recommended_patch": None,
|
|
105
104
|
"verbal_reflection": None,
|
|
106
|
-
"episodic_lessons": [
|
|
105
|
+
"episodic_lessons": [les["lesson_summary"] for les in lessons]
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
# 2b. Reflexion Verbal Diagnosis
|
|
@@ -113,8 +112,8 @@ def diagnose_and_plan_heal(target_dir, junit_xml_path=None):
|
|
|
113
112
|
|
|
114
113
|
if lessons:
|
|
115
114
|
print(f" {CYAN}🧠 [EPISODIC REFLEXION] Top Historical Lessons for Context:{RESET}")
|
|
116
|
-
for idx,
|
|
117
|
-
print(f" {idx}. [{
|
|
115
|
+
for idx, les in enumerate(lessons, 1):
|
|
116
|
+
print(f" {idx}. [{les['page_context']}]: {les['lesson_summary']}")
|
|
118
117
|
print(f" {CYAN}💡 [REFLEXION DIAGNOSIS] {verbal_reflection}{RESET}")
|
|
119
118
|
|
|
120
119
|
if cache_solution:
|
|
@@ -24,8 +24,8 @@ import os
|
|
|
24
24
|
import sys
|
|
25
25
|
import json
|
|
26
26
|
import argparse
|
|
27
|
-
from dataclasses import dataclass
|
|
28
|
-
from typing import List, Optional, Callable,
|
|
27
|
+
from dataclasses import dataclass
|
|
28
|
+
from typing import List, Optional, Callable, Tuple
|
|
29
29
|
|
|
30
30
|
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
31
31
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -25,7 +25,7 @@ import json
|
|
|
25
25
|
import time
|
|
26
26
|
import argparse
|
|
27
27
|
from datetime import datetime, timezone
|
|
28
|
-
from typing import Dict, Any, List, Optional
|
|
28
|
+
from typing import Dict, Any, List, Optional
|
|
29
29
|
|
|
30
30
|
# Enforce UTF-8 stdout encoding
|
|
31
31
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -174,7 +174,7 @@ class ActorQaBroker:
|
|
|
174
174
|
if isinstance(data, list):
|
|
175
175
|
test_items = data
|
|
176
176
|
elif isinstance(data, dict):
|
|
177
|
-
test_items = data.get("tests"
|
|
177
|
+
test_items = data.get("tests") or data.get("test_cases") or []
|
|
178
178
|
except Exception as e:
|
|
179
179
|
sys.stderr.write(f"Notice: Could not parse manifest ({e}), using default mock items.\n")
|
|
180
180
|
|
package/tools/browser_helpers.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
(function () {
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
if (window.__qa && window.__qa.__version === '
|
|
16
|
+
if (window.__qa && window.__qa.__version === '3.0.0') {
|
|
17
17
|
return window.__qa;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const qa = {
|
|
50
|
-
__version: '
|
|
50
|
+
__version: '3.0.0',
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 1. Smart Action Batching
|
package/tools/browsergym_eval.py
CHANGED
|
@@ -22,9 +22,8 @@ import sys
|
|
|
22
22
|
import re
|
|
23
23
|
import json
|
|
24
24
|
import time
|
|
25
|
-
import ast
|
|
26
25
|
import argparse
|
|
27
|
-
from typing import Dict, Any, List, Optional
|
|
26
|
+
from typing import Dict, Any, List, Optional
|
|
28
27
|
|
|
29
28
|
# Enforce UTF-8 stdout encoding
|
|
30
29
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
@@ -35,7 +34,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
35
34
|
pass
|
|
36
35
|
|
|
37
36
|
|
|
38
|
-
DEFAULT_BENCHMARK_TASKS = {
|
|
37
|
+
DEFAULT_BENCHMARK_TASKS: Dict[str, Any] = {
|
|
39
38
|
"ecommerce_order": {
|
|
40
39
|
"name": "E-Commerce Checkout & Order Generation",
|
|
41
40
|
"steps": [
|