Complete name-first 1C adapter saved-state support
This commit is contained in:
@@ -87,6 +87,7 @@ def contract_checks(issues: list[dict[str, Any]], *, onec_request_present: bool)
|
||||
for issue in issues
|
||||
),
|
||||
"mcp_tool_selector_guidance": not any(issue["code"] in {"mcp_tool_selector_guidance_missing", "mcp_examples_public_ref_placeholder_missing"} for issue in issues),
|
||||
"mcp_saved_state_examples_name_first": not any(issue["code"].startswith("mcp_saved_state_example_") for issue in issues),
|
||||
"all_adapter_methods_forward_over_rpc": not any(issue["code"].startswith("mcp_method") or issue["code"] == "mcp_rpc_body_method_mismatch" for issue in issues),
|
||||
"no_unified_shadowing_adapter_methods": not any(issue["code"] == "mcp_unified_shadows_adapter_methods" for issue in issues),
|
||||
"adapter_help_selector_guidance": not any(issue["code"] == "adapter_help_selector_guidance_missing" for issue in issues),
|
||||
@@ -103,6 +104,7 @@ def contract_checks(issues: list[dict[str, Any]], *, onec_request_present: bool)
|
||||
),
|
||||
"adapter_definition_read_selector_public_ref": not any(issue["code"] == "adapter_definition_read_selector_public_ref_missing" for issue in issues),
|
||||
"adapter_module_read_selector_public_ref": not any(issue["code"] == "adapter_module_read_selector_public_ref_missing" for issue in issues),
|
||||
"agent_facing_object_methods_name_first": not any(issue["code"] == "agent_facing_object_method_not_name_first" for issue in issues),
|
||||
"adapter_parse_ordinal_unpacked": not any(issue["code"] == "adapter_parse_ordinal_not_unpacked" for issue in issues),
|
||||
"adapter_contract_version": not any(
|
||||
issue["code"] in {"adapter_contract_version_missing", "mcp_contract_version_mismatch", "adapter_help_contract_version_missing"}
|
||||
@@ -393,6 +395,23 @@ def check_contract() -> dict[str, Any]:
|
||||
"actual": help_result.get("contract_version"),
|
||||
}
|
||||
)
|
||||
agent_facing_object_terms = ("object", "module", "form", "template", "code")
|
||||
for row in adapter_server.METHODS:
|
||||
method = str(row.get("name") or "")
|
||||
description = str(row.get("description") or "")
|
||||
normalized_description = description.casefold()
|
||||
if "agent-facing" not in normalized_description:
|
||||
continue
|
||||
if not any(term in normalized_description for term in agent_facing_object_terms):
|
||||
continue
|
||||
if method not in selector_alias_methods:
|
||||
issues.append(
|
||||
{
|
||||
"code": "agent_facing_object_method_not_name_first",
|
||||
"method": method,
|
||||
"description": description,
|
||||
}
|
||||
)
|
||||
for method in sorted(getattr(adapter_server, "OBJECT_SELECTOR_ALIAS_METHODS", set())):
|
||||
capabilities = (public_methods.get(method) or {}).get("selector_capabilities")
|
||||
if not isinstance(capabilities, dict) or not capabilities.get("accepts_ref") or not capabilities.get("accepts_object_aliases"):
|
||||
@@ -448,6 +467,28 @@ def check_contract() -> dict[str, Any]:
|
||||
examples_json = json.dumps(schema.get("examples") or [], ensure_ascii=False)
|
||||
if "<metadata-kind>.<metadata-object-name>" not in examples_json:
|
||||
issues.append({"code": "mcp_examples_public_ref_placeholder_missing"})
|
||||
examples_by_method = {
|
||||
str(example.get("method") or ""): example.get("payload")
|
||||
for example in schema.get("examples") or []
|
||||
if isinstance(example, dict) and isinstance(example.get("payload"), dict)
|
||||
}
|
||||
saved_state_example_contract = {
|
||||
"metadata.saved_state.prepare": {"required": {"layer", "ref"}, "forbidden": {"target_table", "table", "file_name", "module_ref"}},
|
||||
"metadata.saved_state.diff": {"required": {"ref", "module_ordinal"}, "forbidden": {"target_table", "table", "file_name", "module_ref"}},
|
||||
"metadata.saved_state.status": {"required": {"layer"}, "forbidden": {"target_table", "table"}},
|
||||
"metadata.saved_state.changes.list": {"required": {"layer"}, "forbidden": {"target_table", "table"}},
|
||||
}
|
||||
for method, requirements in saved_state_example_contract.items():
|
||||
example_payload = examples_by_method.get(method)
|
||||
if not isinstance(example_payload, dict):
|
||||
issues.append({"code": "mcp_saved_state_example_missing", "method": method})
|
||||
continue
|
||||
missing = sorted(requirements["required"] - set(example_payload))
|
||||
forbidden = sorted(requirements["forbidden"].intersection(example_payload))
|
||||
if missing:
|
||||
issues.append({"code": "mcp_saved_state_example_public_selector_missing", "method": method, "fields": missing})
|
||||
if forbidden:
|
||||
issues.append({"code": "mcp_saved_state_example_storage_selector_present", "method": method, "fields": forbidden})
|
||||
if schema.get("required") != ["method"]:
|
||||
issues.append({"code": "mcp_onec_request_required_not_generic", "required": schema.get("required")})
|
||||
if "oneOf" in schema:
|
||||
|
||||
Reference in New Issue
Block a user