feat: bgRFC/FM 支撑能力 + ADT 后缀剥离与 CLAS 激活修复(B1 配套)
CI / test (3.10) (push) Waiting to run
CI / test (3.11) (push) Waiting to run
CI / test (3.12) (push) Waiting to run

新增能力:
- remote-enable 子命令:设置函数模块处理类型为远程启用(bgRFC/RFC 执行体必需)。
  实现要点均按实机验证:PUT fmodule:processingType="rfc"(枚举值仅小写 rfc 有效,
  remoteEnabled/remote/RFC 等均 400);lockHandle 走 query 参数(放 header 报
  ParameterNotFound);PUT 后 GET 复核回显;DDIC 结构参数才可远程启用(类本地类型
  报"针对 RFC 不允许使用类或接口的类型")。
- create --type functiongroup 透传 --package / --corr_nr(此前 package 被静默写成 $TMP,
  导致函数组无法归目标包)。

修复:
- activate 请求体补重复引用:ADT CLAS 激活端点对 objectReferences 只有 1 个引用时
  返回 HTTP 200 + 空 body 且不执行激活;引用数 ≥2 才真正激活(同对象重复亦可)。
- scanner 剥离 ADT 文件后缀(xxx.clas.abap 解析错误)。

守卫测试:
- tests/unit/test_bgrfc_support.py(17 例):函数组 package 透传、processingType 助手、
  remote-enable 命令(含 lockHandle 走 query/小写 rfc/错误透传/复核失配判失败)、
  函数 URI 组装不得用组名冒充模块名。
- test_activate.py 增加激活请求体引用数守卫;test_repo_guards.py 增加后缀剥离守卫。

测试:tests/unit 676 + tests/test_sapcli.py 69 = 745 全绿
(PYTHONPATH=assets python -m unittest discover -s tests/unit -t tests)
This commit is contained in:
吴让宇
2026-09-15 22:51:35 +08:00
parent 04efa7388a
commit c06e350f6d
13 changed files with 697 additions and 4 deletions
+10 -1
View File
@@ -208,10 +208,19 @@ class SourceMixin:
obj_uri: str,
corr_nr: str | None = None,
) -> tuple[bool, list[dict[str, str]]]:
# 实测(本机 SAP_BASIS 7522026-09-15 受控实验):
# objectReferences 里只有 1 个 objectReference 时,服务端返回
# HTTP 200 + 空 body(无 content-type),且根本不执行激活;
# 引用数为 2 及以上才真正激活(同一对象重复 2 次亦可)。
# 故单对象请求补一个重复引用,使请求体始终含 2 个引用。
refs = (
f'<adtcore:objectReference adtcore:uri="{obj_uri}" adtcore:name="{name}"/>'
f'<adtcore:objectReference adtcore:uri="{obj_uri}" adtcore:name="{name}"/>'
)
body = (
'<?xml version="1.0" encoding="UTF-8"?>'
'<adtcore:objectReferences xmlns:adtcore="http://www.sap.com/adt/core">'
f'<adtcore:objectReference adtcore:uri="{obj_uri}" adtcore:name="{name}"/>'
f'{refs}'
"</adtcore:objectReferences>"
)
self._stateful = False