参考所有分组,完成尽量多的内容:锁定kinematics源码映射结论
结论:新增 kinematics source-map 文档和同步检查,固定 manifest 分组计数与 source-coverage 边界,并接入 native/all-native guardrail;未扩展 smoke 功能。
This commit is contained in:
64
check-linuxcnc-kinematics-source-map.sh
Executable file
64
check-linuxcnc-kinematics-source-map.sh
Executable file
@@ -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
|
||||
49
docs/linuxcnc-kinematics-source-map.md
Normal file
49
docs/linuxcnc-kinematics-source-map.md
Normal file
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user