@teevee98/synapse-hub 3.9.1 → 4.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/rules/git-push-protocol.md +1 -1
- package/.agents/rules/mandatory-playwright-live.md +21 -5
- package/.agents/rules/mobile_appium_rules.md +14 -39
- package/.agents/rules/security_testing_rules.md +24 -0
- package/.agents/rules/stack-auto-router.md +24 -0
- package/.agents/rules/systematic-debugging.md +9 -8
- package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/SKILL.md +18 -1
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +116 -0
- package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/SKILL.md +9 -4
- package/.agents/workflows/generate_manual_testcases_rbt.md +1 -1
- package/AGENTS.md +2 -1
- package/Dockerfile +14 -6
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +16 -2
- package/docs/ARCHITECTURE.en.md +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/install_global_plugin.ps1 +19 -2
- package/scripts/install_global_plugin.sh +21 -2
- package/skills_manifest.json +514 -511
- package/synapse.config.json +1 -1
- package/tools/TOOL_CATALOG.json +1 -1
- package/tools/__init__.py +1 -1
- package/tools/ast_cache.py +173 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/build_consolidated_report.py +1 -1
- package/tools/cache_resolver.py +11 -6
- package/tools/cli.py +16 -3
- package/tools/core/file_lock.py +106 -8
- package/tools/core/process_supervisor.py +65 -11
- package/tools/core/telemetry.py +32 -3
- package/tools/dashboard_generator.py +6 -6
- package/tools/db_sandbox.py +53 -10
- package/tools/git_pre_commit_guard.py +6 -4
- package/tools/infer_linter.py +2 -2
- package/tools/lint_ai_docs.py +19 -5
- 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/package_release.py +29 -5
- package/tools/pinpoint_failure.py +14 -2
- package/tools/reversible_sandbox.py +85 -7
- package/tools/rules_router.py +373 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/verify_all.py +43 -1
- package/tools/wcag_audit.py +1 -1
- package/tools/welcome_page.py +1 -1
- package/.agents/skills/wcag-audit-patterns/SKILL.md +0 -77
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/SKILL.md +0 -0
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/multi_role_auth_matrix.md +0 -0
- /package/.agents/skills/{auth-session-and-cookie-manager → 01-web-automation/auth-session-and-cookie-manager}/examples/storage_state_sample.json +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/examples/cli_runner_test.bats +0 -0
- /package/.agents/skills/{bats-testing-patterns → 01-web-automation/bats-testing-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/SKILL.md +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/examples/standard_test_case.groovy +0 -0
- /package/.agents/skills/{clean-pom-crafter → 01-web-automation/clean-pom-crafter}/references/pom_patterns.groovy +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/examples/playwright_sharded_config.ts +0 -0
- /package/.agents/skills/{e2e-testing-patterns → 01-web-automation/e2e-testing-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/SKILL.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/examples/headless_kre_exec.sh +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/groovy-patterns.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/katalon-api.md +0 -0
- /package/.agents/skills/{katalon-cli-runner → 01-web-automation/katalon-cli-runner}/references/runner_commands.md +0 -0
- /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/SKILL.md +0 -0
- /package/.agents/skills/{lam-script-generator → 01-web-automation/lam-script-generator}/examples/user_story_sample.md +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/SKILL.md +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/BaseScreen.java +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/LoginScreen.java +0 -0
- /package/.agents/skills/{mobile-appium-som → 01-web-automation/mobile-appium-som}/examples/TC_MobileLogin.java +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/SKILL.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/examples/live_probe_script.js +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/advanced_superpowers.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/compact_accessibility_snapshots.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/recipes.md +0 -0
- /package/.agents/skills/{playwright-live-interaction → 01-web-automation/playwright-live-interaction}/references/swarm_orchestration.md +0 -0
- /package/.agents/skills/{playwright-webapp-testing → 01-web-automation/playwright-webapp-testing}/examples/server_lifecycle_playwright.py +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/SKILL.md +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/benchmark_report_sample.json +0 -0
- /package/.agents/skills/{web-agent-gym-benchmarking → 01-web-automation/web-agent-gym-benchmarking}/examples/enterprise_tasks_suite.json +0 -0
- /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/SKILL.md +0 -0
- /package/.agents/skills/{architecture-decision-records → 02-test-design/architecture-decision-records}/examples/0001-record-architecture-decisions.md +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/SKILL.md +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/checkout.feature +0 -0
- /package/.agents/skills/{gherkin-to-suite → 02-test-design/gherkin-to-suite}/examples/suite_report_sample.json +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/SKILL.md +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/examples/checkout_rbt_manual_suite.md +0 -0
- /package/.agents/skills/{rbt-manual-testing → 02-test-design/rbt-manual-testing}/references/field_validation_checklist.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/SKILL.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/pocock_grilling_decision_rubric.md +0 -0
- /package/.agents/skills/{review-spec → 02-test-design/review-spec}/examples/sample_spec_review.md +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/SKILL.md +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/payment_gateway_tot_tree.json +0 -0
- /package/.agents/skills/{tot-exploratory-testing → 02-test-design/tot-exploratory-testing}/examples/tot_graph_sample.json +0 -0
- /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/SKILL.md +0 -0
- /package/.agents/skills/{api-network-mocking-interception → 03-api-and-contracts/api-network-mocking-interception}/examples/network_route_stub.json +0 -0
- /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/SKILL.md +0 -0
- /package/.agents/skills/{api-spec-to-e2e-matrix → 03-api-and-contracts/api-spec-to-e2e-matrix}/examples/sample_openapi.json +0 -0
- /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/SKILL.md +0 -0
- /package/.agents/skills/{consumer-driven-contract-testing → 03-api-and-contracts/consumer-driven-contract-testing}/examples/order_service_pact.json +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/SKILL.md +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/examples/k6_load_test_sample.js +0 -0
- /package/.agents/skills/{backend-load-and-stress-patterns → 04-performance-and-load/backend-load-and-stress-patterns}/references/k6_load_template.js +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/SKILL.md +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_benchmark_gain.md +0 -0
- /package/.agents/skills/{lean-impact-scoreboard → 04-performance-and-load/lean-impact-scoreboard}/examples/sample_scoreboard.md +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/SKILL.md +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/cwv_budget_policy.json +0 -0
- /package/.agents/skills/{web-vitals-and-performance-profiler → 04-performance-and-load/web-vitals-and-performance-profiler}/examples/playwright_cwv_profiler_fixture.ts +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/examples/dast_scan_config.json +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/AI-AND-LLM.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/ATTACK-CLASSES.md +0 -0
- /package/.agents/skills/{security-dast-sentinel → 05-security-and-compliance/security-dast-sentinel}/references/dast_recipes.ts +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/SKILL.md +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/audit_threat_vectors_report.json +0 -0
- /package/.agents/skills/{skillspector-security-guard → 05-security-and-compliance/skillspector-security-guard}/examples/safe_mcp_config.json +0 -0
- /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/examples/wcag_compliance_checklist.json +0 -0
- /package/.agents/skills/{wcag-audit-patterns → 05-security-and-compliance/wcag-audit-patterns}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/SKILL.md +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/healing_report_sample.json +0 -0
- /package/.agents/skills/{agentless-qa-repair → 06-healing-and-resilience/agentless-qa-repair}/examples/three_phase_repair_workflow.md +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/dod_gate_policy.json +0 -0
- /package/.agents/skills/{antigravity-test-sentinel → 06-healing-and-resilience/antigravity-test-sentinel}/examples/sprint_dod_enforcement.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/SKILL.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/closed_loop_healing_walkthrough.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/examples/sample_junit_failure.xml +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/healing_matrix.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/references/qa_investigation_protocol.md +0 -0
- /package/.agents/skills/{failure-autopsy-and-healing → 06-healing-and-resilience/failure-autopsy-and-healing}/scripts/triage_failures.sh +0 -0
- /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/SKILL.md +0 -0
- /package/.agents/skills/{flaky-test-sentinel-and-quarantine → 06-healing-and-resilience/flaky-test-sentinel-and-quarantine}/examples/quarantine_registry.json +0 -0
- /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/SKILL.md +0 -0
- /package/.agents/skills/{self-healing-locator → 06-healing-and-resilience/self-healing-locator}/examples/aom_diff_sample.json +0 -0
- /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/SKILL.md +0 -0
- /package/.agents/skills/{systematic-debugging → 06-healing-and-resilience/systematic-debugging}/examples/four_phase_case.md +0 -0
- /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/SKILL.md +0 -0
- /package/.agents/skills/{test-driven-development → 06-healing-and-resilience/test-driven-development}/examples/red_green_refactor_qa.md +0 -0
- /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/SKILL.md +0 -0
- /package/.agents/skills/{verification-before-completion → 06-healing-and-resilience/verification-before-completion}/examples/evidence_log_example.md +0 -0
- /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/SKILL.md +0 -0
- /package/.agents/skills/{visual-regression-sentinel → 06-healing-and-resilience/visual-regression-sentinel}/examples/visual_mask_rules.json +0 -0
- /package/.agents/skills/{db-state-verifier-and-seeder → 07-data-and-state/db-state-verifier-and-seeder}/examples/db_fixture_seed.json +0 -0
- /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/SKILL.md +0 -0
- /package/.agents/skills/{file-and-report-validator → 07-data-and-state/file-and-report-validator}/examples/sample_export_schema.json +0 -0
- /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/SKILL.md +0 -0
- /package/.agents/skills/{synthetic-test-data-generator → 07-data-and-state/synthetic-test-data-generator}/examples/idempotent_data_recipe.json +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/SKILL.md +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_page_sample.groovy +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/examples/refactored_playwright_pom.ts +0 -0
- /package/.agents/skills/{code-refactoring-refactor-clean → 08-code-quality/code-refactoring-refactor-clean}/resources/implementation-playbook.md +0 -0
- /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/SKILL.md +0 -0
- /package/.agents/skills/{graphify-impact-analyzer → 08-code-quality/graphify-impact-analyzer}/examples/dependency_blast_radius.json +0 -0
- /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/SKILL.md +0 -0
- /package/.agents/skills/{lean-code-ladder → 08-code-quality/lean-code-ladder}/examples/ladder_walkthrough.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/SKILL.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_audit_walkthrough.md +0 -0
- /package/.agents/skills/{repo-quality-audit → 08-code-quality/repo-quality-audit}/examples/sample_repo_audit.md +0 -0
- /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/SKILL.md +0 -0
- /package/.agents/skills/{senior-code-review → 08-code-quality/senior-code-review}/examples/sample_review_walkthrough.md +0 -0
- /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/SKILL.md +0 -0
- /package/.agents/skills/{surgical-coding-principles → 08-code-quality/surgical-coding-principles}/examples/surgical_vs_scope_creep.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/SKILL.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_debt_ledger.md +0 -0
- /package/.agents/skills/{technical-debt-harvester → 08-code-quality/technical-debt-harvester}/examples/sample_ledger_output.md +0 -0
- /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/SKILL.md +0 -0
- /package/.agents/skills/{github-actions-templates → 09-ci-and-devops/github-actions-templates}/examples/matrix_test_pipeline.yml +0 -0
- /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/SKILL.md +0 -0
- /package/.agents/skills/{actor-qa-swarm → 10-agent-orchestration/actor-qa-swarm}/examples/broker_sharding_sample.json +0 -0
- /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/SKILL.md +0 -0
- /package/.agents/skills/{agent-orchestration-multi-agent-optimize → 10-agent-orchestration/agent-orchestration-multi-agent-optimize}/examples/swarm_workload_config.json +0 -0
- /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/SKILL.md +0 -0
- /package/.agents/skills/{event-stream-qa-orchestrator → 10-agent-orchestration/event-stream-qa-orchestrator}/examples/timeline_sample.jsonl +0 -0
- /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/SKILL.md +0 -0
- /package/.agents/skills/{persistent-planning-files → 10-agent-orchestration/persistent-planning-files}/examples/task_plan_example.md +0 -0
- /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/SKILL.md +0 -0
- /package/.agents/skills/{qa-memory-os → 10-agent-orchestration/qa-memory-os}/examples/archival_memory_sample.json +0 -0
- /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/SKILL.md +0 -0
- /package/.agents/skills/{meta-prompt-crafter → 11-ai-and-prompting/meta-prompt-crafter}/examples/qa_prompt_template.md +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/SKILL.md +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/compiled_module_sample.json +0 -0
- /package/.agents/skills/{mipro-prompt-compiler → 11-ai-and-prompting/mipro-prompt-compiler}/examples/dspy_assertion_optimizer_case.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/SKILL.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_code_window_walkthrough.md +0 -0
- /package/.agents/skills/{qa-aci-interface → 11-ai-and-prompting/qa-aci-interface}/examples/surgical_edit_sample.json +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/SKILL.md +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/examples/distilled_log_sample.txt +0 -0
- /package/.agents/skills/{token-and-context-optimizer → 11-ai-and-prompting/token-and-context-optimizer}/references/context_engineering_guide.md +0 -0
|
@@ -1348,7 +1348,7 @@ def _build_target_translations(
|
|
|
1348
1348
|
"th_step_status": "Trạng Thái",
|
|
1349
1349
|
"th_step_details": "Chi Tiết Kỹ Thuật (OTel & AST)",
|
|
1350
1350
|
|
|
1351
|
-
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub
|
|
1351
|
+
"footer_text": "Báo cáo được khởi tạo tự động bởi Synapse-Hub v4.0.0 • Bản quyền © Thế Vị (@TeeVee98) • Chuẩn Clean POM & Kiểm Thử Tự Chủ",
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
1354
|
translations_en = {
|
|
@@ -1426,7 +1426,7 @@ def _build_target_translations(
|
|
|
1426
1426
|
"th_step_status": "Status",
|
|
1427
1427
|
"th_step_details": "Technical Details (OTel & AST)",
|
|
1428
1428
|
|
|
1429
|
-
"footer_text": "Generated automatically by Synapse-Hub
|
|
1429
|
+
"footer_text": "Generated automatically by Synapse-Hub v4.0.0 • Copyright © Thế Vị (@TeeVee98) • Clean POM & Autonomous Testing",
|
|
1430
1430
|
}
|
|
1431
1431
|
|
|
1432
1432
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
|
@@ -1915,7 +1915,7 @@ def _build_hub_translations(
|
|
|
1915
1915
|
"""Builds bilingual dictionaries for Hub Dashboard."""
|
|
1916
1916
|
translations_vi = {
|
|
1917
1917
|
"header_title": "Bảng Điều Hành Chất Lượng Doanh Nghiệp",
|
|
1918
|
-
"header_subtitle": "Synapse-Hub
|
|
1918
|
+
"header_subtitle": "Synapse-Hub v4.0.0 • Hệ Sinh Thái Kiểm Thử AI Agent Tự Chủ",
|
|
1919
1919
|
"nav_welcome": "Giới Thiệu",
|
|
1920
1920
|
"meta_mode": "🏷️ Chế độ: <strong>HỆ SINH THÁI QA HUB</strong>",
|
|
1921
1921
|
"meta_gen": f"🕒 Khởi tạo: <strong>{now_str}</strong>",
|
|
@@ -1985,12 +1985,12 @@ def _build_hub_translations(
|
|
|
1985
1985
|
"th_sk_ver": "Phiên Bản",
|
|
1986
1986
|
"th_sk_cap": "Khả Năng Nghiệp Vụ Cốt Lõi",
|
|
1987
1987
|
|
|
1988
|
-
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub
|
|
1988
|
+
"footer_text": "Bảng Điều Hành Chất Lượng Doanh Nghiệp • Synapse-Hub v4.0.0 • Bản quyền © Thế Vị (@TeeVee98) • Hệ Thống Kiểm Thử AI Agent Tự Chủ",
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
1991
|
translations_en = {
|
|
1992
1992
|
"header_title": "Enterprise QA Executive Dashboard",
|
|
1993
|
-
"header_subtitle": "Synapse-Hub
|
|
1993
|
+
"header_subtitle": "Synapse-Hub v4.0.0 • Autonomous AI Agent Testing Ecosystem",
|
|
1994
1994
|
"nav_welcome": "Welcome",
|
|
1995
1995
|
"meta_mode": "🏷️ Mode: <strong>QA HUB ECOSYSTEM</strong>",
|
|
1996
1996
|
"meta_gen": f"🕒 Generated: <strong>{now_str}</strong>",
|
|
@@ -2060,7 +2060,7 @@ def _build_hub_translations(
|
|
|
2060
2060
|
"th_sk_ver": "Version",
|
|
2061
2061
|
"th_sk_cap": "Core Capabilities",
|
|
2062
2062
|
|
|
2063
|
-
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub
|
|
2063
|
+
"footer_text": "Enterprise QA Executive Dashboard • Synapse-Hub v4.0.0 • Copyright © Thế Vị (@TeeVee98) • Autonomous AI Agent Testing Ecosystem",
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
2066
|
_inject_gate_translations(translations_vi, translations_en, gates)
|
package/tools/db_sandbox.py
CHANGED
|
@@ -345,15 +345,32 @@ class DBSandbox:
|
|
|
345
345
|
"zero_pollution_verified": count_after_rollback == 0
|
|
346
346
|
}
|
|
347
347
|
except Exception as e:
|
|
348
|
+
rollback_err_msg = None
|
|
349
|
+
count_after_rollback = None
|
|
348
350
|
try:
|
|
349
351
|
cursor.execute(f"ROLLBACK TO SAVEPOINT {safe_sp};")
|
|
350
|
-
|
|
352
|
+
if target_table:
|
|
353
|
+
safe_tbl = target_table.replace('"', '""')
|
|
354
|
+
cursor.execute(f'SELECT COUNT(*) FROM "{safe_tbl}"')
|
|
355
|
+
count_after_rollback = cursor.fetchone()[0]
|
|
356
|
+
except Exception as rollback_err:
|
|
357
|
+
rollback_err_msg = str(rollback_err)
|
|
351
358
|
sys.stderr.write(f"Notice: Savepoint rollback notice: {rollback_err}\n")
|
|
352
|
-
|
|
359
|
+
|
|
360
|
+
zero_verified = (rollback_err_msg is None)
|
|
361
|
+
if count_after_rollback is not None and count_after_rollback > 0:
|
|
362
|
+
zero_verified = False
|
|
363
|
+
|
|
364
|
+
res = {
|
|
353
365
|
"status": "ERROR",
|
|
354
366
|
"error": str(e),
|
|
355
|
-
"zero_pollution_verified":
|
|
367
|
+
"zero_pollution_verified": zero_verified
|
|
356
368
|
}
|
|
369
|
+
if rollback_err_msg:
|
|
370
|
+
res["rollback_error"] = rollback_err_msg
|
|
371
|
+
if count_after_rollback is not None:
|
|
372
|
+
res["count_after_rollback"] = count_after_rollback
|
|
373
|
+
return res
|
|
357
374
|
finally:
|
|
358
375
|
conn.close()
|
|
359
376
|
|
|
@@ -368,7 +385,7 @@ class DBSandbox:
|
|
|
368
385
|
def audit_and_purge_pollution(
|
|
369
386
|
self,
|
|
370
387
|
known_test_prefixes: Tuple[str, ...] = ("AUTO_", "TEST_", "TEMP_"),
|
|
371
|
-
dry_run: bool =
|
|
388
|
+
dry_run: bool = True
|
|
372
389
|
) -> Dict[str, Any]:
|
|
373
390
|
"""
|
|
374
391
|
Scans all tables for orphan records carrying test prefixes and purges them.
|
|
@@ -558,10 +575,12 @@ def main():
|
|
|
558
575
|
snap_p.add_argument("--json", action="store_true", help="Output JSON format")
|
|
559
576
|
|
|
560
577
|
# Command: restore
|
|
561
|
-
rest_p = subparsers.add_parser("restore", help="Restore pristine snapshot")
|
|
578
|
+
rest_p = subparsers.add_parser("restore", help="Restore pristine snapshot (DESTRUCTIVE)")
|
|
562
579
|
rest_p.add_argument("--db-path", default="", help="Path to database file or network URI")
|
|
563
580
|
rest_p.add_argument("--db-type", default="", help="Database engine type (sqlite, postgres, mysql, oracle)")
|
|
564
581
|
rest_p.add_argument("--id", default="pristine_baseline", help="Snapshot identifier")
|
|
582
|
+
rest_p.add_argument("--confirm", action="store_true", default=False,
|
|
583
|
+
help="Explicit confirmation for destructive restore operation")
|
|
565
584
|
rest_p.add_argument("--json", action="store_true", help="Output JSON format")
|
|
566
585
|
|
|
567
586
|
# Command: rollback-test
|
|
@@ -572,10 +591,13 @@ def main():
|
|
|
572
591
|
roll_p.add_argument("--json", action="store_true", help="Output JSON format")
|
|
573
592
|
|
|
574
593
|
# Command: audit
|
|
575
|
-
aud_p = subparsers.add_parser("audit", help="Audit orphan test junk and purge")
|
|
594
|
+
aud_p = subparsers.add_parser("audit", help="Audit orphan test junk and purge (Safe dry-run by default)")
|
|
576
595
|
aud_p.add_argument("--db-path", default="", help="Path to database file")
|
|
577
596
|
aud_p.add_argument("--db-type", default="", help="Database engine type (sqlite, postgres, mysql)")
|
|
578
|
-
aud_p.add_argument("--dry-run", action="store_true",
|
|
597
|
+
aud_p.add_argument("--dry-run", action="store_true", default=None,
|
|
598
|
+
help="Preview test records to purge without deleting (default: True)")
|
|
599
|
+
aud_p.add_argument("--apply", "--force", dest="apply", action="store_true", default=False,
|
|
600
|
+
help="Explicitly apply destructive purge to delete matching test records")
|
|
579
601
|
aud_p.add_argument("--json", action="store_true", help="Output JSON format")
|
|
580
602
|
|
|
581
603
|
# Command: wait-ready (Testcontainers-style readiness gate)
|
|
@@ -625,6 +647,24 @@ def main():
|
|
|
625
647
|
return 0 if res.get("status") != "ERROR" else 1
|
|
626
648
|
|
|
627
649
|
elif args.command == "restore":
|
|
650
|
+
if not args.confirm and not os.environ.get("SYNAPSE_FORCE_RESTORE"):
|
|
651
|
+
err_msg = (
|
|
652
|
+
"Refusing to execute destructive database restore without explicit confirmation. "
|
|
653
|
+
"Pass --confirm (or set SYNAPSE_FORCE_RESTORE=1) if target is an isolated sandbox."
|
|
654
|
+
)
|
|
655
|
+
res = {
|
|
656
|
+
"status": "ERROR",
|
|
657
|
+
"message": err_msg,
|
|
658
|
+
"snapshot_id": args.id,
|
|
659
|
+
"target_db": sandbox.db_path,
|
|
660
|
+
"zero_pollution_guaranteed": False
|
|
661
|
+
}
|
|
662
|
+
if args.json:
|
|
663
|
+
print(json.dumps(res, indent=2))
|
|
664
|
+
else:
|
|
665
|
+
print(f"❌ [DB RESTORE BLOCKED] ID: {args.id}")
|
|
666
|
+
print(f" Error: {err_msg}")
|
|
667
|
+
return 1
|
|
628
668
|
res = sandbox.restore_snapshot(args.id)
|
|
629
669
|
if args.json:
|
|
630
670
|
print(json.dumps(res, indent=2))
|
|
@@ -654,15 +694,18 @@ def main():
|
|
|
654
694
|
return 0
|
|
655
695
|
|
|
656
696
|
elif args.command == "audit":
|
|
657
|
-
|
|
697
|
+
effective_dry_run = True if args.dry_run is None else args.dry_run
|
|
698
|
+
if args.apply:
|
|
699
|
+
effective_dry_run = False
|
|
700
|
+
res = sandbox.audit_and_purge_pollution(dry_run=effective_dry_run)
|
|
658
701
|
if args.json:
|
|
659
702
|
print(json.dumps(res, indent=2))
|
|
660
703
|
else:
|
|
661
|
-
action_label = "Previewed" if
|
|
704
|
+
action_label = "Previewed" if effective_dry_run else "Purged"
|
|
662
705
|
print(f"🧹 [TAINT POLLUTION AUDIT] {action_label} {res['total_purged_rows']} orphan test records.")
|
|
663
706
|
for detail in res.get("purge_details", []):
|
|
664
707
|
print(f" - {detail}")
|
|
665
|
-
if not
|
|
708
|
+
if not effective_dry_run:
|
|
666
709
|
print(" ✅ Zero Pollution Achieved.")
|
|
667
710
|
return 0
|
|
668
711
|
|
|
@@ -276,14 +276,16 @@ def main():
|
|
|
276
276
|
# Stage updated repo_map files
|
|
277
277
|
run_cmd(["git", "add", "tools/repo_map.txt", "tools/repo_map.json"], timeout=30.0)
|
|
278
278
|
|
|
279
|
-
# 6.
|
|
280
|
-
|
|
279
|
+
# 6. Test scripts change -> Static Defect Linter (Zero-Sleep & Smart Wait Sentinel - Boost B6)
|
|
280
|
+
test_prefixes = ("Scripts/", "tests/", "test/", "e2e/", "specs/", "cypress/")
|
|
281
|
+
test_exts = (".groovy", ".py", ".ts", ".js")
|
|
282
|
+
scripts_affected = any(f.startswith(test_prefixes) and f.endswith(test_exts) for f in staged_files)
|
|
281
283
|
if scripts_affected:
|
|
282
284
|
infer_script = os.path.join(os.path.dirname(__file__), "infer_linter.py")
|
|
283
285
|
if os.path.exists(infer_script):
|
|
284
|
-
res = run_cmd([sys.executable, infer_script], timeout=60.0)
|
|
286
|
+
res = run_cmd([sys.executable, infer_script, "--strict"], timeout=60.0)
|
|
285
287
|
if res.returncode != 0:
|
|
286
|
-
print("❌ [PRE-COMMIT BLOCKED] Static Defect Sentinel detected critical issues in staged scripts:")
|
|
288
|
+
print("❌ [PRE-COMMIT BLOCKED] Static Defect Sentinel detected critical issues in staged scripts (Zero-Sleep / Fake Pass):")
|
|
287
289
|
print(res.stdout.strip())
|
|
288
290
|
errors_found = True
|
|
289
291
|
|
package/tools/infer_linter.py
CHANGED
|
@@ -161,9 +161,9 @@ MS_DELAY_PATTERN = re.compile(
|
|
|
161
161
|
r'(?:Thread\.sleep|(?:page\.)?waitForTimeout|(?:page\.)?wait_for_timeout|cy\.wait)\s*\(\s*([^)]+)\s*\)'
|
|
162
162
|
)
|
|
163
163
|
|
|
164
|
-
# Second-based delays: WebUI.delay(sec), time.sleep(sec)
|
|
164
|
+
# Second-based delays: WebUI.delay(sec), time.sleep(sec), asyncio.sleep(sec)
|
|
165
165
|
SEC_DELAY_PATTERN = re.compile(
|
|
166
|
-
r'(?:WebUI\.delay|time\.sleep)\s*\(\s*([^)]+)\s*\)'
|
|
166
|
+
r'(?:WebUI\.delay|time\.sleep|asyncio\.sleep)\s*\(\s*([^)]+)\s*\)'
|
|
167
167
|
)
|
|
168
168
|
|
|
169
169
|
# Backward-compatibility alias
|
package/tools/lint_ai_docs.py
CHANGED
|
@@ -152,10 +152,16 @@ def lint_docs(repo_root):
|
|
|
152
152
|
with open(manifest_path, "r", encoding="utf-8") as mf:
|
|
153
153
|
manifest_data = json.load(mf)
|
|
154
154
|
manifest_skill_ids = set(s.get("id") for s in manifest_data.get("skills", []))
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
# v4.0: skills are 2 levels deep (domain/skill-id/SKILL.md)
|
|
156
|
+
actual_skill_dirs = set()
|
|
157
|
+
for domain_entry in os.listdir(skills_dir):
|
|
158
|
+
domain_path = os.path.join(skills_dir, domain_entry)
|
|
159
|
+
if not os.path.isdir(domain_path):
|
|
160
|
+
continue
|
|
161
|
+
for skill_entry in os.listdir(domain_path):
|
|
162
|
+
skill_path = os.path.join(domain_path, skill_entry)
|
|
163
|
+
if os.path.isdir(skill_path):
|
|
164
|
+
actual_skill_dirs.add(skill_entry)
|
|
159
165
|
unregistered = actual_skill_dirs - manifest_skill_ids
|
|
160
166
|
if unregistered:
|
|
161
167
|
errors.append(f"[skills_manifest.json] Skills on disk not in manifest: {sorted(unregistered)}")
|
|
@@ -310,7 +316,15 @@ def check_doc_metrics_consistency(repo_root):
|
|
|
310
316
|
if not os.path.isdir(skills_dir) or not os.path.isdir(tools_dir):
|
|
311
317
|
return errors
|
|
312
318
|
|
|
313
|
-
|
|
319
|
+
# v4.0: skills are 2 levels deep (domain/skill-id/SKILL.md)
|
|
320
|
+
skills_count = sum(
|
|
321
|
+
1
|
|
322
|
+
for domain_entry in os.listdir(skills_dir)
|
|
323
|
+
if os.path.isdir(os.path.join(skills_dir, domain_entry))
|
|
324
|
+
for skill_entry in os.listdir(os.path.join(skills_dir, domain_entry))
|
|
325
|
+
if os.path.isdir(os.path.join(skills_dir, domain_entry, skill_entry))
|
|
326
|
+
and os.path.exists(os.path.join(skills_dir, domain_entry, skill_entry, "SKILL.md"))
|
|
327
|
+
)
|
|
314
328
|
tools_count = len([f for f in os.listdir(tools_dir) if f.endswith(".py") and f != "__init__.py"])
|
|
315
329
|
|
|
316
330
|
obsolete_patterns = [
|
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 = "
|
|
63
|
+
SERVER_VERSION = "4.0.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
|
|
@@ -52,7 +52,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
52
52
|
except Exception:
|
|
53
53
|
pass
|
|
54
54
|
|
|
55
|
-
SERVER_VERSION = "
|
|
55
|
+
SERVER_VERSION = "4.0.0"
|
|
56
56
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
57
57
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
58
58
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|
package/tools/mcp_server.py
CHANGED
package/tools/package_release.py
CHANGED
|
@@ -24,6 +24,7 @@ Usage:
|
|
|
24
24
|
|
|
25
25
|
import os
|
|
26
26
|
import sys
|
|
27
|
+
import re
|
|
27
28
|
import json
|
|
28
29
|
import zipfile
|
|
29
30
|
import tarfile
|
|
@@ -136,6 +137,16 @@ def collect_package_files(repo_root: str) -> List[Tuple[str, str]]:
|
|
|
136
137
|
continue
|
|
137
138
|
|
|
138
139
|
full_path = os.path.join(root, f)
|
|
140
|
+
# Symlink escape guard: verify file does not resolve outside repository root
|
|
141
|
+
real_file = os.path.realpath(full_path)
|
|
142
|
+
real_root_dir = os.path.realpath(repo_root)
|
|
143
|
+
try:
|
|
144
|
+
if os.path.commonpath([real_file, real_root_dir]) != real_root_dir:
|
|
145
|
+
sys.stderr.write(f"Warning: Skipping symlink escaping repo root: {full_path} -> {real_file}\n")
|
|
146
|
+
continue
|
|
147
|
+
except (ValueError, OSError):
|
|
148
|
+
continue
|
|
149
|
+
|
|
139
150
|
rel_path = os.path.relpath(full_path, repo_root).replace("\\", "/")
|
|
140
151
|
packaged_files.append((full_path, rel_path))
|
|
141
152
|
|
|
@@ -217,20 +228,33 @@ def package_synapse_hub(
|
|
|
217
228
|
out_dir = os.path.join(repo_root, output_dir)
|
|
218
229
|
os.makedirs(out_dir, exist_ok=True)
|
|
219
230
|
|
|
220
|
-
# 1. Clean up old archives
|
|
231
|
+
# 1. Clean up old release archives safely (guarded against repo root wildcard deletion)
|
|
232
|
+
is_same_as_root = False
|
|
233
|
+
try:
|
|
234
|
+
is_same_as_root = os.path.samefile(out_dir, repo_root)
|
|
235
|
+
except (FileNotFoundError, OSError, ValueError):
|
|
236
|
+
is_same_as_root = os.path.realpath(out_dir).lower() == os.path.realpath(repo_root).lower()
|
|
237
|
+
|
|
221
238
|
for f in os.listdir(out_dir):
|
|
222
|
-
if f.endswith((".zip", ".tar.gz", ".sha256")):
|
|
239
|
+
if re.match(r"^synapse-hub-v\d+\.\d+\.\d+.*", f, re.IGNORECASE) and f.endswith((".zip", ".tar.gz", ".sha256")):
|
|
223
240
|
try:
|
|
224
241
|
os.remove(os.path.join(out_dir, f))
|
|
225
242
|
except OSError as err:
|
|
226
243
|
_ = err
|
|
227
|
-
|
|
228
|
-
if f.lower().startswith("synapse-hub") and f.endswith(".zip"):
|
|
244
|
+
elif not is_same_as_root and f.endswith((".zip", ".tar.gz", ".sha256")) and f.lower().startswith("synapse-hub"):
|
|
229
245
|
try:
|
|
230
|
-
os.remove(os.path.join(
|
|
246
|
+
os.remove(os.path.join(out_dir, f))
|
|
231
247
|
except OSError as err:
|
|
232
248
|
_ = err
|
|
233
249
|
|
|
250
|
+
if not is_same_as_root:
|
|
251
|
+
for f in os.listdir(repo_root):
|
|
252
|
+
if re.match(r"^synapse-hub-v\d+\.\d+\.\d+.*", f, re.IGNORECASE) and f.endswith((".zip", ".tar.gz", ".sha256")):
|
|
253
|
+
try:
|
|
254
|
+
os.remove(os.path.join(repo_root, f))
|
|
255
|
+
except OSError as err:
|
|
256
|
+
_ = err
|
|
257
|
+
|
|
234
258
|
files = collect_package_files(repo_root)
|
|
235
259
|
base_name = f"synapse-hub-v{version}"
|
|
236
260
|
created_archives: List[str] = []
|
|
@@ -15,6 +15,15 @@ import glob
|
|
|
15
15
|
import xml.etree.ElementTree as ET
|
|
16
16
|
import re
|
|
17
17
|
|
|
18
|
+
try:
|
|
19
|
+
from cache_resolver import compute_error_fingerprint
|
|
20
|
+
except ImportError:
|
|
21
|
+
try:
|
|
22
|
+
from tools.cache_resolver import compute_error_fingerprint
|
|
23
|
+
except ImportError:
|
|
24
|
+
def compute_error_fingerprint(t, m, a=""):
|
|
25
|
+
return f"fp_fallback_{hash((t, m, a)) & 0xffffffff:08x}"
|
|
26
|
+
|
|
18
27
|
if hasattr(sys.stdout, 'reconfigure'):
|
|
19
28
|
try:
|
|
20
29
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
@@ -144,13 +153,16 @@ def parse_failures(xml_path):
|
|
|
144
153
|
except (ValueError, TypeError):
|
|
145
154
|
formatted_time = "0.0s"
|
|
146
155
|
|
|
156
|
+
tc_short = tc_name.split("/")[-1]
|
|
157
|
+
fp = compute_error_fingerprint(tc_short, reason.split("\n")[0], f"{f_file}:{f_line}")
|
|
147
158
|
failures.append({
|
|
148
|
-
"tc":
|
|
159
|
+
"tc": tc_short,
|
|
149
160
|
"time": formatted_time,
|
|
150
161
|
"reason": reason.split("\n")[0][:180],
|
|
151
162
|
"failed_at": failed_locs[:2] if failed_locs else ["See JUnit report"],
|
|
152
163
|
"file": f_file,
|
|
153
|
-
"line": f_line
|
|
164
|
+
"line": f_line,
|
|
165
|
+
"fingerprint": fp,
|
|
154
166
|
})
|
|
155
167
|
|
|
156
168
|
return failures
|
|
@@ -49,6 +49,14 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
49
49
|
QA_HUB_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
def _split_cmd(cmd_str: str) -> List[str]:
|
|
53
|
+
"""Splits a command string into argument tokens cross-platform without losing backslashes or quoting."""
|
|
54
|
+
if sys.platform == "win32":
|
|
55
|
+
tokens = shlex.split(cmd_str, posix=False)
|
|
56
|
+
return [t.strip('"') for t in tokens]
|
|
57
|
+
return shlex.split(cmd_str)
|
|
58
|
+
|
|
59
|
+
|
|
52
60
|
def _resolve_wal_path() -> str:
|
|
53
61
|
cwd = os.path.abspath(os.getcwd())
|
|
54
62
|
try:
|
|
@@ -78,6 +86,7 @@ class ExecutionSandbox:
|
|
|
78
86
|
|
|
79
87
|
def __init__(self, auto_rollback_on_exit: bool = True, wal_path: Optional[str] = None):
|
|
80
88
|
self.undo_stack: List[ReversibleAction] = []
|
|
89
|
+
self.failed_actions: List[ReversibleAction] = []
|
|
81
90
|
self.auto_rollback_on_exit = auto_rollback_on_exit
|
|
82
91
|
self.wal_path = wal_path if wal_path is not None else _resolve_wal_path()
|
|
83
92
|
if self.wal_path:
|
|
@@ -97,6 +106,7 @@ class ExecutionSandbox:
|
|
|
97
106
|
"target_resource": action.target_resource,
|
|
98
107
|
"undo_command": action.undo_command,
|
|
99
108
|
"metadata": action.metadata,
|
|
109
|
+
"status": "PENDING",
|
|
100
110
|
"timestamp": time.time()
|
|
101
111
|
}
|
|
102
112
|
line = json.dumps(entry, ensure_ascii=False) + "\n"
|
|
@@ -115,7 +125,7 @@ class ExecutionSandbox:
|
|
|
115
125
|
sys.stderr.write(f"Warning: Failed to write undo WAL journal: {e}\n")
|
|
116
126
|
|
|
117
127
|
def _clear_wal(self):
|
|
118
|
-
"""Clears or resets WAL journal when stack has been completely unwound."""
|
|
128
|
+
"""Clears or resets WAL journal when stack has been completely unwound without errors."""
|
|
119
129
|
if not self.wal_path or not os.path.exists(self.wal_path):
|
|
120
130
|
return
|
|
121
131
|
try:
|
|
@@ -130,6 +140,51 @@ class ExecutionSandbox:
|
|
|
130
140
|
except Exception as clear_err:
|
|
131
141
|
sys.stderr.write(f"Notice: Failed to clear WAL: {clear_err}\n")
|
|
132
142
|
|
|
143
|
+
def _update_wal_journal(
|
|
144
|
+
self,
|
|
145
|
+
pending_actions: List[ReversibleAction],
|
|
146
|
+
failed_entries: Optional[List[Dict[str, Any]]] = None
|
|
147
|
+
):
|
|
148
|
+
"""
|
|
149
|
+
Synchronously updates WAL journal with pending and failed actions (Incremental 2PC).
|
|
150
|
+
Clears the journal only when 100% of actions are resolved without failure.
|
|
151
|
+
"""
|
|
152
|
+
if not self.wal_path:
|
|
153
|
+
return
|
|
154
|
+
failed_list = failed_entries or []
|
|
155
|
+
if not pending_actions and not failed_list:
|
|
156
|
+
self._clear_wal()
|
|
157
|
+
return
|
|
158
|
+
|
|
159
|
+
lines = []
|
|
160
|
+
for entry in failed_list:
|
|
161
|
+
lines.append(json.dumps(entry, ensure_ascii=False) + "\n")
|
|
162
|
+
for action in pending_actions:
|
|
163
|
+
entry = {
|
|
164
|
+
"action_type": action.action_type,
|
|
165
|
+
"target_resource": action.target_resource,
|
|
166
|
+
"undo_command": action.undo_command,
|
|
167
|
+
"metadata": action.metadata,
|
|
168
|
+
"status": "PENDING",
|
|
169
|
+
"timestamp": time.time()
|
|
170
|
+
}
|
|
171
|
+
lines.append(json.dumps(entry, ensure_ascii=False) + "\n")
|
|
172
|
+
|
|
173
|
+
content = "".join(lines)
|
|
174
|
+
try:
|
|
175
|
+
try:
|
|
176
|
+
from tools.core.file_lock import file_lock
|
|
177
|
+
with file_lock(self.wal_path + ".lock", timeout=5.0):
|
|
178
|
+
with open(self.wal_path, "w", encoding="utf-8") as f:
|
|
179
|
+
f.write(content)
|
|
180
|
+
f.flush()
|
|
181
|
+
except ImportError:
|
|
182
|
+
with open(self.wal_path, "w", encoding="utf-8") as f:
|
|
183
|
+
f.write(content)
|
|
184
|
+
f.flush()
|
|
185
|
+
except Exception as e:
|
|
186
|
+
sys.stderr.write(f"Warning: Failed to update WAL journal: {e}\n")
|
|
187
|
+
|
|
133
188
|
def record_mutation(
|
|
134
189
|
self,
|
|
135
190
|
action_type: str,
|
|
@@ -156,7 +211,7 @@ class ExecutionSandbox:
|
|
|
156
211
|
) -> bool:
|
|
157
212
|
"""Executes a forward shell command and immediately records its reversible undo counterpart."""
|
|
158
213
|
try:
|
|
159
|
-
args =
|
|
214
|
+
args = _split_cmd(forward_cmd) if isinstance(forward_cmd, str) else forward_cmd
|
|
160
215
|
res = subprocess.run(args, text=True, capture_output=True, timeout=60.0)
|
|
161
216
|
if res.returncode == 0:
|
|
162
217
|
self.record_mutation(action_type, target_resource, undo_cmd, {"forward_cmd": forward_cmd})
|
|
@@ -166,10 +221,12 @@ class ExecutionSandbox:
|
|
|
166
221
|
return False
|
|
167
222
|
|
|
168
223
|
def rollback_all(self, silent: bool = False) -> List[Dict[str, Any]]:
|
|
169
|
-
"""Unwinds the undo stack in strictly reverse (LIFO) order and
|
|
224
|
+
"""Unwinds the undo stack in strictly reverse (LIFO) order and preserves failed entries in WAL."""
|
|
170
225
|
results = []
|
|
226
|
+
failed_entries: List[Dict[str, Any]] = []
|
|
227
|
+
|
|
171
228
|
while self.undo_stack:
|
|
172
|
-
action = self.undo_stack
|
|
229
|
+
action = self.undo_stack[-1]
|
|
173
230
|
success = True
|
|
174
231
|
err_msg = ""
|
|
175
232
|
cmd = action.undo_command.strip()
|
|
@@ -191,13 +248,15 @@ class ExecutionSandbox:
|
|
|
191
248
|
except Exception as e:
|
|
192
249
|
success = False
|
|
193
250
|
err_msg = str(e)
|
|
251
|
+
elif cmd in ("NOOP", ":"):
|
|
252
|
+
success = True
|
|
194
253
|
elif cmd:
|
|
195
254
|
try:
|
|
196
|
-
args =
|
|
255
|
+
args = _split_cmd(cmd) if isinstance(cmd, str) else cmd
|
|
197
256
|
res = subprocess.run(args, text=True, capture_output=True, timeout=60.0)
|
|
198
257
|
success = (res.returncode == 0)
|
|
199
258
|
if not success:
|
|
200
|
-
err_msg = res.stderr.strip()
|
|
259
|
+
err_msg = res.stderr.strip() or f"Command exited with code {res.returncode}"
|
|
201
260
|
except Exception as e:
|
|
202
261
|
success = False
|
|
203
262
|
err_msg = str(e)
|
|
@@ -210,11 +269,30 @@ class ExecutionSandbox:
|
|
|
210
269
|
"error": err_msg
|
|
211
270
|
}
|
|
212
271
|
results.append(result_entry)
|
|
272
|
+
|
|
273
|
+
self.undo_stack.pop()
|
|
274
|
+
|
|
275
|
+
if success:
|
|
276
|
+
self._update_wal_journal(self.undo_stack, failed_entries=failed_entries)
|
|
277
|
+
else:
|
|
278
|
+
self.failed_actions.append(action)
|
|
279
|
+
failed_entry = {
|
|
280
|
+
"action_type": action.action_type,
|
|
281
|
+
"target_resource": action.target_resource,
|
|
282
|
+
"undo_command": action.undo_command,
|
|
283
|
+
"metadata": action.metadata,
|
|
284
|
+
"status": "FAILED",
|
|
285
|
+
"error": err_msg,
|
|
286
|
+
"timestamp": time.time()
|
|
287
|
+
}
|
|
288
|
+
failed_entries.append(failed_entry)
|
|
289
|
+
self._update_wal_journal(self.undo_stack, failed_entries=failed_entries)
|
|
290
|
+
|
|
213
291
|
if not silent:
|
|
214
292
|
status_icon = "✅" if success else "⚠️"
|
|
215
293
|
print(f" {status_icon} [ROLLBACK] {action.action_type} on '{action.target_resource}': {action.undo_command}")
|
|
216
294
|
|
|
217
|
-
if not self.undo_stack:
|
|
295
|
+
if not self.undo_stack and not self.failed_actions and not failed_entries:
|
|
218
296
|
self._clear_wal()
|
|
219
297
|
|
|
220
298
|
return results
|