From d80405ccb3dcf01a38295074d7c206ca59df52b8 Mon Sep 17 00:00:00 2001 From: cnc Date: Fri, 5 Jun 2026 06:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E8=80=83=E6=89=80=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E5=AE=8C=E6=88=90=E5=B0=BD=E9=87=8F=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=EF=BC=9A=E6=94=B6=E7=B4=A7=20switch?= =?UTF-8?q?kins=20source-only=20API=20=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:未扩展 smoke 功能行为,仅把 switchkins/remap source-map guard 的负向 API 检查从 TOOL_TABLE 扩展到 asset、metadata、tooldata 等 source-only 输入。 LinuxCNC 来源依据:configs/sim/**.ini 的 M428/M429/M430 REMAP、remap_subs/{428,429,430}remap.ngc 的 #、src/hal/utils/halcmd_commands.cc do_loadusr_cmd() 与 halcmd_completion.c 的 loadusr 选项模型。 检查通过:./check-linuxcnc-switchkins-remap-source-map.sh;./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt;./check-linuxcnc-kinematics-source-map.sh;./test-native.sh;./test-linuxcnc-source-link.sh。 --- check-linuxcnc-switchkins-remap-source-map.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/check-linuxcnc-switchkins-remap-source-map.sh b/check-linuxcnc-switchkins-remap-source-map.sh index 624fddb..1eb1f4f 100755 --- a/check-linuxcnc-switchkins-remap-source-map.sh +++ b/check-linuxcnc-switchkins-remap-source-map.sh @@ -83,11 +83,12 @@ for phrase in required_phrases: ) case_fields = {case["field"] for case in json_cases} -bad_fields = [field for field in case_fields if "tool" in field.lower()] +source_only_field_re = re.compile(r"asset|metadata|tool|tooldata|tool_table|TOOL_TABLE", re.I) +bad_fields = [field for field in case_fields if source_only_field_re.search(field)] if bad_fields: - raise SystemExit(f"generated switchkins config cases expose TOOL_TABLE fields: {bad_fields}") -if re.search(r'\btoolTable\b|\btooltable\b|\btool_table\b|\bTOOL_TABLE\b', Path("web/src/wasm-core.js").read_text(encoding="utf-8")): - raise SystemExit("web/src/wasm-core.js exposes TOOL_TABLE through switchkins API") -if re.search(r'\btoolTable\b|\btooltable\b|\btool_table\b|\bTOOL_TABLE\b', Path("web/src/index.ts").read_text(encoding="utf-8")): - raise SystemExit("web/src/index.ts exposes TOOL_TABLE through switchkins API") + raise SystemExit(f"generated switchkins config cases expose source-only fields: {bad_fields}") +api_surface_re = re.compile(r'\b(?:asset|metadata|toolData|tooldata|toolTable|tooltable|tool_table|TOOL_TABLE)\b') +for api_path in ["web/src/wasm-core.js", "web/src/index.ts", "core/include/cnc_sim_api.h"]: + if api_surface_re.search(Path(api_path).read_text(encoding="utf-8")): + raise SystemExit(f"{api_path} exposes source-only switchkins inputs through API surface") PY