From 4eb694164fe20bdd83f0f70f568a16ff6ba7dafb Mon Sep 17 00:00:00 2001 From: cnc Date: Thu, 4 Jun 2026 14:33:52 +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=E9=94=81=E5=AE=9Akinematic?= =?UTF-8?q?s=E6=BA=90=E7=A0=81=E6=98=A0=E5=B0=84=E7=BB=93=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:新增 kinematics source-map 文档和同步检查,固定 manifest 分组计数与 source-coverage 边界,并接入 native/all-native guardrail;未扩展 smoke 功能。 --- check-linuxcnc-kinematics-source-map.sh | 64 +++++++++++++++++++++++++ docs/linuxcnc-kinematics-source-map.md | 49 +++++++++++++++++++ test-all-native.sh | 5 ++ test-native.sh | 1 + 4 files changed, 119 insertions(+) create mode 100755 check-linuxcnc-kinematics-source-map.sh create mode 100644 docs/linuxcnc-kinematics-source-map.md diff --git a/check-linuxcnc-kinematics-source-map.sh b/check-linuxcnc-kinematics-source-map.sh new file mode 100755 index 0000000..e42de90 --- /dev/null +++ b/check-linuxcnc-kinematics-source-map.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +# LinuxCNC source basis: this guard keeps the kinematics source map aligned +# with linuxcnc-kinematics-source-files.txt, which enumerates LinuxCNC +# kinematics, posemath, switchkins INI/HAL/remap/tooldata/assets, and adjacent +# build metadata. It validates source coverage documentation only; it does not +# add or interpret CNC behavior. +python3 - <<'PY' +from pathlib import Path +import re + +manifest = Path("linuxcnc-kinematics-source-files.txt").read_text(encoding="utf-8").splitlines() +source_map = Path("docs/linuxcnc-kinematics-source-map.md").read_text(encoding="utf-8") + +expected_groups = [ + "core", + "config", + "remap", + "component", + "generated", + "header", + "metadata", + "asset", + "tooldata", +] +counts = {group: 0 for group in expected_groups} +for line in manifest: + if not line or line.startswith("#"): + continue + group = line.split(":", 1)[0] + if group not in counts: + raise SystemExit(f"unexpected kinematics manifest group in source map guard: {group}") + counts[group] += 1 + +for group, count in counts.items(): + pattern = rf"\| `{re.escape(group)}` \| {count} \|" + if not re.search(pattern, source_map): + raise SystemExit( + f"docs/linuxcnc-kinematics-source-map.md {group} count no longer matches linuxcnc-kinematics-source-files.txt" + ) + +for group in expected_groups: + if f"`{group}`" not in source_map: + raise SystemExit( + f"docs/linuxcnc-kinematics-source-map.md is missing kinematics manifest group {group}" + ) + +required_phrases = [ + "not browser API surface", + "OPFS-only", + "derive M428/M429/M430 cases from", + "RTCP and five-axis coverage", + "./check-linuxcnc-inputs.sh linuxcnc-kinematics-source-files.txt --require-kinematics-complete", + "./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt", +] +for phrase in required_phrases: + if phrase not in source_map: + raise SystemExit( + f"docs/linuxcnc-kinematics-source-map.md is missing source-coverage boundary phrase: {phrase}" + ) +PY diff --git a/docs/linuxcnc-kinematics-source-map.md b/docs/linuxcnc-kinematics-source-map.md new file mode 100644 index 0000000..9019864 --- /dev/null +++ b/docs/linuxcnc-kinematics-source-map.md @@ -0,0 +1,49 @@ +# LinuxCNC kinematics source map + +This map tracks the LinuxCNC source/configuration basis for kinematics, +switchkins, RTCP, and M428/M429/M430 remap coverage. It is intentionally a +source-coverage document: the manifest entries here must not become browser or +application behavior by themselves. + +## Manifest groups + +The kinematics manifest currently contains these LinuxCNC-root relative source +groups: + +| Group | Count | Source coverage role | +| --- | ---: | --- | +| `core` | 30 | LinuxCNC kinematics and posemath C/C++ sources. | +| `config` | 33 | LinuxCNC switchkins INI/HAL/POSTGUI sources used by M428/M429/M430 and RTCP coverage. | +| `remap` | 31 | LinuxCNC M428/M429/M430 remap subroutines. | +| `component` | 8 | LinuxCNC halcompile component sources referenced by kinematics configs. | +| `generated` | 8 | LinuxCNC halcompile-generated C sources adjacent to component coverage. | +| `header` | 13 | LinuxCNC kinematics and posemath declarations. | +| `metadata` | 34 | LinuxCNC build/manpage metadata adjacent to covered kinematics sources. | +| `asset` | 122 | LinuxCNC INI-adjacent HAL, README, GUI, demo, PYVCP, and other source assets. | +| `tooldata` | 10 | LinuxCNC tool table files referenced by covered M428/M429/M430 INI files. | + +## Boundaries + +- `asset`, `metadata`, `header`, and `tooldata` entries are source coverage, + not browser API surface. +- Browser-side file persistence remains OPFS-only and is not expanded by this + manifest. +- Switchkins/remap generation must continue to derive M428/M429/M430 cases from + LinuxCNC INI/HAL/remap sources, not from hand-authored behavior. +- RTCP and five-axis coverage must remain tied to LinuxCNC kinematics sources, + remap files, and configuration files. + +## Checks + +Run: + +```bash +./check-linuxcnc-kinematics-source-map.sh +./check-linuxcnc-inputs.sh linuxcnc-kinematics-source-files.txt --require-kinematics-complete +./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt +``` + +`check-linuxcnc-kinematics-source-map.sh` keeps this document's group counts in +sync with `linuxcnc-kinematics-source-files.txt`; the input and table checkers +validate LinuxCNC source existence, directory completeness, remap kinstype +notes, and switchkins/remap table generation. diff --git a/test-all-native.sh b/test-all-native.sh index 3863974..699246c 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -143,6 +143,8 @@ grep -F 'LinuxCNC source basis: the wasm build preflights and compiles the' buil grep -F 'LinuxCNC source basis: manifest validation checks LinuxCNC-root relative' check-linuxcnc-inputs.sh >/dev/null grep -F 'LinuxCNC source basis: this guard keeps the local source map aligned' check-linuxcnc-rs274-source-map.sh >/dev/null grep -F './check-linuxcnc-rs274-source-map.sh' test-native.sh >/dev/null +grep -F 'LinuxCNC source basis: this guard keeps the kinematics source map aligned' check-linuxcnc-kinematics-source-map.sh >/dev/null +grep -F './check-linuxcnc-kinematics-source-map.sh' test-native.sh >/dev/null grep -F 'LinuxCNC source basis: the cached input checker keys check-linuxcnc-inputs.sh' check-linuxcnc-inputs-cached.sh >/dev/null grep -F 'LinuxCNC source basis: switchkins/remap table validation derives M428/M429/M430' check-linuxcnc-switchkins-remap-table.sh >/dev/null grep -F 'LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs-cached.sh "$manifest" --require-kinematics-complete' check-linuxcnc-switchkins-remap-table.sh >/dev/null @@ -205,6 +207,9 @@ grep -F '`src/hal/utils/halcmd_completion.c`' docs/linuxcnc-source-policy.md >/d grep -F 'must not become new generated API aliases or browser cases.' docs/linuxcnc-source-policy.md >/dev/null grep -F 'The kinematics manifest lister must preserve every allowed manifest group' docs/linuxcnc-source-policy.md >/dev/null grep -F 'including `asset`, `tooldata`, and' docs/linuxcnc-source-policy.md >/dev/null +grep -F 'LinuxCNC kinematics source map' docs/linuxcnc-kinematics-source-map.md >/dev/null +grep -F '| `tooldata` | 10 | LinuxCNC tool table files referenced by covered M428/M429/M430 INI files. |' docs/linuxcnc-kinematics-source-map.md >/dev/null +grep -F 'Browser-side file persistence remains OPFS-only' docs/linuxcnc-kinematics-source-map.md >/dev/null grep -F 'check-linuxcnc-switchkins-remap-table-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt' test-native.sh >/dev/null grep -F 'check-linuxcnc-switchkins-remap-table-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt' test-linuxcnc-source-link.sh >/dev/null grep -F 'check-linuxcnc-switchkins-remap-table-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt' build-wasm.sh >/dev/null diff --git a/test-native.sh b/test-native.sh index acb4823..8bb7275 100755 --- a/test-native.sh +++ b/test-native.sh @@ -35,6 +35,7 @@ preflight_cache_dir="$build_dir/preflight-cache" ./check-linuxcnc-inputs-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-rs274-wasm-source-files.txt --require-rs274-complete ./check-linuxcnc-inputs-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt --require-kinematics-complete ./check-linuxcnc-rs274-source-map.sh +./check-linuxcnc-kinematics-source-map.sh ./check-linuxcnc-switchkins-remap-table-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt grep -F 'tooldata:src/emc/tooldata/tooldata_nml.cc:NML tool table backend selected by LinuxCNC TOOL_NML_FLAG' linuxcnc-rs274-source-files.txt >/dev/null grep -F 'tooldata:src/emc/tooldata/tool_mmap_read.cc:LinuxCNC tooldata mmap reader utility source from tooldata Submakefile' linuxcnc-rs274-source-files.txt >/dev/null