chore: auto release commit (2026-09-27 16:42:38)
All checks were successful
技能自动化发布 / release (push) Successful in 12s

This commit is contained in:
2026-09-27 16:42:39 +08:00
parent 166007b460
commit bf3bb9cd10
10 changed files with 144 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ POLICY_IDS = (
"POLICY-RPA-004",
"POLICY-RPA-005",
"POLICY-RPA-006",
"POLICY-RPA-007",
"POLICY-PACKAGING-001",
"POLICY-PACKAGING-002",
"POLICY-RELEASE-001",
@@ -205,6 +206,26 @@ RPA_006_EXAMPLE_CLIENTS = (
"examples/simulator_browser_rpa/scripts/service/account_client.py",
)
RPA_007_SOURCE = (
"development/RPA.md §1.2.1; development/RPA_BROWSER.md §4; "
"examples/real_browser_rpa; development/POLICY_MATRIX.md"
)
RPA_007_DOC_MARKERS = (
"no_viewport=True",
"viewport=None",
"setWindowBounds",
"POLICY-RPA-007",
)
RPA_007_LAUNCH_MARKERS = RPA_004_LAUNCH_MARKERS
RPA_007_FORBIDDEN_PATTERNS = (
"viewport=None",
"setWindowBounds",
"maximize_browser_window",
)
RPA_007_REAL_BROWSER_SESSION = (
"examples/real_browser_rpa/scripts/service/browser_session.py"
)
LOGGING_001_SOURCE = "development/LOGGING.md; development/RUNTIME.md"
LOGGING_002_SOURCE = "development/LOGGING.md; development/DEVELOPMENT.md"
LOGGING_003_SOURCE = "development/LOGGING.md"
@@ -837,6 +858,84 @@ class TestPolicyRpa005(unittest.TestCase):
)
class TestPolicyRpa007(unittest.TestCase):
def test_rpa_md_documents_viewport_window_standard(self) -> None:
skill_root = get_skill_root()
path = os.path.join(skill_root, "development", "RPA.md")
text = _read_text(path)
missing = [marker for marker in RPA_007_DOC_MARKERS if marker not in text]
self.assertEqual(
missing,
[],
msg=_policy_msg(
"POLICY-RPA-007",
RPA_007_SOURCE,
"RPA.md missing viewport/window markers: " + ", ".join(missing),
),
)
def test_real_browser_example_uses_no_viewport(self) -> None:
skill_root = get_skill_root()
path = os.path.join(skill_root, *RPA_007_REAL_BROWSER_SESSION.split("/"))
text = _read_text(path)
self.assertIn(
"no_viewport=True",
text,
msg=_policy_msg(
"POLICY-RPA-007",
RPA_007_SOURCE,
f"{RPA_007_REAL_BROWSER_SESSION} must use no_viewport=True",
),
)
self.assertNotIn(
"viewport=None",
text,
msg=_policy_msg(
"POLICY-RPA-007",
RPA_007_SOURCE,
f"{RPA_007_REAL_BROWSER_SESSION} must not use viewport=None",
),
)
def test_launch_persistent_forbids_bad_viewport_and_cdp_maximize(self) -> None:
skill_root = get_skill_root()
rel_paths: list[str] = []
for root_name in ("scripts", "examples"):
root = os.path.join(skill_root, root_name)
if not os.path.isdir(root):
continue
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = [d for d in dirnames if d not in SKIP_DIR_NAMES]
rel_dir = os.path.relpath(dirpath, skill_root).replace("\\", "/")
if any(rel_dir == p or rel_dir.startswith(p + "/") for p in SKIP_REL_PREFIXES):
continue
for name in filenames:
if not name.endswith(".py"):
continue
rel = os.path.relpath(os.path.join(dirpath, name), skill_root).replace(
"\\", "/"
)
rel_paths.append(rel)
violations: list[str] = []
for rel in rel_paths:
text = _read_text(os.path.join(skill_root, *rel.split("/")))
if not any(marker in text for marker in RPA_007_LAUNCH_MARKERS):
continue
for pattern in RPA_007_FORBIDDEN_PATTERNS:
if pattern in text:
violations.append(f"{rel}: forbidden {pattern!r}")
self.assertEqual(
violations,
[],
msg=_policy_msg(
"POLICY-RPA-007",
RPA_007_SOURCE,
"launch_persistent files with forbidden viewport/window hacks: "
+ "; ".join(violations),
),
)
class TestPolicyRpa006(unittest.TestCase):
def test_account_manager_lifecycle_doc_has_required_markers(self) -> None:
skill_root = get_skill_root()