rosfix 0.2.3__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rosfix/__init__.py ADDED
@@ -0,0 +1,33 @@
1
+ """rosfix: static checker for silent ROS 2 misconfigurations.
2
+
3
+ The analysis is done by the bundled native `rosfix` executable; this package only
4
+ locates it (for `python -m rosfix` and the `ros2 rosfix` command).
5
+ """
6
+
7
+ import os
8
+ import sys
9
+ import sysconfig
10
+
11
+
12
+ def find_rosfix_bin() -> str:
13
+ """Return the path of the bundled rosfix executable."""
14
+ exe = "rosfix" + (".exe" if sys.platform == "win32" else "")
15
+ candidates = [
16
+ os.path.join(sysconfig.get_path("scripts"), exe),
17
+ os.path.join(sysconfig.get_path("scripts", vars={"base": sys.base_prefix}), exe),
18
+ ]
19
+ user_scheme = {"nt": "nt_user", "posix": "posix_user"}.get(os.name)
20
+ if user_scheme:
21
+ try:
22
+ candidates.append(os.path.join(sysconfig.get_path("scripts", scheme=user_scheme), exe))
23
+ except KeyError:
24
+ pass
25
+ for path in candidates:
26
+ if os.path.isfile(path):
27
+ return path
28
+ from shutil import which
29
+
30
+ found = which("rosfix")
31
+ if found:
32
+ return found
33
+ raise FileNotFoundError("the rosfix executable was not found next to this Python installation")
rosfix/__main__.py ADDED
@@ -0,0 +1,19 @@
1
+ """`python -m rosfix …` runs the bundled executable."""
2
+
3
+ import os
4
+ import subprocess
5
+ import sys
6
+
7
+ from rosfix import find_rosfix_bin
8
+
9
+
10
+ def main() -> int:
11
+ exe = find_rosfix_bin()
12
+ if sys.platform == "win32":
13
+ return subprocess.run([exe, *sys.argv[1:]]).returncode
14
+ os.execv(exe, [exe, *sys.argv[1:]])
15
+ return 0 # unreachable
16
+
17
+
18
+ if __name__ == "__main__":
19
+ sys.exit(main())
rosfix/py.typed ADDED
File without changes
rosfix/ros2cli.py ADDED
@@ -0,0 +1,31 @@
1
+ """`ros2 rosfix …`: a ros2cli command that forwards to the rosfix executable.
2
+
3
+ Registered through the `ros2cli.command` entry point; only imported when ros2cli runs,
4
+ so this module may depend on it.
5
+ """
6
+
7
+ import argparse
8
+ import subprocess
9
+
10
+ try:
11
+ from ros2cli.command import CommandExtension
12
+ except ImportError: # ros2cli not installed: provide a stub so imports still work
13
+ class CommandExtension: # type: ignore[no-redef]
14
+ pass
15
+
16
+ from rosfix import find_rosfix_bin
17
+
18
+
19
+ class RosfixCommand(CommandExtension):
20
+ """Check a ROS 2 workspace for silent misconfigurations."""
21
+
22
+ def add_arguments(self, parser, cli_name):
23
+ parser.add_argument(
24
+ "rosfix_args",
25
+ nargs=argparse.REMAINDER,
26
+ help="arguments passed to rosfix (e.g. `src --format sarif`); see `ros2 rosfix -- --help`",
27
+ )
28
+
29
+ def main(self, *, parser, args):
30
+ forwarded = [a for a in args.rosfix_args if a != "--"]
31
+ return subprocess.run([find_rosfix_bin(), *forwarded]).returncode
rosfix/ros2doctor.py ADDED
@@ -0,0 +1,72 @@
1
+ """`ros2 doctor` integration: rosfix's environment checks as a ros2doctor check and report.
2
+
3
+ ros2doctor loads these classes through the `ros2doctor.checks` and `ros2doctor.report` entry
4
+ points of this package, so after `pip install rosfix`, `ros2 doctor` also checks the
5
+ middleware environment (RMW_IMPLEMENTATION, ROS_DOMAIN_ID, discovery settings, DDS profile
6
+ files) and `ros2 doctor --report` lists rosfix's findings. The checks themselves run in the
7
+ native `rosfix doctor` command; this module only translates its JSON output.
8
+ """
9
+
10
+ import json
11
+ import subprocess
12
+
13
+ from ros2doctor.api import DoctorCheck, DoctorReport, Report, Result
14
+ from ros2doctor.api.format import doctor_error, doctor_warn
15
+
16
+ from rosfix import find_rosfix_bin
17
+
18
+ CATEGORY = 'rosfix'
19
+
20
+
21
+ def _checks():
22
+ """Run `rosfix doctor --format json`; None if rosfix cannot be run."""
23
+ try:
24
+ out = subprocess.run(
25
+ [find_rosfix_bin(), 'doctor', '--format', 'json'],
26
+ capture_output=True, text=True, timeout=60, check=False)
27
+ return json.loads(out.stdout)
28
+ except (OSError, ValueError, subprocess.SubprocessError):
29
+ return None
30
+
31
+
32
+ def _line(c):
33
+ text = f"{c['subject']}: {c['message']}"
34
+ if c.get('help'):
35
+ text += f" ({c['help']})"
36
+ return text
37
+
38
+
39
+ class RosfixEnvironmentCheck(DoctorCheck):
40
+ """Middleware environment checks from rosfix (see `rosfix docs doctor`)."""
41
+
42
+ def category(self):
43
+ return CATEGORY
44
+
45
+ def check(self):
46
+ result = Result()
47
+ checks = _checks()
48
+ if checks is None:
49
+ doctor_warn('rosfix: could not run `rosfix doctor`')
50
+ result.add_warning()
51
+ return result
52
+ for c in checks:
53
+ if c['level'] == 'error':
54
+ doctor_error(f'rosfix: {_line(c)}')
55
+ result.add_error()
56
+ elif c['level'] == 'warning':
57
+ doctor_warn(f'rosfix: {_line(c)}')
58
+ result.add_warning()
59
+ return result
60
+
61
+
62
+ class RosfixEnvironmentReport(DoctorReport):
63
+ """`ros2 doctor --report` section listing every rosfix environment check."""
64
+
65
+ def category(self):
66
+ return CATEGORY
67
+
68
+ def report(self):
69
+ report = Report('ROSFIX ENVIRONMENT')
70
+ for c in _checks() or []:
71
+ report.add_to_report(c['subject'], f"{c['level']}: {c['message']}")
72
+ return report
Binary file
@@ -0,0 +1,369 @@
1
+ Metadata-Version: 2.4
2
+ Name: rosfix
3
+ Version: 0.2.3
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Environment :: Console
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: License :: OSI Approved :: Apache Software License
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: Software Development :: Quality Assurance
11
+ Classifier: Topic :: Scientific/Engineering
12
+ License-File: LICENSE-APACHE
13
+ License-File: LICENSE-MIT
14
+ Summary: Static checker for silent ROS 2 misconfigurations (parameters, topics, QoS, executors, ros2_control, Nav2, launch/packaging, SROS2)
15
+ Keywords: ros2,robotics,linter,static-analysis,launch
16
+ Home-Page: https://github.com/SohamWalam11/ros2-safety-lint
17
+ License: MIT OR Apache-2.0
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
20
+ Project-URL: Repository, https://github.com/SohamWalam11/ros2-safety-lint
21
+
22
+ # rosfix
23
+
24
+ [![CI](https://github.com/SohamWalam11/ros2-safety-lint/actions/workflows/ci.yml/badge.svg)](https://github.com/SohamWalam11/ros2-safety-lint/actions)
25
+ [![License: MIT/Apache-2.0](https://img.shields.io/badge/License-MIT%2FApache--2.0-blue.svg)](LICENSE-MIT)
26
+
27
+ **A static checker for the ROS 2 misconfigurations that fail silently.**
28
+
29
+ ROS 2 configuration is spread over launch files, parameter YAML, C++/Python nodes,
30
+ `package.xml`/CMake/`setup.py`, URDF/xacro, controller, Nav2, MoveIt and ros_gz_bridge
31
+ configs. Many mistakes in
32
+ that spread are never reported at runtime: a parameter under the wrong node key is simply
33
+ dropped, a remap that matches nothing does nothing, a RELIABLE subscriber never hears a
34
+ BEST_EFFORT publisher. rosfix reads the whole workspace, **resolves the launch graph** the
35
+ way ROS 2 would (namespaces, remaps, launch arguments, includes, parameter-file matching),
36
+ links every launched node to its source code, and reports what will not work — before you
37
+ run anything.
38
+
39
+ It is small and frugal: single-threaded by default, typically 10–50 MB of RAM, no GPU,
40
+ no ROS installation needed.
41
+
42
+ ## What it checks
43
+
44
+ 93 rules in 18 agents (17 domain agents, plus `core`, which reports files it could not parse):
45
+
46
+ | Agent | Rules | Example |
47
+ |---|---|---|
48
+ | **params** | P001–P008 | YAML key `controller_server` while the node runs as `/robot1/controller_server`; `max_velocty` (typo) not declared by the node; `max_vel: 1` for a `double` (crashes at startup); missing `ros__parameters`; value outside a declared range; parameter renamed between distributions; two parameters that contradict each other. |
49
+ | **topics** | T001–T005 | Subscriber on `/scan` while the publisher is on `/robot1/scan`; remap of a name the node never uses; one topic with two message types. |
50
+ | **executor** | E001–E002 | Synchronous service call / future wait / spin inside a callback that shares the callback group (or a single-threaded executor) with the response — a deadlock; sleep in a callback. |
51
+ | **control** | C001–C010 | Controller joint not in any `<ros2_control>` block; velocity controller on a position-only joint; controller type typo; `<ros2_control>` joint missing from the URDF; spawned controller never defined; `update_rate` the controller manager cannot run. |
52
+ | **packaging** | L001–L012 | Launch file starts an executable the package does not build/install; dependency used but not in `package.xml`; `setup.cfg` without `install_scripts`; `launch/` never installed; dependency `rosdep` cannot resolve; `install()` of a path that does not exist; Python subpackage missing from `setup.py`. |
53
+ | **launch** | A001–A003 | `$(var x)` never declared; declared argument never used; two nodes with the same fully qualified name. |
54
+ | **simtime** | S001–S003 | Some nodes on simulated time, others on wall time; simulator launched but a node not using `/clock`. |
55
+ | **qos** | Q001–Q005 | RELIABLE subscription on a BEST_EFFORT publisher (incl. RViz displays); TRANSIENT_LOCAL subscription on a VOLATILE publisher; `qos_overrides` in YAML for an endpoint that does not accept overrides (silently ignored). |
56
+ | **nav2** | N001–N006, N008–N010 | Plugin listed without a section; plugin type typo; frame not in the URDF; degenerate footprint; inflation radius smaller than the robot; plugin renamed between distributions; unknown behavior-tree node. |
57
+ | **lifecycle** | M001–M002 | Lifecycle node no manager activates; manager lists a node that does not exist. |
58
+ | **tf** | F001–F005 | Frame with two parents; bad `static_transform_publisher` arguments; leading slash in a lookup; cycle in the static tree. |
59
+ | **network** | D001–D005 | Invalid `ROS_DOMAIN_ID`; unknown `RMW_IMPLEMENTATION`; missing DDS profile file; deprecated `ROS_LOCALHOST_ONLY`; invalid Zenoh setting. |
60
+ | **security** | X001–X006 | Unauthenticated participants allowed; `<default>ALLOW`; wildcard grants; expired permissions; unknown enclave; node publishing a topic its SROS2 policy denies. |
61
+ | **moveit** | V001–V005 | `kinematics.yaml` group not in the SRDF; integer joint limit; SRDF names a joint the URDF lacks; MoveIt controller no ros2_control config defines. |
62
+ | **urdf** | U001–U004 | Element urdfdom rejects; impossible inertia; missing `package://` mesh; empty joint-limit range. |
63
+ | **gzbridge** | G001–G005 | ROS/Gazebo type pair `ros_gz_bridge` cannot convert; malformed bridge argument or YAML entry; one-way bridge pointing the wrong way. |
64
+ | **ros1** | O001–O003 | ROS 1 launch file, `ros/ros.h` include or catkin package left in a ROS 2 workspace. |
65
+
66
+ `rosfix rules` prints all rules; `rosfix explain P001` explains one.
67
+
68
+ Design rule: **when rosfix cannot know, it stays silent.** Facts that could not be
69
+ resolved statically (dynamic launch code, parameters declared by plugins, external
70
+ packages) are tracked explicitly and turn the dependent checks off instead of guessing.
71
+ `rosfix --print-graph` shows exactly what was understood.
72
+
73
+ ## Works with your installed ROS
74
+
75
+ In a sourced ROS 2 shell, rosfix reads the installed environment (`AMENT_PREFIX_PATH`):
76
+ installed packages, their executables, pluginlib plugins and rclcpp components, and the launch
77
+ and parameter files of packages your launch files include. For nodes from installed packages
78
+ (Nav2, ros2_controllers, robot_state_publisher, slam_toolbox, robot_localization, …) it uses a
79
+ built-in **knowledge pack** per distribution (Humble, Jazzy, Kilted; Rolling uses the newest),
80
+ extracted from their source, so e.g. `controller_frequency: 20` for Nav2's controller server is
81
+ reported as a startup crash without having Nav2's source. The distribution comes from
82
+ `ROS_DISTRO`, `--distro`, or `distro = "jazzy"` in `rosfix.toml`; without it, the packs are not
83
+ used (parameter names differ between distributions). `--ros-prefix` points at another install;
84
+ `--no-ros` ignores it.
85
+
86
+ Each pack records every node's declared parameters (with type and default) and its topic
87
+ endpoints with the QoS its source requests; an endpoint that asks for the system-default profile
88
+ is kept as *unknown*, since the middleware decides it. Each distribution also embeds the keys
89
+ `rosdep` can resolve (4,590 Humble, 4,696 Jazzy, 3,990 Kilted). The packs are published as a
90
+ [dataset](https://huggingface.co/datasets/SohamW11/rosfix-knowledge-packs).
91
+
92
+ ## Install
93
+
94
+ ```bash
95
+ cargo install rosfix # from crates.io (Rust 1.88 or newer)
96
+ ```
97
+
98
+ From v0.2.3 on, each tagged release also publishes Python wheels (`pip install rosfix`, which
99
+ adds a `ros2 rosfix` command), a standalone archive per platform (about 15 MB; the fix ranker is
100
+ built in) and Docker images (`ghcr.io/sohamwalam11/rosfix:<distro>-lite`). Until that release is
101
+ out, install with cargo.
102
+
103
+ ## Usage
104
+
105
+ ```bash
106
+ rosfix # analyse the current workspace (same as `rosfix check`)
107
+ rosfix check ~/ros2_ws/src # analyse a directory
108
+ rosfix check --format sarif -o rosfix.sarif # for GitHub code scanning
109
+ rosfix check --format json # stable, versioned JSON
110
+ rosfix fix # preview verified automatic fixes as a diff (nothing is written)
111
+ rosfix fix --write # apply them
112
+ rosfix check --format rdjson | reviewdog -f=rdjson -reporter=github-pr-review # fixes as PR suggestions
113
+ rosfix graph --format mermaid # the resolved launch graph (text, json, dot, mermaid)
114
+ rosfix graph --format callbacks # static callback graph: executors, timers with periods, subscriptions
115
+ rosfix migrate --to kilted # what breaks on another ROS distribution
116
+ rosfix doctor # check this shell's ROS 2 / middleware environment (DDS and Zenoh)
117
+ rosfix triage launch.log # explain errors in a failed launch log with the findings
118
+ rosfix init # write rosfix.toml and a GitHub workflow
119
+ rosfix status # what each agent checked, found, and what limits it
120
+ rosfix report -o report.html # one HTML page: findings, agents, launch graph
121
+ rosfix shell src # interactive, with history and Tab completion
122
+ rosfix docs # the full manual, built into the binary
123
+ ```
124
+
125
+ The original flags (`rosfix --fix --write`, `--print-graph`, `--list-rules`, …) keep working.
126
+
127
+ In editors, `rosfix lsp` is a language server with findings as you type and fixes as quick
128
+ fixes; [editors/vscode](editors/vscode) is a VS Code extension for it.
129
+
130
+ Exit codes: `0` clean, `1` findings at or above `--fail-on` (default `warning`), `2` usage or tool error.
131
+
132
+ ### Automatic fixes
133
+
134
+ Only local, mechanical fixes are automatic (e.g. `1` → `1.0`, renaming a misspelled key,
135
+ adding a `<depend>`, installing `launch/`). Every candidate fix is applied **in memory**,
136
+ the whole workspace is re-analysed, and the fix is kept only if its finding disappears and
137
+ no new error appears; then files are written atomically. Everything else is shown as a
138
+ suggestion.
139
+
140
+ ### Fix assistant (`--assist`)
141
+
142
+ Some findings have no mechanical fix, e.g. a parameter written as `max_lin_vel` when the node
143
+ declares `max_linear_velocity`. Each such finding carries the closed set of valid values rosfix
144
+ knows (declared parameters, `<ros2_control>` joints, URDF frames, executables, enclaves).
145
+ `--assist` picks one of them with a **built-in learned ranker**: 16 string features per option
146
+ (edit distances, n-gram overlap, abbreviation and word-prefix coverage, …) scored by a tiny
147
+ neural network. It has 289 weights and 32 normalisation constants (about 1.3 KB), compiled into
148
+ the binary, and needs no model files, ML runtime, GPU or network. It scores a finding in
149
+ microseconds.
150
+
151
+ It is evaluated on held-out packages **and** names: a test case is dropped if its name also
152
+ occurs in training, because packages share many names. On the shipped model's held-out cases it
153
+ picks the right value in 69.5% of cases against 54.1% for plain lexical ranking, and makes 7
154
+ wrong picks in 1,791 cases against 30. It also abstains when none of the options is the intended
155
+ one (for example a remap of a name the node never uses).
156
+
157
+ | held-out (shipped model) | cases | lexical: correct / abstain / wrong | learned: correct / abstain / wrong |
158
+ |---|---:|---|---|
159
+ | right answer offered | 1,062 | 575 / 482 / 5 | **738** / 322 / **2** |
160
+ | right answer absent (any pick is wrong) | 729 | 0 / 704 / 25 | 0 / **724** / **5** |
161
+
162
+ Over 5 package folds (3,005 held-out cases) it is correct 43.2% of the time against 26.7% and
163
+ makes 48 wrong picks against 59. It is correct more often in every fold, but in 3 of the 5 folds
164
+ it makes slightly more wrong picks than lexical ranking. That is why assisted fixes are verified
165
+ and written only on explicit request.
166
+
167
+ On the mutation benchmark below it fixed all 28 misspelled executable names (lexical: 12).
168
+ Weights and model card: [huggingface.co/SohamW11/rosfix-assist](https://huggingface.co/SohamW11/rosfix-assist).
169
+
170
+ The assistant can only choose among real options, never invent text, and abstains unless
171
+ there is a clear winner. Every choice is verified by re-analysis. Because verification
172
+ cannot prove intent, assisted fixes are written only with `--fix --write --accept-assist`.
173
+ How the ranker is trained and evaluated: [`training/README.md`](training/README.md).
174
+
175
+ #### Larger assist models (in development)
176
+
177
+ `--model` selects the ranker: `builtin` (default), a downloadable tier, or a `.rfm` file path.
178
+ Tiers also see the rule and the source lines around the problem, not just the two names. They
179
+ are the same int8 transformer in different sizes, run on any CPU, need no GPU, network or
180
+ Python, and give bit-identical results on every machine.
181
+
182
+ | tier | stored numbers | file | per candidate, 64-token input* |
183
+ |---|---:|---:|---:|
184
+ | builtin | 321 | in the binary | < 0.01 ms |
185
+ | nano | 1.46 M | 1.6 MB | 5 ms |
186
+ | mini | 5.32 M | 5.5 MB | 25 ms |
187
+ | base | 23.3 M | 23.6 MB | 85 ms |
188
+
189
+ \* Median of 5 trials, one thread, Intel Core 5 120U laptop under normal background load
190
+ ([raw data](paper/data/tier_runtime_trials_2026-11-24.txt)).
191
+
192
+ **No tier has been released yet.** A tier name only loads a checksum-verified released file, and
193
+ until a tier is trained and beats the built-in ranker with no more wrong picks in every
194
+ evaluation fold, rosfix uses the built-in ranker. The runtime and trainer live in
195
+ [`crates/rosfix-model`](crates/rosfix-model); `rosfix-model-bench` reproduces the timings.
196
+
197
+ ### Online references (`--online`)
198
+
199
+ Off by default. With `--online` (or `online = true`), rosfix attaches links to related
200
+ Robotics Stack Exchange questions and GitHub issues (and your own SearXNG instance, if
201
+ `searxng_url` is set). Queries are built **only from the rule that fired**: no file content,
202
+ path, node or package name leaves your machine (`--show-queries` prints them). The lookup runs
203
+ in a separate helper process restricted to an allowlist of HTTPS hosts, with no redirects,
204
+ short timeouts and size limits. Results are cached locally.
205
+
206
+ ### Build check (`--verify-build`)
207
+
208
+ `--fix --verify-build` copies the workspace to a temporary directory and builds it before and
209
+ after the fixes, in a network-less `ros:<distro>` container when Docker is available,
210
+ otherwise with your local `colcon`. Fixes that break a build that worked are not written.
211
+
212
+ ### Configuration (`rosfix.toml`)
213
+
214
+ ```toml
215
+ ignore = ["third_party/**"]
216
+ test_paths = ["**/test/**"] # executor rules skip these
217
+ external_topics = ["/scan"] # provided outside this workspace
218
+ fail_on = "error"
219
+ distro = "jazzy" # enables the knowledge pack without a sourced shell
220
+ online = false # allow --online lookups by default
221
+ # searxng_url = "https://searx.example.org"
222
+
223
+ [rules]
224
+ P003 = "off"
225
+ Q004 = "warning"
226
+ ```
227
+
228
+ Unknown keys and rule IDs are errors, not silently ignored. Suppress one finding with a
229
+ comment on the same or previous line: `# rosfix: ignore[P003]` (also `//` and `<!-- -->`).
230
+ Adopt rosfix on an existing codebase with `--write-baseline rosfix-baseline.json` once and
231
+ `--baseline rosfix-baseline.json` afterwards: only new findings are reported.
232
+
233
+ ### GitHub Actions
234
+
235
+ See [`.github/workflows/ros2-safety-lint-template.yml`](.github/workflows/ros2-safety-lint-template.yml).
236
+
237
+ ## Evaluation
238
+
239
+ All numbers below were measured on 24 November 2026 with the current code, on shallow clones of
240
+ the repositories' default branches (Windows 11, release build, one thread; median of three runs
241
+ after one warm-up, peak working set). Raw outputs and the exact repository revisions are in
242
+ [`paper/data/`](paper/data).
243
+
244
+ | Repository | Files parsed | Wall time | Peak RAM | Findings |
245
+ |---|---:|---:|---:|---|
246
+ | ros2/demos | 145 | 0.15 s | 18 MB | E002 ×2, L002 ×8 |
247
+ | ros2/sros2 | 20 | 0.03 s | 11 MB | none |
248
+ | ROBOTIS-GIT/turtlebot3 | 63 | 0.07 s | 16 MB | E002 ×2, L002 ×8 |
249
+ | ros-controls/ros2_control | 124 | 0.60 s | 25 MB | none |
250
+ | ros-navigation/navigation2 | 778 | 2.08 s | 51 MB | L002 ×49, S002 ×9, A002 ×2, N009, P005, T003 |
251
+
252
+ The L002 findings are missing `package.xml` dependencies (e.g. `turtlebot3_bringup` starts
253
+ `rclcpp_components`, `camera_ros` and `image_view` without declaring them); E002 are sleeps
254
+ inside executor callbacks; S002 flags nodes in Nav2 example launch files that run beside a
255
+ simulator without `use_sim_time` (low impact, but accurate).
256
+
257
+ **Mutation benchmark** (`rosfix-bench`, in `crates/ros2-safety-mutate`): realistic
258
+ misconfigurations are injected one at a time, in memory, at real sites found in 12 repositories
259
+ (PX4-Autopilot, autoware, moveit2, navigation2, rmf_ros2, ros2_control, rmw_fastrtps, demos,
260
+ system_tests, turtlebot3, sros2, rmw_cyclonedds; at most 20 sites per operator and repository).
261
+ A mutation counts as detected only if the expected rule fires at the mutated line.
262
+
263
+ | Mutation | Injected | Detected |
264
+ |---|---:|---:|
265
+ | `ros__parameters` misspelled (P002) | 50 | 50 |
266
+ | Nav2 plugin type typo (N002) | 40 | 40 |
267
+ | executable name typo in a launch file (L001) | 28 | 28 |
268
+ | parameter key typo (P003) | 20 | 20 |
269
+ | runtime dependency removed from package.xml (L002) | 16 | 16 |
270
+ | double written as integer (P004) | 4 | 4 |
271
+ | parameter key abbreviated (P003) | 3 | 3 |
272
+ | **total** | **161** | **161** |
273
+
274
+ These numbers measure the checks on synthetic, single-fault mutations designed alongside
275
+ the tool; they are not a recall estimate for bugs in the wild. The executor, QoS,
276
+ ros2_control and topic agents are covered by unit tests but had no mutation sites in this
277
+ corpus.
278
+
279
+ **Hand review of the other findings on the 12 repositories.** P003: the 3 in rmf_ros2 are real
280
+ (undeclared `subns`, `verbose`, `run_composition_command`). O001/O002: all 31 ROS 1 leftovers are
281
+ accurate; the 20 moveit2 sources with `ros/ros.h`/`rospy` are in no CMake target (dead code).
282
+ U002: MoveIt's PRBT test robot really gives `prbt_flange` (revolute joint) zero inertia.
283
+
284
+ The full evaluation (precision on a hand-labelled sample, cross-file drift, incremental
285
+ re-analysis, fix verification on real repositories) is in the [paper](paper/rosfix.tex).
286
+
287
+ ## Milestones
288
+
289
+ Each milestone is also described, with its measurements, in the [paper](paper/rosfix.tex).
290
+
291
+ **25 November 2026**
292
+ - **Assist tiers: runtime and trainer** ([`crates/rosfix-model`](crates/rosfix-model)). An int8
293
+ transformer that scores the same closed candidate set as the built-in ranker, with the rule
294
+ and the surrounding source as extra input, and gives bit-identical scores on every machine.
295
+ `--model` selects it; only checksum-verified released files load. No tier is trained yet.
296
+ - **Training is bit-identical across operating systems.** Weight initialisation used the
297
+ platform's `ln`/`cos`, so one seed trained different models on Linux, Windows and macOS (CI
298
+ caught int8 export changing 34 of 300 decisions on Linux). It now uses exact operations only;
299
+ 300/300 decisions survive int8 export on all three.
300
+ - **CI green on Linux, Windows and macOS**, with `cargo fmt` and `clippy -D warnings` enforced
301
+ and the minimum Rust version raised to 1.88 (what the dependencies require).
302
+ - **Field study re-run on 826 rosdistro Jazzy repositories**, at the same commits as on 20
303
+ November ([`research/data/s2_rerun_2026-11-25_fix.md`](research/data/s2_rerun_2026-11-25_fix.md)).
304
+ Findings went from 3,307 to 4,295, mostly from rules added since (L009 292, O002 96, N008 82,
305
+ O001 55, U002 53) and 373 more L002 for launch files that import `launch_ros` without
306
+ declaring it. A hand check of about 40 new findings found them correct, except U004 firing on
307
+ URDF test fixtures that are broken on purpose. The re-run exposed one regression, now fixed:
308
+ `if=`/`unless=` were not evaluated, so a confirmed S001 in rmf_demos was lost. rosfix now
309
+ evaluates conditions with the arguments the launch graph passes, and no confirmed true
310
+ positive is lost.
311
+
312
+ **24 November 2026**
313
+ - **93 rules in 18 agents**, including the new A003 (duplicate node name), F005 (tf cycle),
314
+ L011 (`install()` of a missing path) and L012 (Python subpackage not installed).
315
+ - **Knowledge packs rebuilt** from the Humble, Jazzy and Kilted branches. Two defects fixed:
316
+ system-default QoS endpoints are now *unknown* (4, 6 and 8 endpoints were treated as the ROS
317
+ default), and Nav2 AMCL's `add_parameter` declarations are now extracted (0/7/8 parameters
318
+ became 45/53/54). Before, every AMCL parameter was reported as undeclared when Nav2 was
319
+ installed from binaries.
320
+ - **Fewer false positives for undeclared parameters (P003): 46 → 3** on the 12 benchmark
321
+ repositories. Parameter libraries generated in CMake subdirectories and in workspace
322
+ dependencies (MoveIt's smoothing filters) now count as declarations. The 3 that remain are
323
+ real.
324
+ - **Fix ranker retrained and evaluated honestly**: held-out cases must come from unseen packages
325
+ *and* unseen names, over 5 folds. Shipped model: 69.5% correct vs. 54.1% lexical, 7 wrong
326
+ picks vs. 30.
327
+ - **Mutation benchmark 161/161** on 12 repositories at current revisions, and a hand review of
328
+ every finding of the new rules on them (all accurate).
329
+ - **Published on Hugging Face** (ranker and knowledge packs); tagged releases update both.
330
+
331
+ ## Hugging Face
332
+
333
+ | Repository | Content |
334
+ |---|---|
335
+ | [SohamW11/rosfix-assist](https://huggingface.co/SohamW11/rosfix-assist) | The fix ranker: weights, inference code excerpt, model card with held-out results |
336
+ | [datasets/SohamW11/rosfix-knowledge-packs](https://huggingface.co/datasets/SohamW11/rosfix-knowledge-packs) | The knowledge packs (Humble, Jazzy, Kilted) and rosdep key lists, with the scripts that rebuild them |
337
+
338
+ Both are updated by the release workflow on every tagged release (when the repository has an
339
+ `HF_TOKEN` secret), or by hand with `HF_USER=SohamW11 scripts/publish_hf.sh`.
340
+
341
+ ## Project layout
342
+
343
+ - `crates/ros2-safety-lint` — the `rosfix` library and CLI; `packs/` holds the embedded
344
+ knowledge packs and rosdep keys.
345
+ - `crates/ros2-safety-mutate` — `rosfix-bench` (mutation benchmark), `rosfix-train` (fix
346
+ ranker), `rosfix-pack` (knowledge-pack builder), `rosfix-history` (replays real fix commits).
347
+ - `crates/rosfix-model` — runtime and trainer for the optional assist tiers (`--model`), and
348
+ `rosfix-model-bench` for their timings.
349
+ - `scripts/` — `build_packs.sh`, `build_rosdep_keys.py`, `publish_hf.sh`.
350
+ - `paper/` — the paper and the raw data behind its numbers.
351
+ - `CONTRIBUTING.md` — architecture and how to add a rule.
352
+
353
+ ## Citation
354
+
355
+ If you use rosfix in research, please cite:
356
+
357
+ ```bibtex
358
+ @misc{walam2026rosfix,
359
+ title = {Cross-Language Static Analysis for {ROS} 2: Detecting Shadow Configuration Drift},
360
+ author = {Walam, Soham Kishor},
361
+ year = {2026},
362
+ note = {rosfix, \url{https://github.com/SohamWalam11/ros2-safety-lint}}
363
+ }
364
+ ```
365
+
366
+ ## License
367
+
368
+ Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT License](LICENSE-MIT) at your option.
369
+
@@ -0,0 +1,13 @@
1
+ rosfix/__init__.py,sha256=DLCAeR1xZ22BR1ugnLsV4TiZzyj71uzETPB13Es0UzY,1143
2
+ rosfix/__main__.py,sha256=zYm_V3O6cJW_YTyAzgWj5T61XvKiPIL2tKtL_Dv9VSI,415
3
+ rosfix/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ rosfix/ros2cli.py,sha256=r_CQDPBh1GD_tf1lBJ0Oq8UmvNnmaqD7jKFWdRWOo7Q,1048
5
+ rosfix/ros2doctor.py,sha256=9TeU61VKZnr-SaTtCltDBe6PYXv0HP6xa9MWBCljfFU,2425
6
+ rosfix-0.2.3.data/scripts/rosfix.exe,sha256=kyGcHqIs8-QonK-5ItDevrh1zhlpwD5V3hfS5Uk4j20,17845248
7
+ rosfix-0.2.3.dist-info/METADATA,sha256=Na1HavUacl2pp2wwCYOHN63vSfyu3FK3Ne3Wqp6v9b4,23008
8
+ rosfix-0.2.3.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
9
+ rosfix-0.2.3.dist-info/entry_points.txt,sha256=JkODE8n4I1-cN4UEritXW0sENWSsDahXq3OVCxPJLIk,224
10
+ rosfix-0.2.3.dist-info/licenses/LICENSE-APACHE,sha256=ZziL0-Mcaf4pq6jnSbFXVMSEcd3BOO2ucLUzEULT5js,1296
11
+ rosfix-0.2.3.dist-info/licenses/LICENSE-MIT,sha256=1Ptd2yRRxYpU-WTZ_3blxrwwPzS4i3ykCzVrdfRGrTU,1096
12
+ rosfix-0.2.3.dist-info/sboms/rosfix.cyclonedx.json,sha256=0KVC-GsMhF_u7ZU9uW1jYgNZKxqSyNwzKF6nfuNXgmU,148985
13
+ rosfix-0.2.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.16.0)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-win_amd64
@@ -0,0 +1,6 @@
1
+ [ros2cli.command]
2
+ rosfix=rosfix.ros2cli:RosfixCommand
3
+ [ros2doctor.checks]
4
+ RosfixEnvironmentCheck=rosfix.ros2doctor:RosfixEnvironmentCheck
5
+ [ros2doctor.report]
6
+ RosfixEnvironmentReport=rosfix.ros2doctor:RosfixEnvironmentReport
@@ -0,0 +1,30 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+ "License" shall mean the terms and conditions for use, reproduction, and
9
+ distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the
12
+ copyright owner that is granting the License.
13
+
14
+ 2. Grant of Copyright License.
15
+ Subject to the terms and conditions of this License, each Contributor hereby
16
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
17
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
18
+ publicly display, publicly perform, sublicense, and distribute the Work and
19
+ such Derivative Works in Source or Object form.
20
+
21
+ Copyright 2026 Soham Kishor Walam
22
+
23
+ Licensed under the Apache License, Version 2.0 (the "License");
24
+ you may not use this file except in compliance with the License.
25
+ You may obtain a copy of the License at
26
+
27
+ http://www.apache.org/licenses/LICENSE-2.0
28
+
29
+ Unless required by applicable law or agreed to in writing, bows or conditions
30
+ of any kind, either express or implied.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Soham Kishor Walam
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.