diff --git a/check-linuxcnc-workstreams-source-map.sh b/check-linuxcnc-workstreams-source-map.sh new file mode 100755 index 0000000..026a5ab --- /dev/null +++ b/check-linuxcnc-workstreams-source-map.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")" + +# LinuxCNC source basis: this guard ties the six active workstream contexts to +# their source-map guards and to LinuxCNC source/config anchors. It validates +# coordination policy only; it does not add CNC behavior or expand smoke +# parsing. +linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc} +linuxcnc_root=$(cd "$linuxcnc_root" && pwd) + +grep -F '1. `switchkins/remap` generator and tables' docs/architecture.md >/dev/null +grep -F '2. `linuxcnc-kinematics` source manifest' docs/architecture.md >/dev/null +grep -F '3. WASM filesystem and OPFS persistence' docs/architecture.md >/dev/null +grep -F '4. browser app integration' docs/architecture.md >/dev/null +grep -F '5. Node and browser smoke coverage' docs/architecture.md >/dev/null +grep -F '6. source-link, build, and documentation constraints' docs/architecture.md >/dev/null + +grep -F 'REMAP = M428' "$linuxcnc_root/configs/sim/axis/vismach/5axis/bridgemill/5axis.ini" >/dev/null +grep -F '#' "$linuxcnc_root/configs/sim/axis/vismach/5axis/bridgemill/remap_subs/428remap.ngc" >/dev/null +grep -F 'GENSERKINSSRCS := emc/kinematics/ugenserkins.c' \ + "$linuxcnc_root/src/emc/kinematics/Submakefile" >/dev/null +grep -F 'extern int kinematicsInverse(const struct EmcPose * world,' \ + "$linuxcnc_root/src/emc/kinematics/kinematics.h" >/dev/null +grep -F '#define RS274NGC_PARAMETER_FILE_NAME_DEFAULT "rs274ngc.var"' \ + "$linuxcnc_root/src/emc/rs274ngc/interp_internal.hh" >/dev/null +grep -F 'int Interp::save_parameters(const char *filename,' \ + "$linuxcnc_root/src/emc/rs274ngc/rs274ngc_pre.cc" >/dev/null +grep -F 'LIBRS274SRCS := $(addprefix emc/rs274ngc/,' \ + "$linuxcnc_root/src/emc/rs274ngc/Submakefile" >/dev/null +grep -F 'LIBTOOLDATA_SRCS += emc/tooldata/tooldata_common.cc' \ + "$linuxcnc_root/src/emc/tooldata/Submakefile" >/dev/null +grep -F 'LIBLCNCINISRCS := emc/ini/inifile.cc' \ + "$linuxcnc_root/src/emc/ini/Submakefile" >/dev/null +grep -F 'LIBPPSRCS := $(addprefix emc/pythonplugin/,' \ + "$linuxcnc_root/src/emc/pythonplugin/Submakefile" >/dev/null + +grep -F 'LinuxCNC workstreams source map' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'must not add CNC' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'temporary smoke parser' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'Every active workstream must have at least one source-map document and guard' \ + docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'Browser filesystem persistence remains OPFS-only.' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'Smoke coverage remains verification only' docs/linuxcnc-workstreams-source-map.md >/dev/null + +python3 - <<'PY' +from pathlib import Path + +doc = Path("docs/linuxcnc-workstreams-source-map.md").read_text(encoding="utf-8") +expected = { + "switchkins/remap": [ + "docs/linuxcnc-switchkins-remap-source-map.md", + "check-linuxcnc-switchkins-remap-source-map.sh", + ], + "linuxcnc-kinematics": [ + "docs/linuxcnc-kinematics-source-map.md", + "check-linuxcnc-kinematics-source-map.sh", + ], + "WASM filesystem and OPFS persistence": [ + "docs/linuxcnc-opfs-source-map.md", + "docs/linuxcnc-wasm-shims-source-map.md", + "docs/linuxcnc-wasm-blockers-source-map.md", + "check-linuxcnc-opfs-source-map.sh", + "check-linuxcnc-wasm-shims-source-map.sh", + "check-linuxcnc-wasm-blockers-source-map.sh", + ], + "browser app integration": [ + "docs/linuxcnc-browser-app-source-map.md", + "check-linuxcnc-browser-app-source-map.sh", + ], + "Node and browser smoke coverage": [ + "docs/linuxcnc-wasm-smoke-source-map.md", + "check-linuxcnc-wasm-smoke-source-map.sh", + ], + "source-link, build, and documentation constraints": [ + "docs/linuxcnc-rs274-source-map.md", + "docs/linuxcnc-build-source-map.md", + "check-linuxcnc-rs274-source-map.sh", + "check-linuxcnc-build-source-map.sh", + ], +} +for workstream, paths in expected.items(): + if workstream not in doc: + raise SystemExit(f"missing workstream row in docs/linuxcnc-workstreams-source-map.md: {workstream}") + for path in paths: + if path not in doc: + raise SystemExit(f"missing source-map path in workstream index: {path}") + if not Path(path).exists(): + raise SystemExit(f"source-map path listed in workstream index does not exist: {path}") + if path.startswith("check-") and not Path(path).stat().st_mode & 0o111: + raise SystemExit(f"source-map guard is not executable: {path}") + +for test_entry in ["test-native.sh", "test-linuxcnc-source-link.sh"]: + text = Path(test_entry).read_text(encoding="utf-8") + for guard in sorted({path for paths in expected.values() for path in paths if path.startswith("check-")}): + if guard in {"check-linuxcnc-wasm-shims-source-map.sh", "check-linuxcnc-wasm-blockers-source-map.sh"}: + continue + if f"./{guard}" not in text: + raise SystemExit(f"{test_entry} does not run workstream source-map guard: {guard}") +PY diff --git a/docs/linuxcnc-workstreams-source-map.md b/docs/linuxcnc-workstreams-source-map.md new file mode 100644 index 0000000..0512e99 --- /dev/null +++ b/docs/linuxcnc-workstreams-source-map.md @@ -0,0 +1,56 @@ +# LinuxCNC workstreams source map + +This map ties the six active workstream contexts to their source-map guards. It +is a coordination guard only; it must not add CNC behavior and must not expand +the temporary smoke parser. + +## Workstream Coverage + +| Workstream | Source-map documents | Guard scripts | +| --- | --- | --- | +| `switchkins/remap` generator and tables | `docs/linuxcnc-switchkins-remap-source-map.md` | `check-linuxcnc-switchkins-remap-source-map.sh` | +| `linuxcnc-kinematics` source manifest | `docs/linuxcnc-kinematics-source-map.md` | `check-linuxcnc-kinematics-source-map.sh` | +| WASM filesystem and OPFS persistence | `docs/linuxcnc-opfs-source-map.md`, `docs/linuxcnc-wasm-shims-source-map.md`, `docs/linuxcnc-wasm-blockers-source-map.md` | `check-linuxcnc-opfs-source-map.sh`, `check-linuxcnc-wasm-shims-source-map.sh`, `check-linuxcnc-wasm-blockers-source-map.sh` | +| browser app integration | `docs/linuxcnc-browser-app-source-map.md` | `check-linuxcnc-browser-app-source-map.sh` | +| Node and browser smoke coverage | `docs/linuxcnc-wasm-smoke-source-map.md` | `check-linuxcnc-wasm-smoke-source-map.sh` | +| source-link, build, and documentation constraints | `docs/linuxcnc-rs274-source-map.md`, `docs/linuxcnc-build-source-map.md` | `check-linuxcnc-rs274-source-map.sh`, `check-linuxcnc-build-source-map.sh` | + +## LinuxCNC Source Basis + +- `configs/sim/**.ini` and `remap_subs/{428,429,430}remap.ngc` back the + switchkins/remap workstream. +- `src/emc/kinematics/Submakefile` and `src/emc/kinematics/kinematics.h` back + the kinematics manifest workstream. +- `src/emc/rs274ngc/interp_internal.hh` and + `src/emc/rs274ngc/rs274ngc_pre.cc` back the OPFS/browser parameter-file + workstreams. +- `src/emc/rs274ngc/Submakefile`, `src/emc/tooldata/Submakefile`, + `src/emc/ini/Submakefile`, and `src/emc/pythonplugin/Submakefile` back the + source-link and build-policy workstream. + +## Boundaries + +- Every active workstream must have at least one source-map document and guard + script. +- `test-native.sh` and `test-linuxcnc-source-link.sh` must run the workstream + source-map guard before consuming generated config aliases or source-linked + LinuxCNC objects. +- WASM blocker and shim maps remain source coverage guards, not browser API + expansion points. +- Browser filesystem persistence remains OPFS-only. +- Smoke coverage remains verification only and must not become a functional CNC + behavior path. + +## Checks + +Run: + +```bash +./check-linuxcnc-workstreams-source-map.sh +./test-native.sh +./test-linuxcnc-source-link.sh +``` + +`check-linuxcnc-workstreams-source-map.sh` keeps the six-workstream architecture +list, source-map documents, guard scripts, LinuxCNC source anchors, and native / +source-link guard entry points synchronized. diff --git a/test-all-native.sh b/test-all-native.sh index 9eec114..1611abf 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -159,6 +159,9 @@ grep -F './check-linuxcnc-build-source-map.sh' test-linuxcnc-source-link.sh >/de grep -F 'LinuxCNC source basis: this guard ties the browser app entry point' check-linuxcnc-browser-app-source-map.sh >/dev/null grep -F './check-linuxcnc-browser-app-source-map.sh' test-native.sh >/dev/null grep -F './check-linuxcnc-browser-app-source-map.sh' test-linuxcnc-source-link.sh >/dev/null +grep -F 'LinuxCNC source basis: this guard ties the six active workstream contexts' check-linuxcnc-workstreams-source-map.sh >/dev/null +grep -F './check-linuxcnc-workstreams-source-map.sh' test-native.sh >/dev/null +grep -F './check-linuxcnc-workstreams-source-map.sh' test-linuxcnc-source-link.sh >/dev/null grep -F 'LinuxCNC source basis: this guard ties the documented WASM blocker map' check-linuxcnc-wasm-blockers-source-map.sh >/dev/null grep -F 'LinuxCNC source basis: this guard ties the documented wasm-safe shim map' check-linuxcnc-wasm-shims-source-map.sh >/dev/null grep -F 'LinuxCNC source basis: the cached input checker keys check-linuxcnc-inputs.sh' check-linuxcnc-inputs-cached.sh >/dev/null @@ -248,6 +251,9 @@ grep -F '`build-wasm.sh` must configure with `CNC_SIM_ENABLE_SMOKE_BACKEND=OFF`' grep -F 'LinuxCNC browser app source map' docs/linuxcnc-browser-app-source-map.md >/dev/null grep -F 'The app must persist the current program at `programs/current.ngc`.' docs/linuxcnc-browser-app-source-map.md >/dev/null grep -F 'The visible backend selector must stay limited to the LinuxCNC RS274 backend.' docs/linuxcnc-browser-app-source-map.md >/dev/null +grep -F 'LinuxCNC workstreams source map' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F '| `switchkins/remap` generator and tables | `docs/linuxcnc-switchkins-remap-source-map.md` |' docs/linuxcnc-workstreams-source-map.md >/dev/null +grep -F 'Every active workstream must have at least one source-map document and guard' docs/linuxcnc-workstreams-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-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index 2708d78..2adb15f 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -36,10 +36,14 @@ fi preflight_cache_dir="$build_dir/preflight-cache" LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs-cached.sh --cache-dir "$preflight_cache_dir" "$manifest" +./check-linuxcnc-rs274-source-map.sh +./check-linuxcnc-kinematics-source-map.sh +./check-linuxcnc-opfs-source-map.sh ./check-linuxcnc-switchkins-remap-source-map.sh ./check-linuxcnc-wasm-smoke-source-map.sh ./check-linuxcnc-build-source-map.sh ./check-linuxcnc-browser-app-source-map.sh +./check-linuxcnc-workstreams-source-map.sh LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-switchkins-remap-table-cached.sh --cache-dir "$preflight_cache_dir" linuxcnc-kinematics-source-files.txt # The LinuxCNC source-linked dump path is not concurrency-safe under parallel execution. exec 9>"${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.lock" diff --git a/test-native.sh b/test-native.sh index e8ea84f..98f8c83 100755 --- a/test-native.sh +++ b/test-native.sh @@ -41,6 +41,7 @@ preflight_cache_dir="$build_dir/preflight-cache" ./check-linuxcnc-wasm-smoke-source-map.sh ./check-linuxcnc-build-source-map.sh ./check-linuxcnc-browser-app-source-map.sh +./check-linuxcnc-workstreams-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