Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

## Table of Contents

- [What's new (2026-06-19) — Test & Tooling Batch](#whats-new-2026-06-19--test--tooling-batch)
- [What's new (2026-06-19) — Transactional Queue](#whats-new-2026-06-19--transactional-queue)
- [What's new (2026-06-19) — Unattended Reliability](#whats-new-2026-06-19--unattended-reliability)
- [What's new (2026-06-19) — Popup Watchdog](#whats-new-2026-06-19--popup-watchdog)
Expand Down Expand Up @@ -63,6 +64,14 @@

---

## What's new (2026-06-19) — Test & Tooling Batch

Three pure-stdlib quality-of-life tools, full stack (facade, `AC_*`, MCP, Script Builder). Full reference: [`docs/source/Eng/doc/new_features/v11_features_doc.rst`](docs/source/Eng/doc/new_features/v11_features_doc.rst).

- **Synthetic test data** — `generate_rows(schema, count, seed=...)` / `write_dataset` (`AC_generate_data`, `ac_generate_data`): deterministic fake rows (name/email/phone/int/choice/date…) to drive data-driven runs without real PII; no Faker.
- **MCP registry manifest** — `write_server_manifest("server.json", include_tools=True)` (`AC_mcp_manifest`, `ac_mcp_manifest`): publish a registry-valid `server.json` so MCP agents/IDEs can discover this server.
- **Risk-based test selection** — `rank_flows` / `select_flows` (`AC_rank_tests` / `AC_select_tests`): rank flows by recent failures, flakiness, staleness and never-run from run history; run the riskiest first or only the top-k.

## What's new (2026-06-19) — Transactional Queue

Turn AutoControl from "run a script" into "run a robot." A SQLite-backed work queue implements the production-RPA dispatcher/performer pattern: enqueue items, process one at a time with per-item status, dedup and retry, so a run of thousands is **resumable after a crash** and parallelizable. Pure stdlib, full stack. Full reference: [`docs/source/Eng/doc/new_features/v10_features_doc.rst`](docs/source/Eng/doc/new_features/v10_features_doc.rst).
Expand Down
9 changes: 9 additions & 0 deletions README/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## 目录

- [本次更新 (2026-06-19) — 测试与工具三件套](#本次更新-2026-06-19--测试与工具三件套)
- [本次更新 (2026-06-19) — 事务式工作队列](#本次更新-2026-06-19--事务式工作队列)
- [本次更新 (2026-06-19) — 无人值守可靠性](#本次更新-2026-06-19--无人值守可靠性)
- [本次更新 (2026-06-19) — 弹窗看门狗](#本次更新-2026-06-19--弹窗看门狗)
Expand Down Expand Up @@ -62,6 +63,14 @@

---

## 本次更新 (2026-06-19) — 测试与工具三件套

三项纯标准库的生产力工具,走完整五层(facade、`AC_*`、MCP、Script Builder)。完整参考:[`docs/source/Zh/doc/new_features/v11_features_doc.rst`](../docs/source/Zh/doc/new_features/v11_features_doc.rst)。

- **合成测试数据** — `generate_rows(schema, count, seed=...)` / `write_dataset`(`AC_generate_data`、`ac_generate_data`):生成可重现的假数据行(name/email/phone/int/choice/date…),驱动数据驱动执行而不需真实 PII;无需 Faker。
- **MCP registry 清单** — `write_server_manifest("server.json", include_tools=True)`(`AC_mcp_manifest`、`ac_mcp_manifest`):生成符合 registry 规范的 `server.json`,让 MCP agent/IDE 能发现此服务器。
- **风险导向测试选择** — `rank_flows` / `select_flows`(`AC_rank_tests` / `AC_select_tests`):依最近失败、不稳定、陈旧与从未跑过,从 run history 排序流程;先跑最高风险或只跑前 k 个。

## 本次更新 (2026-06-19) — 事务式工作队列

把 AutoControl 从「跑脚本」升级成「跑机器人」。以 SQLite 为底的工作队列实作生产级 RPA dispatcher/performer:入列项目、一次处理一项、具每项状态/去重/重试,使上千项执行能**崩溃后续跑**且可并行化。纯标准库、走完整五层。完整参考:[`docs/source/Eng/doc/new_features/v10_features_doc.rst`](../docs/source/Eng/doc/new_features/v10_features_doc.rst)。
Expand Down
9 changes: 9 additions & 0 deletions README/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## 目錄

- [本次更新 (2026-06-19) — 測試與工具三件套](#本次更新-2026-06-19--測試與工具三件套)
- [本次更新 (2026-06-19) — 交易式工作佇列](#本次更新-2026-06-19--交易式工作佇列)
- [本次更新 (2026-06-19) — 無人值守可靠性](#本次更新-2026-06-19--無人值守可靠性)
- [本次更新 (2026-06-19) — 彈窗看門狗](#本次更新-2026-06-19--彈窗看門狗)
Expand Down Expand Up @@ -62,6 +63,14 @@

---

## 本次更新 (2026-06-19) — 測試與工具三件套

三項純標準庫的生產力工具,走完整五層(facade、`AC_*`、MCP、Script Builder)。完整參考:[`docs/source/Zh/doc/new_features/v11_features_doc.rst`](../docs/source/Zh/doc/new_features/v11_features_doc.rst)。

- **合成測試資料** — `generate_rows(schema, count, seed=...)` / `write_dataset`(`AC_generate_data`、`ac_generate_data`):產生可重現的假資料列(name/email/phone/int/choice/date…),驅動資料驅動執行而不需真實 PII;不需 Faker。
- **MCP registry 清單** — `write_server_manifest("server.json", include_tools=True)`(`AC_mcp_manifest`、`ac_mcp_manifest`):產生符合 registry 規範的 `server.json`,讓 MCP agent/IDE 能發現此伺服器。
- **風險導向測試選擇** — `rank_flows` / `select_flows`(`AC_rank_tests` / `AC_select_tests`):依最近失敗、不穩定、陳舊與從未跑過,從 run history 排序流程;先跑最高風險或只跑前 k 個。

## 本次更新 (2026-06-19) — 交易式工作佇列

把 AutoControl 從「跑腳本」升級成「跑機器人」。以 SQLite 為底的工作佇列實作生產級 RPA dispatcher/performer:入列項目、一次處理一項、具每項狀態/去重/重試,使上千項執行能**當機後續跑**且可平行化。純標準庫、走完整五層。完整參考:[`docs/source/Zh/doc/new_features/v10_features_doc.rst`](../docs/source/Zh/doc/new_features/v10_features_doc.rst)。
Expand Down
73 changes: 73 additions & 0 deletions docs/source/Eng/doc/new_features/v11_features_doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
==================================================
New Features (2026-06-19) — Test & Tooling Batch
==================================================

Three quality-of-life tools, all pure standard library and wired through
the full stack (facade, ``AC_*`` executor commands, MCP tools, Script
Builder): seeded synthetic test data, an MCP registry ``server.json``
generator, and risk-based test selection.

.. contents::
:local:
:depth: 2


Synthetic test data
===================

Generate deterministic fake rows from a tiny field schema — to drive
data-driven runs without shipping real PII. No Faker dependency; the same
``seed`` always yields the same rows::

from je_auto_control import generate_rows, write_dataset

rows = generate_rows({
"name": "name",
"email": {"type": "email", "domain": "acme.test"},
"age": {"type": "int", "min": 18, "max": 65},
"status": {"type": "choice", "choices": ["new", "vip"]},
}, count=100, seed=7)

write_dataset(rows, "people.csv") # or .json

Supported field types: ``first_name``, ``last_name``, ``name``,
``username``, ``email``, ``phone``, ``city``, ``company``, ``word``,
``sentence``, ``uuid``, ``bool``, ``int`` (min/max), ``float``
(min/max/ndigits), ``choice`` (choices), ``date`` (start/end).

The ``AC_generate_data`` command writes a file (then feed it to
``AC_load_data``) or returns the rows inline.


MCP registry manifest
====================

Publish a ``server.json`` describing this AutoControl MCP server so
MCP-aware agents and IDEs can discover and install it. The manifest is
built from live package metadata, so it never drifts::

from je_auto_control import write_server_manifest

write_server_manifest("server.json", include_tools=True)

``include_tools`` embeds the live tool list under ``_meta`` (without
touching the registry-valid core fields). Also exposed as
``AC_mcp_manifest`` and the ``ac_mcp_manifest`` MCP tool.


Risk-based test selection
========================

Instead of always running the whole suite, rank flows by how *risky* they
are — recently failing, flaky, stale, or never-run — using the run-history
store, then run the riskiest first (or only the top-k)::

from je_auto_control import select_flows, rank_flows

ranked = rank_flows(["login", "checkout", "report"])
risky = select_flows(["login", "checkout", "report"], k=2)

The score is ``0.5*failure_rate + 0.2*last_failed + 0.2*flakiness +
0.1*staleness``; a never-run flow scores ``0.8`` (untested is risky).
Exposed as ``AC_rank_tests`` / ``AC_select_tests`` and the
``ac_rank_tests`` / ``ac_select_tests`` MCP tools.
1 change: 1 addition & 0 deletions docs/source/Eng/eng_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Comprehensive guides for all AutoControl features.
doc/new_features/v8_features_doc
doc/new_features/v9_features_doc
doc/new_features/v10_features_doc
doc/new_features/v11_features_doc
doc/ocr_backends/ocr_backends_doc
doc/observability/observability_doc
doc/operations_layer/operations_layer_doc
Expand Down
72 changes: 72 additions & 0 deletions docs/source/Zh/doc/new_features/v11_features_doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
============================================
新功能 (2026-06-19) — 測試與工具三件套
============================================

三項提升生產力的工具,皆為純標準庫,並走完整五層(facade、``AC_*``
執行器指令、MCP 工具、Script Builder):有種子的合成測試資料、MCP
registry ``server.json`` 產生器,以及風險導向的測試選擇。

.. contents::
:local:
:depth: 2


合成測試資料
============

依一個極小的欄位 schema 產生**可重現**的假資料列——用來驅動資料驅動的
執行,而不必散布真實 PII。不需要 Faker;相同的 ``seed`` 永遠產生相同的
資料列::

from je_auto_control import generate_rows, write_dataset

rows = generate_rows({
"name": "name",
"email": {"type": "email", "domain": "acme.test"},
"age": {"type": "int", "min": 18, "max": 65},
"status": {"type": "choice", "choices": ["new", "vip"]},
}, count=100, seed=7)

write_dataset(rows, "people.csv") # 或 .json

支援的欄位型別:``first_name``、``last_name``、``name``、``username``、
``email``、``phone``、``city``、``company``、``word``、``sentence``、
``uuid``、``bool``、``int``(min/max)、``float``(min/max/ndigits)、
``choice``(choices)、``date``(start/end)。

``AC_generate_data`` 指令會寫出檔案(再交給 ``AC_load_data``)或直接
回傳資料列。


MCP registry 清單
=================

產生描述此 AutoControl MCP 伺服器的 ``server.json``,讓支援 MCP 的
agent 與 IDE 能發現並安裝它。清單由即時套件中繼資料建構,因此不會與
實際能力脫節::

from je_auto_control import write_server_manifest

write_server_manifest("server.json", include_tools=True)

``include_tools`` 會把即時工具清單嵌入 ``_meta``(不更動 registry 規範
的核心欄位)。同時提供 ``AC_mcp_manifest`` 與 ``ac_mcp_manifest`` MCP
工具。


風險導向測試選擇
================

與其每次都跑整套測試,不如依據流程的**風險**排序——最近失敗、不穩定
(flaky)、太久沒跑、或從未跑過——用 run-history 紀錄計算,然後先跑最
高風險的(或只跑前 k 個)::

from je_auto_control import select_flows, rank_flows

ranked = rank_flows(["login", "checkout", "report"])
risky = select_flows(["login", "checkout", "report"], k=2)

分數為 ``0.5*失敗率 + 0.2*上次失敗 + 0.2*不穩定度 + 0.1*陳舊度``;
從未跑過的流程得 ``0.8``(未測試即高風險)。提供 ``AC_rank_tests`` /
``AC_select_tests`` 以及 ``ac_rank_tests`` / ``ac_select_tests`` MCP
工具。
1 change: 1 addition & 0 deletions docs/source/Zh/zh_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ AutoControl 所有功能的完整使用指南。
doc/new_features/v8_features_doc
doc/new_features/v9_features_doc
doc/new_features/v10_features_doc
doc/new_features/v11_features_doc
doc/ocr_backends/ocr_backends_doc
doc/observability/observability_doc
doc/operations_layer/operations_layer_doc
Expand Down
11 changes: 11 additions & 0 deletions je_auto_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@
from je_auto_control.utils.work_queue import (
BusinessError, WorkItem, WorkQueue,
)
# Seeded synthetic test-data generation
from je_auto_control.utils.test_data import generate_rows, write_dataset
# Risk-based test selection from run history
from je_auto_control.utils.test_select import rank_flows, select_flows
# MCP registry server.json manifest
from je_auto_control.utils.mcp_registry import (
build_server_manifest, write_server_manifest,
)
# Background popup/interrupt watchdog (unattended automation)
from je_auto_control.utils.watchdog import (
PopupWatchdog, WatchdogRule, default_popup_watchdog,
Expand Down Expand Up @@ -514,6 +522,9 @@ def start_autocontrol_gui(*args, **kwargs):
"handle_file_dialog", "FileDialogDriver",
"ensure_interactive_session", "is_session_locked",
"WorkQueue", "WorkItem", "BusinessError",
"generate_rows", "write_dataset",
"rank_flows", "select_flows",
"build_server_manifest", "write_server_manifest",
# MCP server
"AuditLogger", "HttpMCPServer", "MCPContent", "MCPPrompt",
"MCPPromptArgument", "MCPResource", "MCPServer", "MCPTool",
Expand Down
44 changes: 44 additions & 0 deletions je_auto_control/gui/script_builder/command_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,50 @@ def _add_misc_specs(specs: List[CommandSpec]) -> None:
description="Fail if the session is locked / non-interactive.",
))
_add_work_queue_specs(specs)
_add_tooling_specs(specs)


def _add_tooling_specs(specs: List[CommandSpec]) -> None:
specs.append(CommandSpec(
"AC_generate_data", "Data", "Generate Synthetic Data",
fields=(
FieldSpec("count", FieldType.INT, optional=True, default=10),
FieldSpec("path", FieldType.FILE_PATH, optional=True),
FieldSpec("fmt", FieldType.ENUM, choices=("json", "csv"),
optional=True),
FieldSpec("seed", FieldType.INT, optional=True),
),
description="Generate seeded fake rows from a 'schema' (JSON view); "
"writes a file when 'path' is set.",
))
specs.append(CommandSpec(
"AC_mcp_manifest", "Tools", "MCP Registry Manifest",
fields=(
FieldSpec("path", FieldType.FILE_PATH, optional=True,
default="server.json"),
FieldSpec("include_tools", FieldType.BOOL, optional=True,
default=False),
),
description="Write an MCP registry server.json for this server.",
))
specs.append(CommandSpec(
"AC_rank_tests", "Testing", "Rank Tests by Risk",
fields=(
FieldSpec("history_path", FieldType.FILE_PATH, optional=True),
FieldSpec("window", FieldType.INT, optional=True, default=10),
),
description="Score 'flows' (JSON view) by risk from run history.",
))
specs.append(CommandSpec(
"AC_select_tests", "Testing", "Select Risky Tests",
fields=(
FieldSpec("k", FieldType.INT, optional=True),
FieldSpec("threshold", FieldType.FLOAT, optional=True),
FieldSpec("history_path", FieldType.FILE_PATH, optional=True),
FieldSpec("window", FieldType.INT, optional=True, default=10),
),
description="Pick riskiest 'flows' (JSON view): top-k or threshold.",
))


def _add_work_queue_specs(specs: List[CommandSpec]) -> None:
Expand Down
46 changes: 46 additions & 0 deletions je_auto_control/utils/executor/action_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2346,6 +2346,48 @@ def _queue_stats(db: str, name: str = "default") -> Dict[str, int]:
return _queue(db, name).stats()


def _generate_data(schema: Dict[str, Any], count: int = 10,
path: Optional[str] = None, fmt: Optional[str] = None,
seed: Optional[int] = None) -> Dict[str, Any]:
"""Adapter: generate synthetic rows; write to ``path`` when given."""
from je_auto_control.utils.test_data import generate_rows, write_dataset
rows = generate_rows(schema, int(count), seed=seed)
if path:
return {"path": write_dataset(rows, path, fmt), "count": len(rows)}
return {"rows": rows, "count": len(rows)}


def _mcp_manifest(path: Optional[str] = None,
include_tools: bool = False) -> Dict[str, Any]:
"""Adapter: build (or write) the MCP registry server.json manifest."""
from je_auto_control.utils.mcp_registry import (
build_server_manifest, write_server_manifest)
if path:
return {"path": write_server_manifest(
path, include_tools=bool(include_tools))}
return {"manifest": build_server_manifest(
include_tools=bool(include_tools))}


def _rank_tests(flows: List[str], history_path: Optional[str] = None,
window: int = 10) -> Dict[str, Any]:
"""Adapter: score flows by risk (riskiest first)."""
from je_auto_control.utils.test_select import rank_flows
return {"ranked": rank_flows(flows, history_path=history_path,
window=int(window))}


def _select_tests(flows: List[str], k: Optional[int] = None,
threshold: Optional[float] = None,
history_path: Optional[str] = None,
window: int = 10) -> Dict[str, Any]:
"""Adapter: pick the riskiest flows to run (top-k / threshold)."""
from je_auto_control.utils.test_select import select_flows
return {"selected": select_flows(
flows, k=k, threshold=threshold, history_path=history_path,
window=int(window))}


class Executor:
"""
Executor
Expand Down Expand Up @@ -2509,6 +2551,10 @@ def __init__(self):
"AC_queue_complete": _queue_complete,
"AC_queue_fail": _queue_fail,
"AC_queue_stats": _queue_stats,
"AC_generate_data": _generate_data,
"AC_mcp_manifest": _mcp_manifest,
"AC_rank_tests": _rank_tests,
"AC_select_tests": _select_tests,
"AC_a11y_record_start": _a11y_record_start,
"AC_a11y_record_stop": _a11y_record_stop,
"AC_a11y_record_events": _a11y_record_events,
Expand Down
6 changes: 6 additions & 0 deletions je_auto_control/utils/mcp_registry/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""MCP registry server.json manifest generation (discoverability)."""
from je_auto_control.utils.mcp_registry.registry import (
build_server_manifest, write_server_manifest,
)

__all__ = ["build_server_manifest", "write_server_manifest"]
Loading
Loading