backplane-tracecheck 0.2.0__tar.gz

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.
Files changed (51) hide show
  1. backplane_tracecheck-0.2.0/.gitignore +33 -0
  2. backplane_tracecheck-0.2.0/CHANGELOG.md +47 -0
  3. backplane_tracecheck-0.2.0/LICENSE +202 -0
  4. backplane_tracecheck-0.2.0/NOTICE +5 -0
  5. backplane_tracecheck-0.2.0/PKG-INFO +167 -0
  6. backplane_tracecheck-0.2.0/README.md +136 -0
  7. backplane_tracecheck-0.2.0/docs/CONTRACT_REFERENCE.md +48 -0
  8. backplane_tracecheck-0.2.0/docs/THIRD_PARTY_NOTICES.md +50 -0
  9. backplane_tracecheck-0.2.0/docs/licenses/lz4-LICENSE.txt +28 -0
  10. backplane_tracecheck-0.2.0/docs/licenses/zstandard-LICENSE.txt +27 -0
  11. backplane_tracecheck-0.2.0/examples/clean-lz4.mcap +0 -0
  12. backplane_tracecheck-0.2.0/examples/clean-zstd.mcap +0 -0
  13. backplane_tracecheck-0.2.0/examples/clean.mcap +0 -0
  14. backplane_tracecheck-0.2.0/examples/demo-contract.json +32 -0
  15. backplane_tracecheck-0.2.0/examples/expected.json +260 -0
  16. backplane_tracecheck-0.2.0/examples/faults.mcap +0 -0
  17. backplane_tracecheck-0.2.0/examples/fleet-contract.json +47 -0
  18. backplane_tracecheck-0.2.0/examples/fleet-dropout-lz4.mcap +0 -0
  19. backplane_tracecheck-0.2.0/examples/fleet-zstd.mcap +0 -0
  20. backplane_tracecheck-0.2.0/examples/malformed.mcap +0 -0
  21. backplane_tracecheck-0.2.0/examples/no-crc.mcap +0 -0
  22. backplane_tracecheck-0.2.0/examples/truncated.mcap +0 -0
  23. backplane_tracecheck-0.2.0/examples/unchunked.mcap +0 -0
  24. backplane_tracecheck-0.2.0/examples/unsupported-codec.mcap +0 -0
  25. backplane_tracecheck-0.2.0/pyproject.toml +60 -0
  26. backplane_tracecheck-0.2.0/src/tracecheck/__init__.py +1 -0
  27. backplane_tracecheck-0.2.0/src/tracecheck/__main__.py +131 -0
  28. backplane_tracecheck-0.2.0/src/tracecheck/contract.py +92 -0
  29. backplane_tracecheck-0.2.0/src/tracecheck/engine.py +310 -0
  30. backplane_tracecheck-0.2.0/src/tracecheck/reader.py +735 -0
  31. backplane_tracecheck-0.2.0/src/tracecheck/report.py +14 -0
  32. backplane_tracecheck-0.2.0/src/tracecheck/samples.py +103 -0
  33. backplane_tracecheck-0.2.0/src/tracecheck/server.py +158 -0
  34. backplane_tracecheck-0.2.0/src/tracecheck/ui.html +21 -0
  35. backplane_tracecheck-0.2.0/tests/test_checker.py +277 -0
  36. backplane_tracecheck-0.2.0/tests/test_streaming.py +251 -0
  37. backplane_tracecheck-0.2.0/web/src/app.css +201 -0
  38. backplane_tracecheck-0.2.0/web/src/app.js +372 -0
  39. backplane_tracecheck-0.2.0/web/src/chrome.js +138 -0
  40. backplane_tracecheck-0.2.0/web/src/engine/contract.js +112 -0
  41. backplane_tracecheck-0.2.0/web/src/engine/crc32.js +34 -0
  42. backplane_tracecheck-0.2.0/web/src/engine/engine.js +232 -0
  43. backplane_tracecheck-0.2.0/web/src/engine/json.js +202 -0
  44. backplane_tracecheck-0.2.0/web/src/engine/lz4.js +101 -0
  45. backplane_tracecheck-0.2.0/web/src/engine/reader.js +630 -0
  46. backplane_tracecheck-0.2.0/web/src/engine/report.js +30 -0
  47. backplane_tracecheck-0.2.0/web/src/engine/vendor/fzstd.js +808 -0
  48. backplane_tracecheck-0.2.0/web/src/engine/worker.js +34 -0
  49. backplane_tracecheck-0.2.0/web/src/landing.css +167 -0
  50. backplane_tracecheck-0.2.0/web/src/main.js +42 -0
  51. backplane_tracecheck-0.2.0/web/src/style.css +229 -0
