参考所有分组,完成尽量多的内容:收紧switchkins source-map边界守卫

This commit is contained in:
cnc
2026-06-05 06:57:11 +08:00
parent f64db24060
commit 79077fa695
2 changed files with 22 additions and 3 deletions

View File

@@ -6,7 +6,8 @@ cd "$(dirname "$0")"
# LinuxCNC source basis: this guard ties generated switchkins/remap aliases and
# config cases to LinuxCNC configs/sim INI REMAP entries, remap_subs
# #<kinstype> assignments, and halcmd loadusr parsing sources. It validates
# generator/table policy only; it does not add CNC behavior or expand smoke.
# generator/table policy only; it does not add CNC behavior, expand smoke
# parsing, or interpret G-code.
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
linuxcnc_root=$(cd "$linuxcnc_root" && pwd)
@@ -70,11 +71,14 @@ if f"| LinuxCNC switchkins REMAP INI sources | {len(remap_inis)} |" not in sourc
raise SystemExit("docs/linuxcnc-switchkins-remap-source-map.md REMAP INI source count mismatch")
required_phrases = [
"must not add new smoke parser behavior",
"must not add CNC behavior",
"must not expand the temporary smoke parser",
"`#<kinstype>` assignments",
"[EMCIO] TOOL_TABLE` entries are source coverage only",
"must not become generated switchkins aliases",
"./check-linuxcnc-switchkins-remap-source-map.sh",
"./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt",
"does not interpret G-code",
]
for phrase in required_phrases:
if phrase not in source_map:
@@ -82,6 +86,15 @@ for phrase in required_phrases:
f"docs/linuxcnc-switchkins-remap-source-map.md is missing boundary phrase: {phrase}"
)
for entry in [
"test-native.sh",
"test-linuxcnc-source-link.sh",
"build-wasm.sh",
]:
text = Path(entry).read_text(encoding="utf-8")
if "./check-linuxcnc-switchkins-remap-source-map.sh" not in text:
raise SystemExit(f"{entry} must run ./check-linuxcnc-switchkins-remap-source-map.sh")
case_fields = {case["field"] for case in json_cases}
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)]