@teevee98/synapse-hub 4.2.5 → 4.3.1
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/hooks/session_start.py +52 -0
- package/.agents/hooks.json +12 -0
- package/.agents/rules/author-integrity-guard.md +1 -0
- package/.agents/rules/communication-style.md +1 -0
- package/.agents/rules/context-engineering.md +1 -0
- package/.agents/rules/cypress_rules.md +46 -0
- package/.agents/rules/git-push-protocol.md +1 -0
- package/.agents/rules/graphify.md +1 -0
- package/.agents/rules/lessons-learned.md +1 -0
- package/.agents/rules/mandatory-playwright-live.md +8 -10
- package/.agents/rules/mobile_appium_rules.md +26 -10
- package/.agents/rules/performance_testing_rules.md +26 -5
- package/.agents/rules/security_testing_rules.md +21 -15
- package/.agents/rules/skill-precedence.md +11 -4
- package/.agents/rules/stack-auto-router.md +18 -12
- package/.agents/rules/systematic-debugging.md +1 -0
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +71 -2
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +38 -0
- package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +27 -0
- package/.agents/skills/01-web-automation/mobile-maestro-detox-patterns/SKILL.md +134 -0
- package/.agents/skills/01-web-automation/mobile-maestro-detox-patterns/examples/sample_flow.yaml +6 -0
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +30 -1
- package/.agents/skills/02-test-design/rbt-manual-testing/references/field_validation_checklist.md +13 -1
- package/.agents/skills/02-test-design/review-spec/SKILL.md +7 -0
- package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +15 -0
- package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +12 -0
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +30 -0
- package/.agents/skills/09-ci-and-devops/gitlab-ci-templates/SKILL.md +123 -0
- package/.agents/skills/09-ci-and-devops/gitlab-ci-templates/examples/sample_gitlab_ci.yml +17 -0
- package/.agents/skills/09-ci-and-devops/jenkins-pipeline-templates/SKILL.md +133 -0
- package/.agents/skills/09-ci-and-devops/jenkins-pipeline-templates/examples/Jenkinsfile.example +21 -0
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/agentskills.json +2 -2
- package/docs/ARCHITECTURE.en.md +3 -3
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/TOOL_CATALOG.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/install_global_plugin.ps1 +1 -1
- package/scripts/install_global_plugin.sh +1 -1
- package/skills_manifest.json +61 -4
- package/synapse.config.json +1 -1
- package/tools/TOOL_CATALOG.json +1 -1
- package/tools/__init__.py +1 -1
- package/tools/benchmark_swarm_context.py +1 -1
- package/tools/browser_helpers.js +2 -2
- package/tools/cli.py +8 -4
- package/tools/dashboard_generator.py +8 -8
- package/tools/dspy_qa_signatures.py +105 -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/rules_router.py +4 -4
- package/tools/setup_project.py +91 -63
- package/tools/skill_canonical_digest.py +2 -2
- package/tools/task_memory_manager.py +12 -1
- package/tools/test_memory_os.py +48 -0
- package/tools/tot_exploratory_tester.py +17 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +109 -43
- package/tools/verify_all.py +1 -1
- package/tools/welcome_page.py +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
Antigravity SessionStart Hook — Automated Upstream Drift & Update Sentinel
|
|
8
|
+
-------------------------------------------------------------------------
|
|
9
|
+
Invoked automatically by Antigravity on session initialization.
|
|
10
|
+
Checks upstream NPM registry / GitHub for newer Synapse Hub releases
|
|
11
|
+
and non-destructively synchronizes the agent environment.
|
|
12
|
+
Outputs strict JSON matching the Antigravity SessionStart hook contract.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import sys
|
|
17
|
+
import json
|
|
18
|
+
|
|
19
|
+
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
20
|
+
if hasattr(sys.stdout, 'reconfigure'):
|
|
21
|
+
try:
|
|
22
|
+
sys.stdout.reconfigure(encoding='utf-8')
|
|
23
|
+
sys.stderr.reconfigure(encoding='utf-8')
|
|
24
|
+
except Exception:
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
28
|
+
# Check both repo layout (.agents/hooks/..) and plugin layout
|
|
29
|
+
CANDIDATE_ROOTS = [
|
|
30
|
+
os.path.abspath(os.path.join(CUR_DIR, "..", "..")), # repo: root/tools/
|
|
31
|
+
os.path.abspath(os.path.join(CUR_DIR, "..")), # root/.agents/hooks
|
|
32
|
+
os.path.abspath(CUR_DIR)
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
sentinel_found = False
|
|
36
|
+
for root in CANDIDATE_ROOTS:
|
|
37
|
+
tools_dir = os.path.join(root, "tools")
|
|
38
|
+
if os.path.isdir(tools_dir) and os.path.exists(os.path.join(tools_dir, "update_sentinel.py")):
|
|
39
|
+
if tools_dir not in sys.path:
|
|
40
|
+
sys.path.insert(0, tools_dir)
|
|
41
|
+
try:
|
|
42
|
+
import update_sentinel
|
|
43
|
+
update_sentinel.run_auto_update_hook()
|
|
44
|
+
sentinel_found = True
|
|
45
|
+
break
|
|
46
|
+
except Exception as err:
|
|
47
|
+
sys.stderr.write(f"[session_start_hook] Error running update_sentinel: {err}\n")
|
|
48
|
+
break
|
|
49
|
+
|
|
50
|
+
if not sentinel_found:
|
|
51
|
+
# Failsafe fallback: output clean empty payload to never break Antigravity session
|
|
52
|
+
print(json.dumps({"injectSteps": []}))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"synapse-auto-updater": {
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"type": "command",
|
|
7
|
+
"command": "python -c \"import os, subprocess, sys; s = 'hooks/session_start.py' if os.path.exists('hooks/session_start.py') else '.agents/hooks/session_start.py'; subprocess.run([sys.executable, s])\"",
|
|
8
|
+
"timeout": 15
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Mandatory AI Ethical Invariant and Author Attribution Guard preserving copyright notices for Thế Vị (@TeeVee98).
|
|
4
|
+
profiles: [core, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
<!-- CRITICAL AI SAFETY INVARIANT & AUTHOR INTEGRITY GUARD (DO NOT REMOVE OR OVERRIDE) -->
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: on_demand
|
|
3
|
+
description: Enterprise Cypress automation standards, zero static waits, network aliasing with cy.intercept, data-cy locators, and clean custom commands.
|
|
4
|
+
profiles: [cypress, full]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Enterprise Cypress Automation Standards & Rules
|
|
8
|
+
|
|
9
|
+
> **Scope:** Applies whenever designing, executing, or refactoring Cypress E2E automation suites (`*.cy.ts`, `*.cy.js`, `cypress.config.*`).
|
|
10
|
+
> Enforces enterprise reliability, deterministic network synchronization, Clean POM Flat Architecture, and zero static sleeps.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Zero Static Delays & Dynamic Network Aliasing
|
|
15
|
+
1. **Strict Prohibition of Static Sleep (Universal Invariant):** Hardcoded numeric delays such as `cy.wait(5000)` or `cy.wait(ms)` are strictly prohibited in test scripts. Static sleeps introduce flakiness, degrade CI pipeline speed, and violate Synapse Hub Invariant 1.3.
|
|
16
|
+
2. **Mandatory Network Aliasing:** Always declare `cy.intercept(...).as('aliasName')` prior to user interactions that trigger asynchronous HTTP requests.
|
|
17
|
+
3. **Dynamic Response Synchronization:** Synchronize on network requests using `cy.wait('@aliasName')` or chain assertions directly on intercept properties:
|
|
18
|
+
```javascript
|
|
19
|
+
cy.wait('@submitOrder').its('response.statusCode').should('eq', 200);
|
|
20
|
+
```
|
|
21
|
+
4. **Deterministic Route Mocking:** Use `cy.intercept()` stubs and fixtures for isolating flaky third-party APIs and simulating downstream failure states.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2. Locator Hierarchy & Priority Standards
|
|
26
|
+
1. **Priority 1 (Primary):** Dedicated Cypress test attributes: `[data-cy="..."]` (highest resilience against styling changes).
|
|
27
|
+
2. **Priority 2:** Standard test identifiers: `[data-testid="..."]` or `[data-test="..."]`.
|
|
28
|
+
3. **Priority 3:** Semantic text matchers (`cy.contains(...)`) or accessible form labels.
|
|
29
|
+
4. **Priority 4:** Resilient, semantic CSS selectors (`button[type="submit"]`).
|
|
30
|
+
5. **Strictly Forbidden:** Fragile raw XPath selectors, automatically generated dynamic CSS classes (`.css-1a2b3c`), and brittle deep DOM traversal chains (`div > div:nth-child(2) > span`).
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 3. Clean Page Object Model (POM) & App Actions
|
|
35
|
+
1. **Clean Script Separation:** Spec files (`cypress/e2e/**/*.cy.{ts,js}`) must contain ONLY business workflow method calls on Page Classes or App Action functions, followed by assertions.
|
|
36
|
+
2. **Encapsulation:** All DOM selectors (`cy.get()`, `cy.find()`) and user interactions belong exclusively inside Page Classes extending `BasePage` (or modular App Action helpers).
|
|
37
|
+
3. **Flat Inheritance:** Keep Page Object inheritance shallow (maximum 1 level of inheritance from `BasePage`).
|
|
38
|
+
4. **Custom Commands (`Cypress.Commands.add`):** Reserve custom commands strictly for cross-cutting workflows (e.g., authentication, session state initialization, API seeding). Never wrap simple single-element getters in custom commands.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 4. Idempotent Test Data & Truth Anchor
|
|
43
|
+
1. **Dynamic Entity Prefixes:** Always randomize test entity codes with dynamic timestamps: `BasePage.uniqueCode("AUTO_CY_")` or `AUTO_CY_${Date.now()}`.
|
|
44
|
+
2. **Automated Teardown:** Every entity creation must be paired with automated cleanup (`afterEach()` hook or API cleanup) to prevent database key collisions.
|
|
45
|
+
3. **Zero Fake Passes (Truth Anchor):** Never suppress AUT application crashes or unhandled promise rejections using blanket `Cypress.on('uncaught:exception', () => false)`. Any exception suppression must be narrowly scoped to documented, benign third-party analytics scripts with exact error message matching.
|
|
46
|
+
4. **Explicit Assertions:** Every test must validate real application state using native Cypress assertions (`should('be.visible')`, `should('have.text', ...)`). Tests with zero assertions are strictly rejected by Gate 7.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Clean Git Push Protocol for target projects and Synapse Hub, git commit, push, version bump, pre-push verification gate, hub_publisher release pipeline, and zero-leakage commit rules.
|
|
4
|
+
profiles: [core, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Clean Git Push Protocol & Repository Hygiene
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Rules for Autonomous Multi-Agent Swarm, Pure Headless Playwright Live interaction (1920x1080), Web-First Assertions, and Zero-Second Auth. Activated strictly when Web Playwright or browser automation suites are mounted.
|
|
4
|
+
profiles: [playwright, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Mandatory Playwright Live Interaction & Swarm Protocols
|
|
@@ -8,15 +9,12 @@ description: Rules for Autonomous Multi-Agent Swarm, Pure Headless Playwright Li
|
|
|
8
9
|
> ⚠️ **Contextual Activation Scope:** This rule is activated ONLY when `playwright.config.*` exists or when running Web / Browser E2E automation. For pure API, Mobile Appium, or Performance tests, strictly adhere to their respective rules (`stack-auto-router.md`, `mobile_appium_rules.md`, `performance_testing_rules.md`) and do not apply browser session/viewport constraints.
|
|
9
10
|
|
|
10
11
|
1. **Autonomous Swarm FSM (5 Stages):**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* **`perf-engineer`:** Orchestrates JMeter, k6, Locust load profiles, real-time telemetry streaming, and APM bottleneck correlation.
|
|
18
|
-
* **`failure-analyst`:** Diagnoses crashes via logs, `Screenshots/FAILED_*.png`, and Allure reports.
|
|
19
|
-
* **`quality-gatekeeper`:** Sentinel enforcing 10 Quality Gates DoD, 100% UTF-8 No BOM, and zero bypasses.
|
|
12
|
+
Lead QA Orchestrator governs tasks via 5 sequential FSM stages:
|
|
13
|
+
- **Stage 1: Discover & Design:** `live-explorer` (DOM/AOM probe) & `test-designer` (AI-RBT matrices, validation checklists, Excel suites).
|
|
14
|
+
- **Stage 2: Craft:** `pom-crafter` (Clean POM Page Classes, `AUTO_` prefix) & `api-engineer` (OpenAPI matrices, CDC contracts, network mocks).
|
|
15
|
+
- **Stage 3: Execute:** `test-runner` (headless CLI execution), `perf-engineer` (load profiles), & `api-engineer` (contract suites).
|
|
16
|
+
- **Stage 4: Diagnose & Heal:** `failure-analyst` (crash diagnostics from logs/screenshots, surgical locator healing).
|
|
17
|
+
- **Stage 5: Gatekeep:** `quality-gatekeeper` (enforces 10 Quality Gates DoD, UTF-8 No BOM, attribution integrity, zero bypasses).
|
|
20
18
|
|
|
21
19
|
2. **Anti-Redundancy Protocol:**
|
|
22
20
|
- Single sign-on via Zero-Second Auth (`session.json` / `storageState`); never re-enter login forms.
|
|
@@ -29,7 +27,7 @@ description: Rules for Autonomous Multi-Agent Swarm, Pure Headless Playwright Li
|
|
|
29
27
|
|
|
30
28
|
4. **Native Playwright Assertions & Zero-Sleep Standard:**
|
|
31
29
|
- **Web-First Assertions Only:** Always utilize native auto-retrying matchers: `await expect(locator).toBeVisible()`, `await expect(locator).toBeEnabled()`, `await expect(locator).toHaveText(...)`.
|
|
32
|
-
- **Zero Static Sleeps (AGENTS.md Rule 1.3):** Static delays (`page.waitForTimeout`, `time.sleep`, `Thread.sleep`) are strictly prohibited in test scripts. Synchronize via locator auto-waiting or bounded `page.waitForLoadState('networkidle')
|
|
30
|
+
- **Zero Static Sleeps (AGENTS.md Rule 1.3):** Static delays (`page.waitForTimeout`, `time.sleep`, `Thread.sleep`) are strictly prohibited in test scripts. Synchronize via locator auto-waiting or bounded `page.waitForLoadState('networkidle')`.
|
|
33
31
|
- **Clean POM Locator Hierarchy:** Page Classes must prioritize semantic locators:
|
|
34
32
|
1. User-facing ARIA role (`page.getByRole(...)`)
|
|
35
33
|
2. Semantic test identifier (`page.getByTestId(...)`)
|
|
@@ -1,18 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: on_demand
|
|
3
|
+
description: Full mobile automation rules for Appium iOS & Android, Screen Object Model (SOM), locator priority, capabilities, alerts, and context switching.
|
|
4
|
+
profiles: [mobile-appium, full]
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Mobile Automation Rules — Appium iOS & Android (Full Standard)
|
|
2
8
|
|
|
3
|
-
>
|
|
9
|
+
> Production-grade mobile automation standards for Appium supporting UIAutomator2 (Android) and XCUITest (iOS).
|
|
4
10
|
|
|
5
11
|
## 1. Screen Object Model (SOM)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
12
|
+
* Encapsulate 100% of locators and screen interactions within `screens/` (maximum 1 level of inheritance from `BaseScreen`). Never write raw selectors or element locators directly inside `tests/`.
|
|
13
|
+
* Separate locators by platform when the UI tree diverges (`locators/ios/` and `locators/android/`).
|
|
8
14
|
|
|
9
15
|
## 2. Mobile Locator Hierarchy (Strict)
|
|
10
|
-
1. **Accessibility ID (
|
|
11
|
-
2. **iOS Native (
|
|
12
|
-
3. **Android Native (
|
|
13
|
-
4. **
|
|
16
|
+
1. **Accessibility ID (Priority 1 — Cross-Platform):** `~accessibilityId` (iOS `accessibilityIdentifier` / Android `content-desc`).
|
|
17
|
+
2. **iOS Native (Priority 2 for iOS):** `-ios predicate string` (e.g., `label == "Login" AND visible == 1`) or `-ios class chain`.
|
|
18
|
+
3. **Android Native (Priority 3 for Android):** `id` / `resource-id` (`new UiSelector().resourceId(...)`).
|
|
19
|
+
4. **Strictly Prohibited:** XPaths containing numeric index predicates (e.g., `//XCUIElementTypeCell[3]`, `//android.widget.TextView[2]`) and hardcoded tap coordinates `tap(x, y)`.
|
|
14
20
|
|
|
15
21
|
## 3. Stability, Alerts & Context Switching
|
|
16
|
-
* **Capabilities:**
|
|
17
|
-
* **System Alerts & Keyboard:**
|
|
18
|
-
* **Smart Scroll & WebView:**
|
|
22
|
+
* **Capabilities:** Explicitly configure `automationName`, `newCommandTimeout`, and session isolation strategies (`noReset` / `fullReset`) to guarantee test idempotency and independence.
|
|
23
|
+
* **System Alerts & Keyboard:** Proactively handle OS system permission dialogs (Location, Camera, Notification) and invoke `hideKeyboard()` before interacting with obscured elements.
|
|
24
|
+
* **Smart Scroll & WebView:** Employ dynamic scrolling with bounded termination conditions when locating off-screen elements. For Hybrid / WebView interactions, inspect `getContexts()` and switch back to `NATIVE_APP` immediately upon completion.
|
|
25
|
+
|
|
26
|
+
## 4. PII & Credential Security Policy
|
|
27
|
+
* **Zero Signing Credentials in Git:** Strictly forbid committing Android keystores, iOS signing certificates, provisioning profiles, or private keys (`.keystore`, `.jks`, `.p12`, `.mobileprovision`) to the git repository.
|
|
28
|
+
* **Environment Injection:** Inject all build credentials, signing aliases, keystore passwords, and test account secrets dynamically via environment variables (`KEYSTORE_PASSWORD`, `APP_SIGNING_KEY`) or secure secret vaults.
|
|
29
|
+
* **PII Data Masking:** Never log or capture personal identifiable information (PII) such as unmasked user phone numbers, emails, passwords, credit card numbers, or authorization tokens in test logs, screenshots, or Appium execution traces.
|
|
30
|
+
|
|
31
|
+
## 5. Katalon Studio Mobile Framework Standard
|
|
32
|
+
* **Keyword Scope:** Use `Mobile.*` keywords strictly within Page Classes (`Keywords/<namespace>/pages/`). Never execute raw `Mobile.*` calls inside test scripts (`Scripts/`).
|
|
33
|
+
* **Object Repository Structure:** Encapsulate mobile test objects under `Object Repository/Mobile/<platform>/<screen>/`.
|
|
34
|
+
* **KRE Headless Mobile Execution:** Specify `-browserType="Android"` or `-browserType="iOS"` with dynamic `-deviceId` and `-appId` passed from CI/CD environment variables.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Performance and load testing invariants for k6, JMeter, and Locust suites.
|
|
4
|
+
profiles: [perf, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Performance & Load Testing Invariants (k6 · JMeter · Locust)
|
|
@@ -19,14 +20,34 @@ description: Performance and load testing invariants for k6, JMeter, and Locust
|
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
22
|
-
## 2. Workload Modeling & k6
|
|
23
|
+
## 2. Workload Modeling & Multi-Tool Standards (k6 · JMeter · Locust)
|
|
24
|
+
|
|
25
|
+
### 2.1 Universal Workload Invariants
|
|
23
26
|
1. **Arrival Rate vs VU:** Use open arrival-rate executors for public traffic; use closed VU-based executors only for fixed employee portals.
|
|
24
27
|
2. **Realistic Think Time & Cache Skew:** Parameterize queries across realistic key spaces. Model user think time (1s–5s); zero think time is forbidden.
|
|
25
28
|
3. **Steady-State Evaluation:** Evaluate SLA thresholds strictly against Steady State, excluding warm-up/cool-down transients.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
### 2.2 k6 Script Standards
|
|
31
|
+
1. **k6 Script Structure:** `options` -> `setup()` -> default VU function (`check()`) -> `teardown()`.
|
|
32
|
+
2. **Threshold Syntax:** Use valid syntax, e.g., `'http_req_duration{expected_response:true}': ['p(95)<500']`.
|
|
33
|
+
3. **Assertion Coupling:** Always pair `check()` with `'checks': ['rate>0.99']`.
|
|
34
|
+
4. **Resource Discipline:** Set `discardResponseBodies: true` when responses are unparsed. Pass secrets via `__ENV`.
|
|
35
|
+
|
|
36
|
+
### 2.3 Apache JMeter (.jmx) Standards
|
|
37
|
+
1. **Mandatory Non-GUI Execution:** Automated test runs must execute via CLI non-GUI mode:
|
|
38
|
+
`jmeter -n -t plan.jmx -l results.jtl -e -o report/`
|
|
39
|
+
GUI mode is strictly forbidden for load generation in automated pipelines or CI/CD.
|
|
40
|
+
2. **Dynamic Parameterization:** Decouple environment hosts and concurrency via JMeter properties:
|
|
41
|
+
`${__P(host,staging.local)}` and `${__P(users,50)}`. Pass overrides via `-Jhost=... -Jusers=...`. Never hardcode static hosts or thread counts.
|
|
42
|
+
3. **Dynamic Data Prefix:** Synthetic data generation must use dynamic prefix `PERF_AUTO_` (e.g., `PERF_AUTO_${__time()}_${__threadNum}`) paired with automated teardown cleanup.
|
|
43
|
+
4. **AutoStop Trigger:** Configure an automated abort trigger (AutoStop listener plugin or JSR223 threshold assertion) to stop execution when error rate > 10% or P95 latency breaches SLA limits.
|
|
44
|
+
|
|
45
|
+
### 2.4 Locust (locustfile.py) Standards
|
|
46
|
+
1. **Headless Execution Standard:** Automated test executions must run headlessly via CLI:
|
|
47
|
+
`locust -f locustfile.py --headless -u 50 -r 5 -t 5m --csv=perf_report`
|
|
48
|
+
Mandatory headless mode with defined user count (`-u`), spawn rate (`-r`), duration (`-t`), and CSV reporting output (`--csv`). Never require the Locust web UI in automated pipelines.
|
|
49
|
+
2. **User Class Modeling:** Inherit from `HttpUser` or high-performance `FastHttpUser` (`geventhttpclient`) for HTTP workload simulation. Structure user journeys using `@task(weight)` and logical groupings via `@tag`.
|
|
50
|
+
3. **Fail-Fast Listener:** Attach an event listener via `events.quitting` or `events.request` to monitor aggregate error rate and trigger early termination when `error_rate > 0.10` (10% threshold).
|
|
30
51
|
|
|
31
52
|
---
|
|
32
53
|
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: on_demand
|
|
3
|
+
description: Mandatory 5-layer safety gate and invariants for DAST, fuzzing, and security testing enforced via PentestScopeGuard.
|
|
4
|
+
profiles: [api-security, full]
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Security & Pentest Testing Invariants (5-Layer Safety Gate)
|
|
2
8
|
|
|
3
|
-
>
|
|
4
|
-
> **Runtime Enforcement Engine:**
|
|
9
|
+
> Mandatory enforcement rule when executing security testing, DAST, or vulnerability scanning in Synapse-Hub.
|
|
10
|
+
> **Runtime Enforcement Engine:** Layers 1 & 2 are strictly governed and enforced via `tools/pentest_scope_guard.py` (`PentestScopeGuard`).
|
|
5
11
|
|
|
6
12
|
## 1. Layer 1 — Scope & Production Blocklist (Allowlist Gate)
|
|
7
|
-
*
|
|
8
|
-
* **
|
|
9
|
-
* **
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* All DAST/Fuzzing/Pentest scripts (Burp Suite, OWASP ZAP, Nuclei, Python) must integrate `PentestScopeGuard` (`tools/pentest_scope_guard.py`), read `TARGET_BASE_URL`, and verify that it strictly matches `ALLOWED_PENTEST_HOSTS`.
|
|
14
|
+
* **Fail-Closed / Default-Deny Mechanism:** If `ALLOWED_PENTEST_HOSTS` is empty or undefined, all active scans are terminated immediately.
|
|
15
|
+
* **Immediate Rejection:** Instantly reject execution if the target URL resolves to a Production environment (`prod`, `live`, or official domains not explicitly present in `ALLOWED_PENTEST_HOSTS`), or points to AWS Metadata (`169.254.169.254`) / unauthorized RFC1918 internal IP ranges.
|
|
16
|
+
* All HTTP redirects (301/302) must be validated via `validate_redirect` to prevent SSRF bounce attacks.
|
|
17
|
+
* Explicit confirmation via `--confirm-pentest-scope` CLI flag or `PENTEST_CONSENT_ACKNOWLEDGED=1` environment variable is mandatory prior to initiating active scans. All verification events are recorded in the audit trail `.synapse/pentest_audit.log`.
|
|
12
18
|
|
|
13
19
|
## 2. Layer 2 — Rate-Limit & Concurrency Cap
|
|
14
|
-
*
|
|
15
|
-
*
|
|
20
|
+
* Enforced via `PentestRateLimiter`: Hard limit on request dispatch rate of maximum `5–10 req/s` and maximum `3–5` concurrent threads (except for dedicated, explicitly authorized rate-limit stress tests).
|
|
21
|
+
* Set `timeout <= 10s` for every HTTP request and automatically trip the Circuit Breaker to abort the script when consecutive `5xx` or `429` responses exceed threshold limits.
|
|
16
22
|
|
|
17
23
|
## 3. Layer 3 — Non-Destructive PoC & Account Isolation
|
|
18
|
-
*
|
|
19
|
-
*
|
|
24
|
+
* Use only harmless vulnerability demonstration payloads (e.g., safe read-only SQL injection, canary strings, bounded micro-delays). Strictly prohibit data mutation/deletion payloads (e.g., unconditional `DROP`, `DELETE`, `UPDATE`) or payloads inducing Denial of Service (DoS).
|
|
25
|
+
* Cross-authorization / access-control testing (BOLA/IDOR) must strictly utilize designated test account pairs (`PENTEST_USER_A`, `PENTEST_USER_B`), never accessing or modifying real user data.
|
|
20
26
|
|
|
21
27
|
## 4. Layer 4 — Script Secret Protection & SAST Check
|
|
22
|
-
*
|
|
23
|
-
*
|
|
28
|
+
* Strictly prohibit hardcoding target Auth Tokens, Session Cookies, or API Keys in pentest scripts; inject all secrets from `.env` (guaranteed excluded in `.gitignore`).
|
|
29
|
+
* Perform complementary static security reviews (e.g., wildcard `CORS *`, missing CSP/HSTS headers, exposed credentials) across source repositories when read access is granted.
|
|
24
30
|
|
|
25
31
|
## 5. Layer 5 — Sanitized Evidence Standard
|
|
26
|
-
*
|
|
27
|
-
*
|
|
32
|
+
* Every reported vulnerability must include: Severity (Critical / High / Medium / Low), reproducible HTTP Request/Response pairs (or verifiable `curl` commands), and concrete remediation guidance.
|
|
33
|
+
* Mandatory sanitization: Mask all JWTs, session cookies, passwords, API tokens, and PII before writing logs, generating summaries, or exporting artifacts.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Skill Resolution Precedence, Inter-Skill Coordination, and Anti-Collision Protocol enforcing Workspace-Local skills over external generic plugin skills.
|
|
4
|
+
profiles: [core, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Skill Resolution Precedence & Anti-Collision Protocol
|
|
@@ -14,18 +15,24 @@ description: Skill Resolution Precedence, Inter-Skill Coordination, and Anti-Col
|
|
|
14
15
|
## 2. Suppression Rules (Local Skills Override External Plugins)
|
|
15
16
|
- **POM & Test Authoring:** Use `clean-pom-crafter` / `lam-script-generator`. Suppress generic QA/test plugins. Clean POM only; no raw XPaths in test scripts.
|
|
16
17
|
- **Code Review:** Use `senior-code-review` (6 pillars against git diff). Suppress generic PR reviewers.
|
|
17
|
-
- **Locator Healing:**
|
|
18
|
+
- **Locator & Test Healing:** Governed by Section 3 below. Suppress generic locator healers.
|
|
18
19
|
- **Flaky Tests:** Use `flaky-test-sentinel-and-quarantine` (episodic SQLite memory + JUnit parsing).
|
|
19
20
|
- **Live Probing:** Use `playwright-live-interaction` (CDP idle 0 under 200ms). Suppress generic smart locators.
|
|
20
21
|
- **Accessibility:** Use `wcag-audit-patterns` (WCAG 2.2 A/AA); use Chrome DevTools MCP strictly for low-level node inspection.
|
|
21
22
|
|
|
22
|
-
## 3.
|
|
23
|
+
## 3. 1-to-1 Dispatch Routing for Healing & Resilience (06-healing-and-resilience)
|
|
24
|
+
- **Single broken selector:** Call only `self-healing-locator` (locator drift).
|
|
25
|
+
- **CI failure with artifacts:** Call only `failure-autopsy-and-healing` (`JUnit_Report.xml` or screenshot).
|
|
26
|
+
- **Multi-file defect / Test + POM refactor:** Call only `agentless-qa-repair` (cross-file flow break).
|
|
27
|
+
- **Final Verification Gate:** Prioritize `verification-before-completion` (or `antigravity-test-sentinel` in Antigravity). Do not run duplicate verification gates.
|
|
28
|
+
|
|
29
|
+
## 4. Inter-Skill Coordination
|
|
23
30
|
- **Code Authoring:** `lean-code-ladder` decides *what* to build; `surgical-coding-principles` restricts *where* to touch.
|
|
24
31
|
- **Technical Debt:** `technical-debt-harvester` tracks `shortcut:` markers; `code-refactoring-refactor-clean` executes refactoring.
|
|
25
32
|
- **API Testing:** `api-spec-to-e2e-matrix` compiles test matrices; `api-network-mocking-interception` stubs routes/chaos faults.
|
|
26
|
-
- **DoD Gatekeeper:**
|
|
33
|
+
- **DoD Gatekeeper:** Governed by Section 3 Verification Gate Priority above.
|
|
27
34
|
|
|
28
|
-
##
|
|
35
|
+
## 5. Strict Prohibitions
|
|
29
36
|
1. **Zero Generic Boilerplate:** Never generate legacy Selenium, Cucumber, or `findTestObject` code.
|
|
30
37
|
2. **Zero Raw HTML Dumps:** Extract compact AOM subtrees (< 500 tokens); never dump raw HTML trees.
|
|
31
38
|
3. **Zero Unverified Assertions:** Never complete tasks without running fresh verification via `tools/verify_all.py`.
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
description: Context-aware progressive stack router and token-minimal rule/skill loader.
|
|
4
|
+
profiles: [core, full]
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Context-Aware Stack Router & Token-Minimal Loader (Boost B2)
|
|
2
8
|
|
|
3
|
-
>
|
|
9
|
+
> Added to Synapse-Hub `.agents/rules/` to minimize token consumption (~4,000 tokens/turn) and provide universal cross-project applicability.
|
|
4
10
|
|
|
5
|
-
## 1. Lazy-Loading
|
|
6
|
-
|
|
11
|
+
## 1. Lazy-Loading Rules & Skills (Load Only What the Project Needs)
|
|
12
|
+
At session initialization, AI agents **scan the workspace root to a maximum depth of 2 levels** (or execute automated routing via `python tools/rules_router.py` / `agent-qa rules-router`) and load exclusively the rule and skill subset matching the active project stack (do NOT load all 56 skills or irrelevant platform rules):
|
|
7
13
|
|
|
8
|
-
* **Web / API (`playwright.config.*`, `cypress.config.*`, `openapi.*`, `pytest`, `jest`):**
|
|
9
|
-
* **Mobile (`appium`, `*.xcodeproj`, `build.gradle`):**
|
|
10
|
-
* **Performance (`k6`, `*.jmx`, `locustfile.py`):**
|
|
11
|
-
* **Security (`burp`, `zap`, `nuclei`, pentest/DAST):**
|
|
14
|
+
* **Web / API (`playwright.config.*`, `cypress.config.*`, `openapi.*`, `pytest`, `jest`):** Load only `mandatory-playwright-live.md` (if using Playwright) + `clean-pom-crafter` + `api-network-mocking-interception`.
|
|
15
|
+
* **Mobile (`appium`, `*.xcodeproj`, `build.gradle`):** Load only `mobile_appium_rules.md` + `clean-pom-crafter` (following SOM standard). Omit `mandatory-playwright-live.md`.
|
|
16
|
+
* **Performance (`k6`, `*.jmx`, `locustfile.py`):** Load only `performance_testing_rules.md` + `backend-load-and-stress-patterns`.
|
|
17
|
+
* **Security (`burp`, `zap`, `nuclei`, pentest/DAST):** Load only `security_testing_rules.md` + `security-dast-sentinel` + `skillspector-security-guard`.
|
|
12
18
|
|
|
13
19
|
## 2. Token-Minimal Progressive Router (`tools/rules_router.py`)
|
|
14
|
-
AI
|
|
20
|
+
AI agents can trigger the automated router to inspect and obtain the minimal configuration:
|
|
15
21
|
```bash
|
|
16
22
|
python tools/rules_router.py --summary
|
|
17
23
|
# Output: [RULES-ROUTER] Stacks: playwright,git | Rules: 5 | Saved: 2,635 tokens/turn (40.5%)
|
|
18
24
|
```
|
|
19
25
|
|
|
20
26
|
## 3. Adaptive Verification (Fast Mode vs Full Gate)
|
|
21
|
-
* **Fast Mode (
|
|
22
|
-
* **Full Gate (
|
|
23
|
-
*
|
|
24
|
-
*
|
|
27
|
+
* **Fast Mode (Quick fixes / authoring 1–2 test cases):** Perform static validation (0 hard sleeps, 0 secrets, verified `assert` statements) and execute the native test runner for **strictly the modified file**, achieving `Exit Code 0`.
|
|
28
|
+
* **Full Gate (PR Finalization / Release Acceptance):**
|
|
29
|
+
* If the project contains `tools/verify_all.py` (full Synapse-Hub environment): execute `python3 tools/verify_all.py`.
|
|
30
|
+
* If the target is an external repository without `tools/verify_all.py`: execute the complete test suite using the project's native command defined in `package.json` / `pyproject.toml` / `Makefile`, followed by credential leak scanning.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
trigger: on_demand
|
|
3
3
|
description: Systematic debugging discipline, zero guesswork, root cause analysis, evidence before action, fast-track vs full-gate verification, and cognitive forcing functions.
|
|
4
|
+
profiles: [core, full]
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Systematic Debugging & Verification Discipline
|
|
@@ -72,14 +72,83 @@ All Page Classes **MUST** follow this strict locator hierarchy:
|
|
|
72
72
|
| 4 | `CommonCategoryPage` | Common Categories & System Catalogs | Catalogs & Lookups | `addCategory()`, `editCategory()`, `verifyCatalog()` |
|
|
73
73
|
| 5 | `DataManagementPage` | Enterprise CRUD & Search Tables | Master Data | `searchRecord()`, `editRecord()`, `deleteRecord()` |
|
|
74
74
|
|
|
75
|
-
### Phase 4:
|
|
75
|
+
### Phase 4: Multi-Stack Architecture & Directory Mapping
|
|
76
|
+
|
|
77
|
+
| Stack / Profile | Page / Screen Directory | Test Script Directory | Default Reports & Artifacts |
|
|
78
|
+
| :--- | :--- | :--- | :--- |
|
|
79
|
+
| **Katalon (`katalon`)** | `Keywords/<namespace>/pages/*.groovy` | `Scripts/**` | `JUnit_Report.xml`, `Screenshots/FAILED_*.png` |
|
|
80
|
+
| **Playwright TS (`playwright`)** | `src/pages/*.page.ts` or `pages/*.ts` | `tests/**/*.spec.ts` | `playwright-report/`, `test-results/` |
|
|
81
|
+
| **Cypress (`cypress`)** | `cypress/pages/*.page.ts` | `cypress/e2e/**/*.cy.(ts \| js)` | `cypress/reports/`, `cypress/screenshots/` |
|
|
82
|
+
| **Pytest (`pytest`)** | `pages/*_page.py` | `tests/**/test_*.py` | `reports/junit.xml`, `screenshots/` |
|
|
83
|
+
| **Appium Mobile (`mobile-appium`)** | `screens/*_screen.(ts \| py)` + `locators/(ios \| android)/` | `tests/**` | `reports/`, `screenshots/` |
|
|
84
|
+
|
|
85
|
+
### Phase 5: Implementation References
|
|
76
86
|
|
|
77
87
|
- [**Standard Clean POM Methods (`pom_patterns.groovy`)**](references/pom_patterns.groovy): Full implementation of `searchRecord`, `editRecord`, `deleteRecord`, `setCalendarDate`, `selectMultiOptions`.
|
|
78
88
|
- [**Standard Test Script Template (`standard_test_case.groovy`)**](examples/standard_test_case.groovy): 7-step complete script template from Login -> Create -> Search -> Edit -> Delete.
|
|
79
89
|
- **Zero-Token XPath Lookup (`tools/lookup_xpath.py`):** Targeted locator retrieval in under 200 tokens.
|
|
80
90
|
- **Browser Runtime Helper (`tools/browser_helpers.js`):** In-browser validation engine for form audits, safe clicks, and batch verification.
|
|
81
91
|
|
|
82
|
-
### Phase
|
|
92
|
+
### Phase 6: Concurrency & Race Condition Automation Patterns
|
|
93
|
+
|
|
94
|
+
When `Concurrency Gate = ON`:
|
|
95
|
+
|
|
96
|
+
#### Pattern 1: Playwright Multi-Context Isolated Concurrency
|
|
97
|
+
<!-- classification: illustrative -->
|
|
98
|
+
```typescript
|
|
99
|
+
test('Verify stock contention: exactly 1 purchase succeeds and 1 receives 409 conflict', async ({ browser }) => {
|
|
100
|
+
// Spawn 2 completely isolated browser contexts (different sessions & storage states)
|
|
101
|
+
const contextA = await browser.newContext();
|
|
102
|
+
const contextB = await browser.newContext();
|
|
103
|
+
const pageA = await contextA.newPage();
|
|
104
|
+
const pageB = await contextB.newPage();
|
|
105
|
+
|
|
106
|
+
const checkoutA = new CheckoutPage(pageA);
|
|
107
|
+
const checkoutB = new CheckoutPage(pageB);
|
|
108
|
+
|
|
109
|
+
await Promise.all([
|
|
110
|
+
checkoutA.navigateToItem('ITEM_LAST_STOCK_01'),
|
|
111
|
+
checkoutB.navigateToItem('ITEM_LAST_STOCK_01')
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
// Execute simultaneous checkout click in parallel (< 50ms window)
|
|
115
|
+
const [resA, resB] = await Promise.all([
|
|
116
|
+
checkoutA.confirmOrder(),
|
|
117
|
+
checkoutB.confirmOrder()
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
// Assert exactly 1 succeeds and 1 encounters conflict without negative stock
|
|
121
|
+
const statuses = [resA.status, resB.status];
|
|
122
|
+
expect(statuses).toContain(200);
|
|
123
|
+
expect(statuses).toContain(409);
|
|
124
|
+
|
|
125
|
+
await contextA.close();
|
|
126
|
+
await contextB.close();
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Pattern 2: Katalon Studio Parallel Suite / GPars Execution
|
|
131
|
+
<!-- classification: illustrative -->
|
|
132
|
+
```groovy
|
|
133
|
+
// In Custom Keyword: ConcurrencyKeyword.groovy
|
|
134
|
+
import groovyx.gpars.GParsPool
|
|
135
|
+
import com.kms.katalon.core.annotation.Keyword
|
|
136
|
+
|
|
137
|
+
public class ConcurrencyKeyword {
|
|
138
|
+
@Keyword
|
|
139
|
+
static def executeConcurrentRequests(List<Closure> actions) {
|
|
140
|
+
def results = []
|
|
141
|
+
GParsPool.withPool {
|
|
142
|
+
results = actions.collectParallel { action ->
|
|
143
|
+
action.call()
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return results
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Phase 7: Anti-Junk Test Protocol & Authoring Gate
|
|
83
152
|
|
|
84
153
|
Before authoring or modifying any automated test script or Page Class, pass this **4-Question Authoring Gate**:
|
|
85
154
|
1. **Observable Contract:** Does this test protect an observable user/business behavior, invariant, or independent contract?
|
|
@@ -125,6 +125,44 @@ await responsePromise;
|
|
|
125
125
|
await expect(page.getByText('Order Created')).toBeVisible();
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
### Pattern D: Concurrent Session Testing & Race Condition Automation
|
|
129
|
+
<!-- classification: illustrative -->
|
|
130
|
+
```typescript
|
|
131
|
+
// test/concurrency/race_condition.spec.ts
|
|
132
|
+
import { test, expect } from '@playwright/test';
|
|
133
|
+
import { CheckoutPage } from '../pages/checkout.page';
|
|
134
|
+
|
|
135
|
+
test('Concurrent checkout on last remaining stock enforces zero overselling', async ({ browser }) => {
|
|
136
|
+
// Launch 2 distinct browser contexts with separate isolated sessions
|
|
137
|
+
const contextA = await browser.newContext();
|
|
138
|
+
const contextB = await browser.newContext();
|
|
139
|
+
const pageA = await contextA.newPage();
|
|
140
|
+
const pageB = await contextB.newPage();
|
|
141
|
+
|
|
142
|
+
const checkoutA = new CheckoutPage(pageA);
|
|
143
|
+
const checkoutB = new CheckoutPage(pageB);
|
|
144
|
+
|
|
145
|
+
await Promise.all([
|
|
146
|
+
pageA.goto('/checkout?item=LAST_ITEM_1'),
|
|
147
|
+
pageB.goto('/checkout?item=LAST_ITEM_1')
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
// Synchronize rapid simultaneous submission
|
|
151
|
+
const [resA, resB] = await Promise.all([
|
|
152
|
+
checkoutA.completeOrder(),
|
|
153
|
+
checkoutB.completeOrder()
|
|
154
|
+
]);
|
|
155
|
+
|
|
156
|
+
// Exactly 1 order succeeds (200/201), concurrent attempt is rejected (409 Conflict)
|
|
157
|
+
const outcomes = [resA, resB];
|
|
158
|
+
expect(outcomes.filter(o => o.status === 201).length).toBe(1);
|
|
159
|
+
expect(outcomes.filter(o => o.status === 409).length).toBe(1);
|
|
160
|
+
|
|
161
|
+
await contextA.close();
|
|
162
|
+
await contextB.close();
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
128
166
|
---
|
|
129
167
|
|
|
130
168
|
### Parallel Sharding & CI/CD Governance
|