@@ -0,0 +1,33 @@
1
+ # Local-only material (old reports, governance files, MVP evidence). Never committed.
2
+ archive/
3
+
4
+ # Python
5
+ .venv/
6
+ venv/
7
+ __pycache__/
8
+ *.py[cod]
9
+ *.egg-info/
10
+ build/
11
+ dist/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ .coverage
15
+ htmlcov/
16
+
17
+ # Tracecheck output
18
+ reports/
19
+ *.report.json
20
+ *.report.html
21
+
22
+ # Web
23
+ node_modules/
24
+ web/dist/
25
+ .firebase/
26
+ .wrangler/
27
+
28
+ # OS / editors
29
+ .DS_Store
30
+ Thumbs.db
31
+ desktop.ini
32
+ .vscode/
33
+ .idea/
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0] - 2026-10-14
10
+
11
+ ### Added
12
+ - **Compressed chunks.** zstd and lz4 chunks are decoded, with output strictly capped at the declared uncompressed size, so decompression bombs fail safely.
13
+ - **Streaming reader** (`tracecheck.reader`): a self-contained, bounded MCAP parser. SHA-256 and CRCs are computed in a single pass, and memory is bounded by explicit limits. The 64 MiB file-size cap is gone.
14
+ - **Fast mode** (`--fast`): reads only the summary section for an instant inventory, counts, schemas and metadata check. It falls back to a full scan when the summary is missing or incomplete.
15
+ - **`missing_crc` contract key** (`"warn"` or `"ignore"`) and the `--ignore-missing-crc` flag.
16
+ - Summary-section CRC verification.
17
+ - CLI flags: `--fail-on`, `--timeout`, `--max-chunk-mib`, `--max-record-mib`, `--max-tracked-messages`, `--quiet`, `--version`, and `samples --dest`.
18
+ - Report fields (`report_version` 2): `scan_mode`, `fast_mode_fallback`, `compression`, `scan_stats`, `checksum_coverage`.
19
+ - More synthetic examples: zstd, lz4, unchunked, no-CRC, unsupported-codec, malformed and truncated files, plus a 4-topic mobile-robot recording with and without a sensor dropout. `examples/expected.json` holds the golden results shared by the Python and browser test suites.
20
+ - **Web app** (`web/`): a browser-only static site for backplanerobotics.com with the Tracecheck app.
21
+ - A JavaScript port of the engine running in a Web Worker. Files never leave the browser.
22
+ - Handles multi-GB files and zstd/lz4 chunks.
23
+ - Demo recordings, a contract editor, and JSON/HTML report downloads.
24
+ - Reports are byte-identical to the Python CLI's, apart from timestamps and tool fields.
25
+ - A strict Content-Security-Policy.
26
+
27
+ ### Changed
28
+ - Renamed the project from "Recording Health Checker" to **Backplane Tracecheck**.
29
+ - The Python package `rhc` is now `tracecheck`.
30
+ - The PyPI distribution is `backplane-tracecheck`.
31
+ - The CLI command is `tracecheck`.
32
+ - `tracecheck check` runs in-process, with no subprocess and no size cap. The local `serve` UI keeps its 64 MiB upload limit.
33
+ - **Missing-CRC rule.** C01 now warns only when some message data has no CRC coverage. Default ROS 2 files, which have chunk CRCs but no data-section CRC, now pass.
34
+ - Packaged with `pyproject.toml` (hatchling), replacing `requirements*.txt` and the Windows `.cmd` launchers.
35
+ - Relicensed as Apache-2.0 open source.
36
+
37
+ ### Fixed
38
+ - The local server no longer returns stderr text or the user's home path in error responses.
39
+ - The local server now requires a matching `Origin` header on POST requests.
40
+
41
+ ### Removed
42
+ - MVP governance, evidence, QA and marketing files were moved out of the repository into a local archive.
43
+
44
+ ## [0.1.0] - 2026-10-13
45
+
46
+ ### Added
47
+ - Initial MVP: CLI and local browser UI, 10 contract checks, JSON and HTML reports, and synthetic examples.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Backplane Tracecheck
2
+ Copyright 2026 Backplane Robotics LLC
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+ Third-party components and their licenses are listed in docs/THIRD_PARTY_NOTICES.md.
@@ -0,0 +1,167 @@
1
+ Metadata-Version: 2.5
2
+ Name: backplane-tracecheck
3
+ Version: 0.2.0
4
+ Summary: Check robot recordings (MCAP) against an explicit, versioned recording contract.
5
+ Project-URL: Homepage, https://backplanerobotics.com
6
+ Project-URL: Source, https://github.com/backplane-robotics/backplane-tracecheck
7
+ Project-URL: Issues, https://github.com/backplane-robotics/backplane-tracecheck/issues
8
+ Project-URL: Changelog, https://github.com/backplane-robotics/backplane-tracecheck/blob/main/CHANGELOG.md
9
+ Author: Backplane Robotics LLC
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: data-quality,mcap,recording,robotics,ros2,rosbag
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Scientific/Engineering
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: lz4>=4.3
24
+ Requires-Dist: mcap<2,>=1.5
25
+ Requires-Dist: zstandard>=0.22
26
+ Provides-Extra: dev
27
+ Requires-Dist: build>=1.2; extra == 'dev'
28
+ Requires-Dist: pytest>=8; extra == 'dev'
29
+ Requires-Dist: ruff>=0.6; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Backplane Tracecheck
33
+
34
+ **Check robot recordings against an explicit recording contract.**
35
+
36
+ Tracecheck reads an [MCAP](https://mcap.dev) recording (the default ROS 2 bag format) and checks it against a small JSON *recording contract*: which topics must be present, their schemas and encodings, message counts, rates, timestamp gaps, regressions, sequence continuity and time coverage. It produces a JSON report and a readable HTML report. Each finding points to an exact byte offset in the file.
37
+
38
+ - Free and open source (Apache-2.0).
39
+ - Read-only. Message payloads are never decoded or executed.
40
+ - No robot, ROS install, account or cloud service needed.
41
+ - Streams files of any size. Handles zstd and lz4 chunks safely.
42
+ - Runs as a Python CLI or entirely in your browser at **[backplanerobotics.com/tracecheck](https://backplanerobotics.com/tracecheck/)**, where files never leave your device.
43
+
44
+ Built by [Backplane Robotics](https://backplanerobotics.com).
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ pip install backplane-tracecheck
50
+ ```
51
+
52
+ Requires Python 3.11+.
53
+
54
+ ## Quick start
55
+
56
+ ```bash
57
+ # Write the synthetic demo recordings and contract to ./examples
58
+ tracecheck samples
59
+
60
+ tracecheck validate-contract examples/demo-contract.json
61
+ tracecheck check examples/clean.mcap --contract examples/demo-contract.json --out reports/clean
62
+ tracecheck check examples/faults.mcap --contract examples/demo-contract.json --out reports/faults
63
+
64
+ # Optional local browser UI (binds to 127.0.0.1 only)
65
+ tracecheck serve --open
66
+ ```
67
+
68
+ `--out` must be a new directory. Existing reports are never overwritten.
69
+
70
+ **Useful options**
71
+
72
+ | Option | Effect |
73
+ |---|---|
74
+ | `--fast` | Read only the summary section: inventory, counts, schemas and metadata in milliseconds. Timing checks (C06–C10) skip. Falls back to a full scan if the file has no usable summary. |
75
+ | `--ignore-missing-crc` | Don't warn when the writer stored no CRCs (same as `"missing_crc": "ignore"` in the contract). Corrupt CRCs still fail. |
76
+ | `--fail-on fail` | Exit 0 on warnings, exit 1 only on failures (the default `warn` also exits 1 on warnings). |
77
+ | `--timeout SECONDS` | Stop a scan that takes too long. |
78
+ | `--max-chunk-mib`, `--max-record-mib`, `--max-tracked-messages` | Raise or lower the memory safety limits (defaults: 256, 256, 20,000,000). |
79
+
80
+ **Exit codes**
81
+ - `0`: overall pass.
82
+ - `1`: contract failures, warnings or an incomplete scan (all recorded in the report).
83
+ - `2`: configuration, input or operational error. No report is written.
84
+
85
+ ## In the browser
86
+
87
+ [backplanerobotics.com/tracecheck](https://backplanerobotics.com/tracecheck/) runs the same checks in a Web Worker, using a JavaScript port of the engine in [`web/src/engine/`](https://github.com/backplane-robotics/backplane-tracecheck/tree/main/web/src/engine).
88
+ - The file is read locally in slices and never uploaded.
89
+ - The site's Content-Security-Policy blocks connections to any other origin.
90
+ - For the same inputs, the browser and CLI produce identical JSON reports, apart from timestamps and tool fields. The web test suite checks this.
91
+
92
+ ## A minimal contract
93
+
94
+ ```json
95
+ {
96
+ "version": 1,
97
+ "name": "My recording requirements",
98
+ "topics": {
99
+ "/my/topic": { "required": true, "min_count": 1 }
100
+ }
101
+ }
102
+ ```
103
+
104
+ Start minimal, then read the report's channel inventory to see the actual schema names, encodings and fingerprints. Add only the requirements you can justify. See [docs/CONTRACT_REFERENCE.md](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/docs/CONTRACT_REFERENCE.md) for every key.
105
+
106
+ ## The ten checks
107
+
108
+ | ID | Check |
109
+ |---|---|
110
+ | C01 | Readable bounded MCAP scan (with CRC verification where present) |
111
+ | C02 | Required topics contain messages |
112
+ | C03 | Profile, schema and encoding |
113
+ | C04 | Required file metadata |
114
+ | C05 | Message counts |
115
+ | C06 | Average recorded rate |
116
+ | C07 | Sorted timestamp gaps |
117
+ | C08 | Record-order timestamp regressions |
118
+ | C09 | Sequence continuity |
119
+ | C10 | Expected interval coverage |
120
+
121
+ **Statuses**
122
+ - **PASS:** the configured requirement was met.
123
+ - **WARN:** a scoped limitation, for example message data with no CRC coverage. Default ROS 2 files with chunk CRCs pass.
124
+ - **FAIL:** an unmet requirement or a failed scan. It does not mean the robot is unsafe.
125
+ - **SKIPPED:** no conclusion was reached.
126
+
127
+ Tracecheck does not certify safety, establish regulatory compliance, determine causality or measure transport latency.
128
+
129
+ ## Development
130
+
131
+ ```bash
132
+ python -m venv .venv
133
+ .venv/Scripts/activate # Windows; use `source .venv/bin/activate` elsewhere
134
+ pip install -e ".[dev]"
135
+ python -m pytest
136
+ ```
137
+
138
+ After an intentional behaviour change, regenerate the golden results shared by both test suites and review the diff:
139
+
140
+ ```bash
141
+ tracecheck samples && python tools/make_golden.py
142
+ ```
143
+
144
+ **Website** (Node 20+):
145
+
146
+ ```bash
147
+ cd web
148
+ npm install
149
+ npm test # engine parity tests against examples/ and the Python engine
150
+ npm run dev # local dev server
151
+ npm run build # static site in web/dist (deploy to Cloudflare Pages)
152
+ ```
153
+
154
+ ## Repository layout
155
+
156
+ | Path | Contents |
157
+ |---|---|
158
+ | `src/tracecheck/` | Python package and CLI |
159
+ | `tests/` | Engine, streaming, contract, CLI and local-server tests |
160
+ | `examples/` | Synthetic MCAP recordings, contracts and golden results (invented data) |
161
+ | `docs/` | Contract reference and third-party notices |
162
+ | `tools/` | Maintenance scripts (golden-result generator) |
163
+ | `web/` | Browser-only website and Tracecheck web app for backplanerobotics.com |
164
+
165
+ ## License
166
+
167
+ Apache-2.0. See [LICENSE](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/LICENSE) and [NOTICE](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/NOTICE). Copyright 2026 Backplane Robotics LLC.
@@ -0,0 +1,136 @@
1
+ # Backplane Tracecheck
2
+
3
+ **Check robot recordings against an explicit recording contract.**
4
+
5
+ Tracecheck reads an [MCAP](https://mcap.dev) recording (the default ROS 2 bag format) and checks it against a small JSON *recording contract*: which topics must be present, their schemas and encodings, message counts, rates, timestamp gaps, regressions, sequence continuity and time coverage. It produces a JSON report and a readable HTML report. Each finding points to an exact byte offset in the file.
6
+
7
+ - Free and open source (Apache-2.0).
8
+ - Read-only. Message payloads are never decoded or executed.
9
+ - No robot, ROS install, account or cloud service needed.
10
+ - Streams files of any size. Handles zstd and lz4 chunks safely.
11
+ - Runs as a Python CLI or entirely in your browser at **[backplanerobotics.com/tracecheck](https://backplanerobotics.com/tracecheck/)**, where files never leave your device.
12
+
13
+ Built by [Backplane Robotics](https://backplanerobotics.com).
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install backplane-tracecheck
19
+ ```
20
+
21
+ Requires Python 3.11+.
22
+
23
+ ## Quick start
24
+
25
+ ```bash
26
+ # Write the synthetic demo recordings and contract to ./examples
27
+ tracecheck samples
28
+
29
+ tracecheck validate-contract examples/demo-contract.json
30
+ tracecheck check examples/clean.mcap --contract examples/demo-contract.json --out reports/clean
31
+ tracecheck check examples/faults.mcap --contract examples/demo-contract.json --out reports/faults
32
+
33
+ # Optional local browser UI (binds to 127.0.0.1 only)
34
+ tracecheck serve --open
35
+ ```
36
+
37
+ `--out` must be a new directory. Existing reports are never overwritten.
38
+
39
+ **Useful options**
40
+
41
+ | Option | Effect |
42
+ |---|---|
43
+ | `--fast` | Read only the summary section: inventory, counts, schemas and metadata in milliseconds. Timing checks (C06–C10) skip. Falls back to a full scan if the file has no usable summary. |
44
+ | `--ignore-missing-crc` | Don't warn when the writer stored no CRCs (same as `"missing_crc": "ignore"` in the contract). Corrupt CRCs still fail. |
45
+ | `--fail-on fail` | Exit 0 on warnings, exit 1 only on failures (the default `warn` also exits 1 on warnings). |
46
+ | `--timeout SECONDS` | Stop a scan that takes too long. |
47
+ | `--max-chunk-mib`, `--max-record-mib`, `--max-tracked-messages` | Raise or lower the memory safety limits (defaults: 256, 256, 20,000,000). |
48
+
49
+ **Exit codes**
50
+ - `0`: overall pass.
51
+ - `1`: contract failures, warnings or an incomplete scan (all recorded in the report).
52
+ - `2`: configuration, input or operational error. No report is written.
53
+
54
+ ## In the browser
55
+
56
+ [backplanerobotics.com/tracecheck](https://backplanerobotics.com/tracecheck/) runs the same checks in a Web Worker, using a JavaScript port of the engine in [`web/src/engine/`](https://github.com/backplane-robotics/backplane-tracecheck/tree/main/web/src/engine).
57
+ - The file is read locally in slices and never uploaded.
58
+ - The site's Content-Security-Policy blocks connections to any other origin.
59
+ - For the same inputs, the browser and CLI produce identical JSON reports, apart from timestamps and tool fields. The web test suite checks this.
60
+
61
+ ## A minimal contract
62
+
63
+ ```json
64
+ {
65
+ "version": 1,
66
+ "name": "My recording requirements",
67
+ "topics": {
68
+ "/my/topic": { "required": true, "min_count": 1 }
69
+ }
70
+ }
71
+ ```
72
+
73
+ Start minimal, then read the report's channel inventory to see the actual schema names, encodings and fingerprints. Add only the requirements you can justify. See [docs/CONTRACT_REFERENCE.md](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/docs/CONTRACT_REFERENCE.md) for every key.
74
+
75
+ ## The ten checks
76
+
77
+ | ID | Check |
78
+ |---|---|
79
+ | C01 | Readable bounded MCAP scan (with CRC verification where present) |
80
+ | C02 | Required topics contain messages |
81
+ | C03 | Profile, schema and encoding |
82
+ | C04 | Required file metadata |
83
+ | C05 | Message counts |
84
+ | C06 | Average recorded rate |
85
+ | C07 | Sorted timestamp gaps |
86
+ | C08 | Record-order timestamp regressions |
87
+ | C09 | Sequence continuity |
88
+ | C10 | Expected interval coverage |
89
+
90
+ **Statuses**
91
+ - **PASS:** the configured requirement was met.
92
+ - **WARN:** a scoped limitation, for example message data with no CRC coverage. Default ROS 2 files with chunk CRCs pass.
93
+ - **FAIL:** an unmet requirement or a failed scan. It does not mean the robot is unsafe.
94
+ - **SKIPPED:** no conclusion was reached.
95
+
96
+ Tracecheck does not certify safety, establish regulatory compliance, determine causality or measure transport latency.
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ python -m venv .venv
102
+ .venv/Scripts/activate # Windows; use `source .venv/bin/activate` elsewhere
103
+ pip install -e ".[dev]"
104
+ python -m pytest
105
+ ```
106
+
107
+ After an intentional behaviour change, regenerate the golden results shared by both test suites and review the diff:
108
+
109
+ ```bash
110
+ tracecheck samples && python tools/make_golden.py
111
+ ```
112
+
113
+ **Website** (Node 20+):
114
+
115
+ ```bash
116
+ cd web
117
+ npm install
118
+ npm test # engine parity tests against examples/ and the Python engine
119
+ npm run dev # local dev server
120
+ npm run build # static site in web/dist (deploy to Cloudflare Pages)
121
+ ```
122
+
123
+ ## Repository layout
124
+
125
+ | Path | Contents |
126
+ |---|---|
127
+ | `src/tracecheck/` | Python package and CLI |
128
+ | `tests/` | Engine, streaming, contract, CLI and local-server tests |
129
+ | `examples/` | Synthetic MCAP recordings, contracts and golden results (invented data) |
130
+ | `docs/` | Contract reference and third-party notices |
131
+ | `tools/` | Maintenance scripts (golden-result generator) |
132
+ | `web/` | Browser-only website and Tracecheck web app for backplanerobotics.com |
133
+
134
+ ## License
135
+
136
+ Apache-2.0. See [LICENSE](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/LICENSE) and [NOTICE](https://github.com/backplane-robotics/backplane-tracecheck/blob/main/NOTICE). Copyright 2026 Backplane Robotics LLC.
@@ -0,0 +1,48 @@
1
+ # Contract reference · version 1
2
+
3
+ Contracts are UTF-8 JSON objects up to 64 KiB. Keys are case-sensitive; duplicate and unknown keys are rejected. All time values are integer **nanoseconds**, not seconds or formatted dates. Numbers must be finite, nonnegative and no greater than 2^64−1. Booleans do not count as numbers. Names/keys must be 1–256 characters, except the optional profile may be empty.
4
+
5
+ ## Top-level keys
6
+
7
+ | Key | Meaning |
8
+ |---|---|
9
+ | `version` | Required integer `1`. |
10
+ | `name` | Required human-readable contract name. |
11
+ | `profile` | Optional exact MCAP Header profile string; empty is valid. |
12
+ | `missing_crc` | Optional `"warn"` (default) or `"ignore"`. Controls whether C01 warns when some message data has no CRC coverage (see *Scan and checksums* below). Corrupt CRCs always fail, whatever this setting. The CLI flag `--ignore-missing-crc` and the web app toggle set it to `"ignore"`. |
13
+ | `metadata` | Optional object: metadata-record name → required key → exact string or `null` for present/nonempty. Multiple records with the same name must all satisfy each requested key. No payload fields or Channel metadata are searched. |
14
+ | `topics` | Required object with 1–50 exact topic names, each mapping to the options below. No glob or regex matching. |
15
+
16
+ ## Topic options
17
+
18
+ | Key | Type / behavior |
19
+ |---|---|
20
+ | `required` | Boolean, default true: at least one Message on any channel with this topic. Channel registration alone is insufficient. |
21
+ | `message_encoding` | Optional exact Channel encoding, e.g. `json` or `cdr`. Does not decode or validate payloads. |
22
+ | `schema_name`, `schema_encoding` | Optional exact Schema identity fields. A legal schema-id-zero channel fails these expectations if specified. |
23
+ | `schema_sha256` | Optional 64 lowercase hex characters; exact Schema byte fingerprint. Whitespace/schema serialization changes affect it. |
24
+ | `min_count`, `max_count` | Optional inclusive integer bounds, applied independently to every matching channel. |
25
+ | `time_basis` | `log_time` (default) or `publish_time`. These are MCAP Message fields, not decoded ROS header stamps. |
26
+ | `clock_confirmed` | Boolean, default false. All four timing checks skip unless true. User asserts the clock is interpretable for this requirement. |
27
+ | `min_rate_hz`, `max_rate_hz` | Optional inclusive bounds for observed average `(N−1)/(last−first)` after sorting. Not windowed rate or proof of session completeness. Use interval/gap checks too. |
28
+ | `max_gap_ns` | Optional inclusive upper limit between adjacent **sorted** timestamps. Does not include leading/trailing gaps. |
29
+ | `check_regression` | Boolean, default false. Strict decreases in **physical record order** fail; equal timestamps pass. |
30
+ | `sequence` | `disabled` (default) or `increment_mod32`. The latter asserts one unit-incrementing sequence source per channel, allowing wrap from 2^32−1 to 0; resets, duplicates and jumps fail. |
31
+ | `interval_ns` | Optional inclusive `[start,end]`, with start < end, on the selected clock. All recorded timestamps must be inside; first and last must reach the respective boundaries within tolerance. |
32
+ | `boundary_tolerance_ns` | Nonnegative integer, default 0; at most half the interval length. |
33
+
34
+ Omit rate/gap/interval/sequence requirements if their assumptions are unavailable. A timestamp of zero is legal, including robot boot time. `publish_time == log_time` may indicate unavailable publication time; it is not evidence of zero latency. No cross-clock subtraction or sensor synchronization diagnosis is performed.
35
+
36
+ Multiple channels sharing a topic remain separate. A required topic can be present while one of its channels fails its count/encoding/timing requirement. This conservative behavior can produce findings for a zero-message channel; adapt the contract or investigate the recording rather than assuming channels share publishers or clocks.
37
+
38
+ Absence has different meanings: required missing topic fails C02, while dependent channel checks skip because there is no channel to inspect. If the overall scan fails, C02–C10 all skip and C01 fails. If no requirement applies to a check, it skips. Skipped results do not establish health.
39
+
40
+ The JSON report embeds the complete contract and hashes its normalized UTF-8 JSON (`sort_keys=True`, compact separators, Unicode preserved). The contract hash identifies effective content rather than the original indentation/byte layout. Reports also include the source byte SHA-256 and tool/reader/Python versions. Contracts and schema bytes are not executed.
41
+
42
+ ## Scan and checksums (C01)
43
+
44
+ - **Full scan** (default) streams the whole file. It computes the file SHA-256 and verifies every CRC that is present: the data-section CRC in the Data End record, each chunk's CRC of its uncompressed records, and the summary CRC in the footer. Attachment CRCs are not checked. Attachments and unknown record types are hashed but skipped.
45
+ - **CRC coverage rule.** C01 warns about missing CRCs only when the data-section CRC is absent **and** some message data is not covered by another CRC: a chunk without a CRC, or a message outside any chunk. Default ROS 2 recordings, with chunk CRCs but no data-section CRC, therefore pass. Set `missing_crc` to `"ignore"` to suppress the warning entirely.
46
+ - **Compression.** Chunks may be uncompressed, `zstd` or `lz4`. Decompressed output is capped at the chunk's declared uncompressed size. A mismatch, any other codec, or a chunk above the size limit fails C01.
47
+ - **Fast mode** (`--fast` in the CLI, the toggle in the web app) reads only the header, footer and summary section (Statistics, Channel, Schema and indexed Metadata records) and checks the summary CRC. C01–C05 run on that information; C06–C10 skip because they need every timestamp. If the summary is missing or lacks Statistics, the scan falls back to a full scan and records `fast_mode_fallback` in the report. In fast mode `source.sha256` is `null`.
48
+ - **Limits.** Defaults: 256 MiB per record, uncompressed chunk and summary section; 20 million tracked timestamps for sorted-gap checks; 10,000 schemas/channels/metadata records. Exceeding a limit fails C01 with an explanation, rather than exhausting memory. The CLI exposes `--max-chunk-mib`, `--max-record-mib`, `--max-tracked-messages` and `--timeout`. There is no overall file-size cap.