feat(face-b): 系统服务族落地(面 B 批次 15,+39 端点)
多语言/表单套件/缓存管理/任务调度/IM 会话/收藏菜单/公式目录/系统监控 + 三处 Actions/Export;新表 8 张(官方 DDL 逐字)⇒ tables 65,BASE_TABLES 62。 影响: - 多语言是「一行一语种 + f_group_id 聚组」,列表 id = groupId;tableHead 的列来自 字典 Language(seed 按官方初始库种子化);PUT 时 map 里没有的语种要删掉。 - CacheManage 落到本仓真实的内存会话表:DELETE 真的把人踢下线、ClearAll 保留操作者 自己、overdueTime 恒 null(会话不过期,不编时间)、绝不把 token 放进响应。 - scheduletask 只登记不执行(本仓无 XXL-JOB):runCount 恒 0、lastRunTime/nextRunTime 恒 null、TaskMethods 返空 list(返错会让新建表单整条红)。 - 三处 Export 与 BaseLang 模板/导入 = 明确业务失败(无文件服务),不返假 url; Kit 那条尤其不能用 data:null(官方前端 res.data.url 会抛 JS 异常)。 - Monitor 真读宿主机指标;macOS 的 CPU 占空比用负载均值近似(契约标 partial)。 顺手修掉 fe-api-inventory.py 的嵌套模板串截断(真因):内层反引号会截断 URL、内层 } 会截断变量替换 ⇒ 产出畸形路径,让 system 永远差 2 条。改成深度配对 + 丢掉「拼查询串 的三元片段」后,system 缺口 41 → 0(196/196)。另把 3 条「官方前端声明但官方后端 从无映射、也无人调用」的死接口记进 [OFFICIAL] 的 oos(带判据,不进分母)。 回归测试 tests/batch15_it.rs 12 条;全量 610 passed / 0 failed;verify.sh 全绿。
This commit is contained in:
1 parent
e961904252
commit
c82a7d1f3d
16 files changed
+5117
-134
No files matched your search
@@ -99,6 +99,16 @@ def extract_url_expr(obj):
|
||||
if obj[j] == "\\":
|
||||
j += 2
|
||||
continue
|
||||
# 🔴 模板串里的 `${...}` 可以再套一层模板
|
||||
# (官方 `` `${Prefix}/getConfig/${id}${encryption ? `?e=${encryption}` : ''}` ``)
|
||||
# ⇒ 那里面出现的反引号**不是**结束符,必须整段跳过;
|
||||
# 否则 URL 会在内层反引号处被截断成 `…/${encryption`,变成永远修不完的假缺口。
|
||||
if quote == "`" and obj.startswith("${", j):
|
||||
end = find_template_end(obj, j)
|
||||
if end < 0:
|
||||
return obj[i:]
|
||||
j = end
|
||||
continue
|
||||
if obj[j] == quote:
|
||||
return obj[i : j + 1]
|
||||
j += 1
|
||||
@@ -120,6 +130,61 @@ def extract_url_expr(obj):
|
||||
return obj[i:j].strip()
|
||||
|
||||
|
||||
RE_TMPL_LITERAL = re.compile(r"'[^']*'|\"[^\"]*\"|`[^`]*`")
|
||||
|
||||
|
||||
def find_template_end(s, i):
|
||||
"""`s[i:]` 以 `${` 开头 ⇒ 返**配对**的 `}` 之后的下标;未闭合返 -1。
|
||||
|
||||
🔴 必须按**嵌套深度**配对,不能用 `\\$\\{[^}]*\\}`:官方前端真的有
|
||||
`` `${Api.Prefix}/Selector/${`${id || '0'}`}` `` 这种套两层模板的写法,
|
||||
`[^}]*` 会停在内层的 `}` 上 ⇒ 截出 `/api/system/Menu/Selector/${` 这种畸形路径,
|
||||
然后在缺口报表里变成一个**永远修不完的假缺口**。
|
||||
"""
|
||||
depth = 0
|
||||
j = i
|
||||
while j < len(s):
|
||||
if s.startswith("${", j):
|
||||
depth += 1
|
||||
j += 2
|
||||
continue
|
||||
if s[j] == "}":
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
return j + 1
|
||||
j += 1
|
||||
return -1
|
||||
|
||||
|
||||
def subst_template_vars(body):
|
||||
"""把剩下的 `${...}` 归一成 `{param}`(深度感知,见 `find_template_end`)。
|
||||
|
||||
🔴 **拼查询串的片段要整段丢掉**,不能变成 `{param}`:官方
|
||||
`` `${Api.Prefix}/${type}${interfaceId ? `?dataInterFaceId=${interfaceId}` : ''}` ``
|
||||
的后半段是往 URL 尾巴上追加 `?dataInterFaceId=…`,它**不是**一个路径段。
|
||||
判据:这一段里的字符串字面量有以 `?` 开头的 ⇒ 查询串追加 ⇒ 丢掉。
|
||||
"""
|
||||
out = []
|
||||
i = 0
|
||||
while i < len(body):
|
||||
if body.startswith("${", i):
|
||||
end = find_template_end(body, i)
|
||||
if end < 0:
|
||||
# 未闭合:原样留着 ⇒ 下游照旧报缺口(宁可多报,不要静默吞掉)
|
||||
out.append(body[i:])
|
||||
break
|
||||
expr = body[i + 2 : end - 1]
|
||||
query_append = any(
|
||||
lit[1:].startswith("?") for lit in RE_TMPL_LITERAL.findall(expr)
|
||||
)
|
||||
out.append("" if query_append else "{param}")
|
||||
i = end
|
||||
continue
|
||||
out.append(body[i])
|
||||
i += 1
|
||||
return "".join(out)
|
||||
|
||||
|
||||
def resolve_path(expr, enums):
|
||||
"""把 url 表达式解析成真实路径模板。"""
|
||||
if not expr:
|
||||
@@ -141,7 +206,7 @@ def resolve_path(expr, enums):
|
||||
body = re.sub(r"\bApi\.%s\b" % re.escape(key), val, body)
|
||||
|
||||
# 3) 剩下的 ${...} 是运行时变量 ⇒ 归一成 {param}
|
||||
body = re.sub(r"\$\{[^}]*\}", "{param}", body)
|
||||
body = subst_template_vars(body)
|
||||
# 4) 去掉查询串残留与重复斜杠
|
||||
body = body.split("?")[0]
|
||||
body = re.sub(r"/{2,}", "/", body)
|
||||
|
||||
Reference in new issue
Block a user