Precipitate host contracts from task-plaza: visibleWhen equalsFrom, replaces gates, url openExternal, feishu data-sources (v1.0.128)
All checks were successful
技能自动化发布 / release (push) Successful in 14s

This commit is contained in:
2026-11-01 16:30:46 +08:00
parent d911bd28cd
commit 90eefc8653
15 changed files with 412 additions and 32 deletions

View File

@@ -564,6 +564,9 @@ class TestActionsManifest(unittest.TestCase):
bind_props = schema["$defs"]["bind"]["properties"]
self.assertIn("visibleWhen", bind_props)
self.assertIn("visibleWhenRule", schema["$defs"])
rule_desc = schema["$defs"]["visibleWhenRule"].get("description") or ""
self.assertIn("equalsFrom", rule_desc)
self.assertIn("notEqualsFrom", rule_desc)
manifest = {
"schemaVersion": 1,
"skill": "your-skill-slug",
@@ -600,6 +603,54 @@ class TestActionsManifest(unittest.TestCase):
}
jsonschema.validate(instance=manifest, schema=schema)
def test_schema_allows_visible_when_equals_from_and_all(self) -> None:
try:
import jsonschema
except ImportError:
self.fail("jsonschema is required")
schema = _load_actions_schema()
manifest = {
"schemaVersion": 1,
"skill": "your-skill-slug",
"actions": [
{
"id": "probe-owner-delete",
"label": "删除",
"description": "验证 equalsFrom 与 all 可通过 Schema",
"replaces": "delete",
"placements": [],
"executionProfile": "sync",
"interaction": "confirm",
"confirmation": {"message": "确认删除?"},
"bind": {
"tables": ["demo_items"],
"visibleWhen": {
"all": [
{
"field": "owner_user_id",
"equalsFrom": "currentUser.userId",
},
{"field": "status", "in": ["open", "draft"]},
]
},
"inputMapping": {"itemId": "$row.$pk"},
},
"inputSchema": {
"type": "object",
"properties": {
"itemId": {"type": "string", "readOnly": True},
},
},
"entrypoint": {
"type": "cli",
"command": "item-delete",
"args": ["--id", "{{itemId}}"],
},
}
],
}
jsonschema.validate(instance=manifest, schema=schema)
def test_action_examples_user_facing_copy_avoids_jargon(self) -> None:
"""示例 Action 的用户可见字符串不得含常见开发黑话(属性名本身除外)。"""
examples_dir = os.path.join(get_skill_root(), "assets", "examples")

View File

@@ -386,6 +386,8 @@ class TestDocsStandards(unittest.TestCase):
"*显示名",
"table_file_import.py",
"导入模板 lookup 单元格",
"url 列表 / 详情外开",
"系统默认浏览器",
):
self.assertIn(marker, text, msg=f"SCHEMA.md missing {marker!r}")
@@ -399,16 +401,31 @@ class TestDocsStandards(unittest.TestCase):
"一个 `sourceId`",
"process-work-order",
"tableAdmin",
"feishu_bitable",
"columns",
"searchable",
"defaultValueFrom",
"optionsWhen",
"displayType",
):
self.assertIn(marker, text, msg=f"DATA_SOURCES.md missing {marker!r}")
self.assertTrue(os.path.isfile(os.path.join(get_skill_root(), "assets/data-sources.example.json")))
self.assertTrue(
os.path.isfile(os.path.join(get_skill_root(), "assets/examples/data-sources.mysql.example.json"))
)
self.assertTrue(
os.path.isfile(
os.path.join(
get_skill_root(),
"assets/examples/data-sources.feishu_bitable.example.json",
)
)
)
env_example = self._read(".env.example")
self.assertIn("MYSQL_DSN", env_example)
checklist = self._read("development/CHECKLIST.md")
self.assertIn("A6-16", checklist)
self.assertIn("A6-17", checklist)
self.assertIn("DATA_SOURCES.md", checklist)
def test_actions_md_documents_form_schema_split(self) -> None:
@@ -519,6 +536,9 @@ class TestDocsStandards(unittest.TestCase):
self.assertIn("A4-10", checklist)
self.assertIn("A4-11", checklist)
self.assertIn("bind.visibleWhen", checklist)
self.assertIn("A4-15", checklist)
self.assertIn("equalsFrom", checklist)
self.assertIn("A6-18", checklist)
self.assertIn("用户可见文案", checklist)
runtime = self._read("development/SKILL_ACTION_RUNTIME.md")
self.assertIn("visibleWhen", runtime)
@@ -532,8 +552,18 @@ class TestDocsStandards(unittest.TestCase):
self.assertIn("双受众", actions)
self.assertIn("行菜单显隐", actions)
self.assertIn("bind.visibleWhen", actions)
self.assertIn("equalsFrom", actions)
self.assertIn("currentUser.userId", actions)
self.assertIn("宿主内置「编辑 / 删除」", actions)
self.assertIn("无表勾选入口", actions)
self.assertIn("编号列表", actions)
self.assertIn(
"replaces-delete-owner-visible.action.example.json",
self._read("assets/examples/README.md"),
)
policy = self._read("references/POLICY.md")
self.assertIn("状态机", policy)
self.assertIn("hostCapabilities", policy)
def test_guarded_docs_do_not_reference_amazon_implementation(self) -> None:
forbidden = (