quaill 0.0.2__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.
quaill-0.0.2/LICENSE ADDED
@@ -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.
quaill-0.0.2/NOTICE ADDED
@@ -0,0 +1,8 @@
1
+ Quaill Records
2
+ Copyright 2026 Quaill LLC
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ "Quaill" and "Quaill Records" are trademarks of Quaill LLC and are not
7
+ licensed under the Apache License. See TRADEMARK.md for how the names may
8
+ be used.
quaill-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: quaill
3
+ Version: 0.0.2
4
+ Summary: Open checker for robot logs: who was in control, was it edited, what's missing.
5
+ Author: Quaill LLC
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Source, https://github.com/Quaill-Records/Quaill
8
+ Project-URL: Issues, https://github.com/Quaill-Records/Quaill/issues
9
+ Keywords: robotics,ros2,mcap,rosbag,logging,audit
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ License-File: NOTICE
20
+ Requires-Dist: mcap>=1.6
21
+ Requires-Dist: mcap-ros2-support>=0.6
22
+ Requires-Dist: rosbags>=0.11
23
+ Requires-Dist: cryptography>=44
24
+ Requires-Dist: zstandard>=0.25
25
+ Requires-Dist: ruamel.yaml>=0.18
26
+ Dynamic: license-file
27
+
28
+ # Quaill Records (v0.0.2)
29
+
30
+ Checks a robot's log and answers three questions:
31
+
32
+ 1. **Who was in control**, the AI or a human, and exactly when it changed.
33
+ 2. **Was anything changed** after it was logged (hash chain, plus an outside witness for the end of the file).
34
+ 3. **Is anything missing** (gaps, crashes, cut-off endings), each one explained by a marker or flagged.
35
+
36
+ It is deterministic. No AI inside. Same file, same report. It states facts ("no messages 03:20 to 05:20, no shutdown marker before, no crash note after"), never guesses or accusations. It is a checker, not a recorder: it reads a finished log, anywhere, later.
37
+
38
+ ## Run it
39
+
40
+ Python 3.12 or newer. No ROS install needed.
41
+
42
+ ```bash
43
+ pip install -r requirements.txt
44
+ python -m quaill demo demo-logs
45
+ ```
46
+
47
+ That generates 52 test logs, plants defects, writes them in every container real robots produce, and checks each one. The table at the end must say `all as expected`. Then:
48
+
49
+ ```bash
50
+ python tests/check_hashes.py
51
+ ```
52
+
53
+ confirms the ROS 2 sidecar and the checker hash identically.
54
+
55
+ Below, `quaill` means `python -m quaill`.
56
+
57
+ | Command | What it does |
58
+ |---|---|
59
+ | `quaill verify LOG` | Full report. `LOG` is a `.mcap`, a rosbag2 directory, a `.db3`, a ROS 1 `.bag`, or any of those zstd-wrapped. Exit 0 meets checks, 1 does not, 2 unreadable. |
60
+ | `quaill verify LOG --profile none` | Built-in checks only. Use this on a bag that has no Quaill channels yet to see what can and cannot be established. |
61
+ | `quaill verify LOG --profile stvfernlv-anlage3` | Check against another rule set. |
62
+ | `quaill verify LOG --json --out report.json` | Machine-readable report. |
63
+ | `quaill who LOG --at 5:30` | Who was in control at that moment, with the handovers around it. |
64
+ | `quaill gen OUT --defect truncate --encoding cdr --container rosbag2-sqlite` | Write a synthetic log with a planted defect, in a given container. `quaill defects` lists both. |
65
+ | `quaill profiles` | List the rule sets the checker can load. |
66
+
67
+ The witness is picked up automatically from `<log>.witness.json`, `<bag_dir>/witness.json`, or a `<bag_dir>/witness/` directory of per-session files. `--witness` can point at a file or a directory. `--witness ""` ignores it. The device's public key is picked up from `<log>.pubkey.pem` or `<bag_dir>/device.pubkey.pem`, or given with `--pubkey` (PEM or hex).
68
+
69
+ ## Inputs the checker reads
70
+
71
+ | Input | Who produces it | Notes |
72
+ |---|---|---|
73
+ | `.mcap` | rosbag2 on Iron and newer (Jazzy, Kilted, Rolling), Foxglove SDK, mcap CLI | JSON or ROS 2 CDR messages; CDR decoded from the `ros2msg` schema text in the file, no ROS install needed |
74
+ | rosbag2 directory, mcap storage | same, as `ros2 bag record` lays it out | split into several files, file-level zstd, chain spans the files |
75
+ | rosbag2 directory, sqlite3 storage | Foxy, Galactic, **Humble** (the LTS most fleets run until 2027) | per-message zstd handled; sqlite bags carry no schema text, so only Quaill's own three types are decoded, everything else is hashed and timed |
76
+ | single `.db3` | a sqlite bag file without its `metadata.yaml` | per-message compression detected from the zstd magic |
77
+ | ROS 1 `.bag` | Noetic and older, still common in industry | read-only: hashed and timed; a ROS 1 robot has no Quaill channels, so integrity and control are NOT ASSESSABLE and the report says so |
78
+ | `*.zstd` | any of the above, compressed as a whole file | decompressed to a temp file |
79
+
80
+ Not read: PX4 ULog, proprietary formats, protobuf-encoded MCAP (planned: `mcap-protobuf-support`).
81
+
82
+ Memory: payload messages keep only a hash and times; bytes are kept for the Quaill channels and for topics a profile looks into. A multi-gigabyte bag still means a multi-million-entry list in memory, so this is "streams the bytes", not yet "constant memory".
83
+
84
+ ## Levels
85
+
86
+ | Level | Question | Grade when it cannot be answered |
87
+ |---|---|---|
88
+ | L0 format | Is this a readable log? Can the messages be decoded? | FAIL / UNREADABLE |
89
+ | L1 integrity | Was anything edited or deleted? Was the end cut off? Did the recorder's clock behave? | NOT ASSESSABLE (no chain); PARTIAL (chain intact, no outside witness) |
90
+ | L2 control | Who was in control, when did it change, is any stretch unknown? | NOT ASSESSABLE (no control channel) |
91
+ | L2 completeness | Any gaps or an unexplained ending? | without session markers, gaps are warnings and the ending is "unknown" |
92
+ | profile | Does the log carry the fields a rule set asks for? | NOT RUN |
93
+
94
+ A log with no outside witness gets PARTIAL, not FAIL. Cutting the end of a log and appending a forged shutdown marker is **not detectable from the file alone**; the demo shows this honestly (`delivery-truncate-nowitness.mcap` passes). Only a witness the maker does not control (an RFC 3161 timestamp, a third party holding chain heads) catches it.
95
+
96
+ ## The layout (spec v0.0.2, draft)
97
+
98
+ Three channels added next to whatever the robot already records. Nothing in the robot's own topics is touched. Message definitions are in `ros2_ws/src/quaill_msgs/msg/*.msg`; the checker decodes them from the schema text stored in the bag, or from its embedded copy for sqlite bags.
99
+
100
+ | Channel | Type | Contents | Shape borrowed from |
101
+ |---|---|---|---|
102
+ | `/quaill/control_mode` | `quaill_msgs/ControlModeReport` | `mode` (0..6), `operator_ref` (pseudonymous id, required when MANUAL), `reason`, `stamp`; one report on every change plus a heartbeat | Autoware `ControlModeReport` numbering |
103
+ | `/quaill/session` | `quaill_msgs/SessionEvent` | `START`, `CLEAN_SHUTDOWN`, `CRASH_NOTE`, `POWER_LOST`, with `session_id` and `software_version` | car EDRs, flight recorders |
104
+ | `/quaill/chain` | `quaill_msgs/ChainLink` | one link per message on every other channel: `session_id`, `seq`, `topic`, `msg_sha256 = sha256(topic ‖ 0 ‖ bytes)`, `prev`, `link = sha256(prev ‖ msg_sha256 ‖ seq ‖ recv_time ‖ topic)`, `recv_time`, plus `key_id` and `sig` (Ed25519 over the link, by the device key) | hash chain + per-link signature |
105
+
106
+ **Pairing is by content, not by time.** The sidecar that publishes links never sees the `log_time` rosbag2 stamps on the original message, so the link carries the content hash and the sidecar's own receive time. The checker pairs unique hashes first, then places duplicate messages (a stopped robot publishes thousands of identical commands) inside the time window their already-paired neighbours define. The two clocks become evidence: `TIME_JUMP` when the recorder clock steps back, `CLOCK_SKEW` when recorder and bag clocks disagree, `TIME_ORDER` when bag order and chain order disagree.
107
+
108
+ **Sessions.** A sidecar that dies and restarts mid-bag starts a new chain under a new `session_id`; the checker verifies each session's chain on its own (`CHAIN_RESTART`) and witness files are per session.
109
+
110
+ **Signatures, and what they buy.** Every link is signed with an Ed25519 device key; the START marker announces the public key. Three levels of trust, in the report's words: `SIGNED_TRUSTED` (verified against a key you supplied, so nobody without that key produced this chain), `SIGNED_ANNOUNCED` (verifies against the key the bag itself announces, which a forger could swap, so it only proves self-consistency), `UNSIGNED`. The demo shows the boundary: a thorough outsider who rewrites the human stretch, deletes the teleop traffic, rebuilds the chain with their own key and swaps the announced key produces a file that passes with no key and no witness, and fails `KEY_MISMATCH` the moment the real device key is supplied. An outsider who only forges the ending fails `KEY_CHANGED` on their own. An insider with the device key is still caught only by the witness. Keep the private key off the log host; a key next to the bag is a formality.
111
+
112
+ **The recorder can lie by omission.** If a human drives through a channel the mode source does not watch, the reports say AUTONOMOUS and no hash can tell. The visible trace is the human's own command traffic: `CONTROL_INCONSISTENT` fires when operator-command topics (by default anything matching `*teleop*`, `*joy*`, `*remote*`, `*manual*`, `*operator*`; a profile can list its own) carry many *distinct* messages during a stretch reported as not-human. A parked joystick repeating one message does not trigger it. Rule for recorders: the node that reports the mode must be the arbiter that decides whose commands reach the motors.
113
+
114
+ Profiles are JSON files in `quaill/profiles/`:
115
+
116
+ - `quaill-control`: our addition (who was in control, session markers, chain).
117
+ - `stvfernlv-anlage3`: Germany's remote-driving regulation, Anlage 3, 15 items + 6 event types + the 10 s window rule. **Draft mapping onto MCAP, not an official schema**; needs a German-reading reviewer.
118
+
119
+ Any future field list (UN R157 DSSAD, ISO/IEC 24970, EN 50742 tracing log) is another JSON file, not new code.
120
+
121
+ ## The connector (ROS 2)
122
+
123
+ `ros2_ws/src/` holds three packages, written for ROS 2 Jazzy, compiled, **testing on real hardware soon**:
124
+
125
+ - `quaill_msgs`: the three message types.
126
+ - `quaill_recorder`: the sidecar. `chain` subscribes raw to configured (or all discovered) topics, hashes the exact bytes the publisher sent, publishes one `ChainLink` per message, writes `START` / `CLEAN_SHUTDOWN` / `CRASH_NOTE` markers (a dirty state file after `kill -9` triggers the crash note on the next start), and writes witness heads every 10 s, with an optional RFC 3161 receipt per head. `control_mode` turns a mode source (a String topic or Autoware's `ControlModeReport`) into standard reports with a heartbeat.
127
+ - `quaill_demo_robot`: a fake robot with real handovers. `mode_manager` decides whose `/cmd_vel` reaches the robot (autonomy or `teleop_twist_keyboard`) and is therefore the node that reports who is driving. No simulator needed.
128
+
129
+ The one open question only hardware settles: whether rosbag2 stores exactly the bytes the sidecar hashed.
130
+
131
+ ## What the demo proves and what it does not
132
+
133
+ Proves: every planted defect is caught in both encodings and in every container; clean logs pass; the checker reads real `ros2msg`/CDR bags, rosbag2 directories (mcap and sqlite3, split, compressed), single `.db3` files and ROS 1 bags; the witness logic separates "recorder died" from "end was cut"; the sidecar and the checker hash identically.
134
+
135
+ Does not prove: anything about a real robot. All 52 logs come from the synthetic generator in `quaill/gen.py`, a labeled reference/example recorder, not a product.
136
+
137
+ ## Other pages
138
+
139
+ - [THREAT-MODEL.md](THREAT-MODEL.md): who might fake a log, what each check catches against whom, what nothing can catch.
140
+ - [TRADEMARK.md](TRADEMARK.md): how the name may be used; never "certified", "verified", "compliant", "safe".
141
+ - [PRIVACY.md](PRIVACY.md): `operator_ref` is personal data; what a maker or operator should consider before switching the layout on.
142
+
143
+ ## Not in v0.0.2 yet
144
+
145
+ - Key registration. The checker trusts a key you hand it; nothing yet ties a key to a robot in a registry or a witness record beyond the per-entry `key_id`.
146
+ - A real witness in the checker. The connector can fetch RFC 3161 receipts; the checker does not verify them yet.
147
+ - `mcap doctor` delegation for L0. Protobuf MCAP. Constant-memory streaming.
148
+ - CDR generation for the remote-vehicle scenario (JSON-only; the checker is encoding-agnostic).
149
+ - A browser drop-in and a GitHub Action.
150
+
151
+ ## Files
152
+
153
+ ```
154
+ ./
155
+ requirements.txt pinned Python dependencies
156
+ LICENSE, NOTICE Apache-2.0, Copyright Quaill LLC
157
+ CLA.md, CONTRIBUTING.md
158
+ THREAT-MODEL.md, TRADEMARK.md, PRIVACY.md
159
+ tests\check_hashes.py connector and checker hash identically
160
+ ros2_ws\src\
161
+ quaill_msgs\ ControlModeReport.msg, SessionEvent.msg, ChainLink.msg (spec v0.0.2)
162
+ quaill_recorder\ chain + control_mode sidecar nodes, config, launch
163
+ quaill_demo_robot\ mode_manager, auto_driver, fake_odom, launch
164
+ quaill\
165
+ cli.py commands: verify, who, gen, demo, profiles, defects
166
+ engine.py runs every check on one log
167
+ inputs.py every input format behind open_log()
168
+ report.py text / JSON / who-was-driving rendering
169
+ mcapio.py the layout, hashes, JSON + CDR decoding
170
+ keys.py Ed25519 device keys: sign links, verify, key ids
171
+ chain.py hash chain build + verify (content pairing, sessions, signatures) + witness + clock checks
172
+ gen.py synthetic generator (two scenarios, seventeen defects, json or cdr, six containers, plus a ROS 1 bag)
173
+ checks\ format (L0), control (L2), completeness (L2), profile
174
+ profiles\ quaill-control.json, stvfernlv-anlage3.json
175
+ demo-logs\ output of `quaill demo`
176
+ ```
quaill-0.0.2/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # Quaill Records (v0.0.2)
2
+
3
+ Checks a robot's log and answers three questions:
4
+
5
+ 1. **Who was in control**, the AI or a human, and exactly when it changed.
6
+ 2. **Was anything changed** after it was logged (hash chain, plus an outside witness for the end of the file).
7
+ 3. **Is anything missing** (gaps, crashes, cut-off endings), each one explained by a marker or flagged.
8
+
9
+ It is deterministic. No AI inside. Same file, same report. It states facts ("no messages 03:20 to 05:20, no shutdown marker before, no crash note after"), never guesses or accusations. It is a checker, not a recorder: it reads a finished log, anywhere, later.
10
+
11
+ ## Run it
12
+
13
+ Python 3.12 or newer. No ROS install needed.
14
+
15
+ ```bash
16
+ pip install -r requirements.txt
17
+ python -m quaill demo demo-logs
18
+ ```
19
+
20
+ That generates 52 test logs, plants defects, writes them in every container real robots produce, and checks each one. The table at the end must say `all as expected`. Then:
21
+
22
+ ```bash
23
+ python tests/check_hashes.py
24
+ ```
25
+
26
+ confirms the ROS 2 sidecar and the checker hash identically.
27
+
28
+ Below, `quaill` means `python -m quaill`.
29
+
30
+ | Command | What it does |
31
+ |---|---|
32
+ | `quaill verify LOG` | Full report. `LOG` is a `.mcap`, a rosbag2 directory, a `.db3`, a ROS 1 `.bag`, or any of those zstd-wrapped. Exit 0 meets checks, 1 does not, 2 unreadable. |
33
+ | `quaill verify LOG --profile none` | Built-in checks only. Use this on a bag that has no Quaill channels yet to see what can and cannot be established. |
34
+ | `quaill verify LOG --profile stvfernlv-anlage3` | Check against another rule set. |
35
+ | `quaill verify LOG --json --out report.json` | Machine-readable report. |
36
+ | `quaill who LOG --at 5:30` | Who was in control at that moment, with the handovers around it. |
37
+ | `quaill gen OUT --defect truncate --encoding cdr --container rosbag2-sqlite` | Write a synthetic log with a planted defect, in a given container. `quaill defects` lists both. |
38
+ | `quaill profiles` | List the rule sets the checker can load. |
39
+
40
+ The witness is picked up automatically from `<log>.witness.json`, `<bag_dir>/witness.json`, or a `<bag_dir>/witness/` directory of per-session files. `--witness` can point at a file or a directory. `--witness ""` ignores it. The device's public key is picked up from `<log>.pubkey.pem` or `<bag_dir>/device.pubkey.pem`, or given with `--pubkey` (PEM or hex).
41
+
42
+ ## Inputs the checker reads
43
+
44
+ | Input | Who produces it | Notes |
45
+ |---|---|---|
46
+ | `.mcap` | rosbag2 on Iron and newer (Jazzy, Kilted, Rolling), Foxglove SDK, mcap CLI | JSON or ROS 2 CDR messages; CDR decoded from the `ros2msg` schema text in the file, no ROS install needed |
47
+ | rosbag2 directory, mcap storage | same, as `ros2 bag record` lays it out | split into several files, file-level zstd, chain spans the files |
48
+ | rosbag2 directory, sqlite3 storage | Foxy, Galactic, **Humble** (the LTS most fleets run until 2027) | per-message zstd handled; sqlite bags carry no schema text, so only Quaill's own three types are decoded, everything else is hashed and timed |
49
+ | single `.db3` | a sqlite bag file without its `metadata.yaml` | per-message compression detected from the zstd magic |
50
+ | ROS 1 `.bag` | Noetic and older, still common in industry | read-only: hashed and timed; a ROS 1 robot has no Quaill channels, so integrity and control are NOT ASSESSABLE and the report says so |
51
+ | `*.zstd` | any of the above, compressed as a whole file | decompressed to a temp file |
52
+
53
+ Not read: PX4 ULog, proprietary formats, protobuf-encoded MCAP (planned: `mcap-protobuf-support`).
54
+
55
+ Memory: payload messages keep only a hash and times; bytes are kept for the Quaill channels and for topics a profile looks into. A multi-gigabyte bag still means a multi-million-entry list in memory, so this is "streams the bytes", not yet "constant memory".
56
+
57
+ ## Levels
58
+
59
+ | Level | Question | Grade when it cannot be answered |
60
+ |---|---|---|
61
+ | L0 format | Is this a readable log? Can the messages be decoded? | FAIL / UNREADABLE |
62
+ | L1 integrity | Was anything edited or deleted? Was the end cut off? Did the recorder's clock behave? | NOT ASSESSABLE (no chain); PARTIAL (chain intact, no outside witness) |
63
+ | L2 control | Who was in control, when did it change, is any stretch unknown? | NOT ASSESSABLE (no control channel) |
64
+ | L2 completeness | Any gaps or an unexplained ending? | without session markers, gaps are warnings and the ending is "unknown" |
65
+ | profile | Does the log carry the fields a rule set asks for? | NOT RUN |
66
+
67
+ A log with no outside witness gets PARTIAL, not FAIL. Cutting the end of a log and appending a forged shutdown marker is **not detectable from the file alone**; the demo shows this honestly (`delivery-truncate-nowitness.mcap` passes). Only a witness the maker does not control (an RFC 3161 timestamp, a third party holding chain heads) catches it.
68
+
69
+ ## The layout (spec v0.0.2, draft)
70
+
71
+ Three channels added next to whatever the robot already records. Nothing in the robot's own topics is touched. Message definitions are in `ros2_ws/src/quaill_msgs/msg/*.msg`; the checker decodes them from the schema text stored in the bag, or from its embedded copy for sqlite bags.
72
+
73
+ | Channel | Type | Contents | Shape borrowed from |
74
+ |---|---|---|---|
75
+ | `/quaill/control_mode` | `quaill_msgs/ControlModeReport` | `mode` (0..6), `operator_ref` (pseudonymous id, required when MANUAL), `reason`, `stamp`; one report on every change plus a heartbeat | Autoware `ControlModeReport` numbering |
76
+ | `/quaill/session` | `quaill_msgs/SessionEvent` | `START`, `CLEAN_SHUTDOWN`, `CRASH_NOTE`, `POWER_LOST`, with `session_id` and `software_version` | car EDRs, flight recorders |
77
+ | `/quaill/chain` | `quaill_msgs/ChainLink` | one link per message on every other channel: `session_id`, `seq`, `topic`, `msg_sha256 = sha256(topic ‖ 0 ‖ bytes)`, `prev`, `link = sha256(prev ‖ msg_sha256 ‖ seq ‖ recv_time ‖ topic)`, `recv_time`, plus `key_id` and `sig` (Ed25519 over the link, by the device key) | hash chain + per-link signature |
78
+
79
+ **Pairing is by content, not by time.** The sidecar that publishes links never sees the `log_time` rosbag2 stamps on the original message, so the link carries the content hash and the sidecar's own receive time. The checker pairs unique hashes first, then places duplicate messages (a stopped robot publishes thousands of identical commands) inside the time window their already-paired neighbours define. The two clocks become evidence: `TIME_JUMP` when the recorder clock steps back, `CLOCK_SKEW` when recorder and bag clocks disagree, `TIME_ORDER` when bag order and chain order disagree.
80
+
81
+ **Sessions.** A sidecar that dies and restarts mid-bag starts a new chain under a new `session_id`; the checker verifies each session's chain on its own (`CHAIN_RESTART`) and witness files are per session.
82
+
83
+ **Signatures, and what they buy.** Every link is signed with an Ed25519 device key; the START marker announces the public key. Three levels of trust, in the report's words: `SIGNED_TRUSTED` (verified against a key you supplied, so nobody without that key produced this chain), `SIGNED_ANNOUNCED` (verifies against the key the bag itself announces, which a forger could swap, so it only proves self-consistency), `UNSIGNED`. The demo shows the boundary: a thorough outsider who rewrites the human stretch, deletes the teleop traffic, rebuilds the chain with their own key and swaps the announced key produces a file that passes with no key and no witness, and fails `KEY_MISMATCH` the moment the real device key is supplied. An outsider who only forges the ending fails `KEY_CHANGED` on their own. An insider with the device key is still caught only by the witness. Keep the private key off the log host; a key next to the bag is a formality.
84
+
85
+ **The recorder can lie by omission.** If a human drives through a channel the mode source does not watch, the reports say AUTONOMOUS and no hash can tell. The visible trace is the human's own command traffic: `CONTROL_INCONSISTENT` fires when operator-command topics (by default anything matching `*teleop*`, `*joy*`, `*remote*`, `*manual*`, `*operator*`; a profile can list its own) carry many *distinct* messages during a stretch reported as not-human. A parked joystick repeating one message does not trigger it. Rule for recorders: the node that reports the mode must be the arbiter that decides whose commands reach the motors.
86
+
87
+ Profiles are JSON files in `quaill/profiles/`:
88
+
89
+ - `quaill-control`: our addition (who was in control, session markers, chain).
90
+ - `stvfernlv-anlage3`: Germany's remote-driving regulation, Anlage 3, 15 items + 6 event types + the 10 s window rule. **Draft mapping onto MCAP, not an official schema**; needs a German-reading reviewer.
91
+
92
+ Any future field list (UN R157 DSSAD, ISO/IEC 24970, EN 50742 tracing log) is another JSON file, not new code.
93
+
94
+ ## The connector (ROS 2)
95
+
96
+ `ros2_ws/src/` holds three packages, written for ROS 2 Jazzy, compiled, **testing on real hardware soon**:
97
+
98
+ - `quaill_msgs`: the three message types.
99
+ - `quaill_recorder`: the sidecar. `chain` subscribes raw to configured (or all discovered) topics, hashes the exact bytes the publisher sent, publishes one `ChainLink` per message, writes `START` / `CLEAN_SHUTDOWN` / `CRASH_NOTE` markers (a dirty state file after `kill -9` triggers the crash note on the next start), and writes witness heads every 10 s, with an optional RFC 3161 receipt per head. `control_mode` turns a mode source (a String topic or Autoware's `ControlModeReport`) into standard reports with a heartbeat.
100
+ - `quaill_demo_robot`: a fake robot with real handovers. `mode_manager` decides whose `/cmd_vel` reaches the robot (autonomy or `teleop_twist_keyboard`) and is therefore the node that reports who is driving. No simulator needed.
101
+
102
+ The one open question only hardware settles: whether rosbag2 stores exactly the bytes the sidecar hashed.
103
+
104
+ ## What the demo proves and what it does not
105
+
106
+ Proves: every planted defect is caught in both encodings and in every container; clean logs pass; the checker reads real `ros2msg`/CDR bags, rosbag2 directories (mcap and sqlite3, split, compressed), single `.db3` files and ROS 1 bags; the witness logic separates "recorder died" from "end was cut"; the sidecar and the checker hash identically.
107
+
108
+ Does not prove: anything about a real robot. All 52 logs come from the synthetic generator in `quaill/gen.py`, a labeled reference/example recorder, not a product.
109
+
110
+ ## Other pages
111
+
112
+ - [THREAT-MODEL.md](THREAT-MODEL.md): who might fake a log, what each check catches against whom, what nothing can catch.
113
+ - [TRADEMARK.md](TRADEMARK.md): how the name may be used; never "certified", "verified", "compliant", "safe".
114
+ - [PRIVACY.md](PRIVACY.md): `operator_ref` is personal data; what a maker or operator should consider before switching the layout on.
115
+
116
+ ## Not in v0.0.2 yet
117
+
118
+ - Key registration. The checker trusts a key you hand it; nothing yet ties a key to a robot in a registry or a witness record beyond the per-entry `key_id`.
119
+ - A real witness in the checker. The connector can fetch RFC 3161 receipts; the checker does not verify them yet.
120
+ - `mcap doctor` delegation for L0. Protobuf MCAP. Constant-memory streaming.
121
+ - CDR generation for the remote-vehicle scenario (JSON-only; the checker is encoding-agnostic).
122
+ - A browser drop-in and a GitHub Action.
123
+
124
+ ## Files
125
+
126
+ ```
127
+ ./
128
+ requirements.txt pinned Python dependencies
129
+ LICENSE, NOTICE Apache-2.0, Copyright Quaill LLC
130
+ CLA.md, CONTRIBUTING.md
131
+ THREAT-MODEL.md, TRADEMARK.md, PRIVACY.md
132
+ tests\check_hashes.py connector and checker hash identically
133
+ ros2_ws\src\
134
+ quaill_msgs\ ControlModeReport.msg, SessionEvent.msg, ChainLink.msg (spec v0.0.2)
135
+ quaill_recorder\ chain + control_mode sidecar nodes, config, launch
136
+ quaill_demo_robot\ mode_manager, auto_driver, fake_odom, launch
137
+ quaill\
138
+ cli.py commands: verify, who, gen, demo, profiles, defects
139
+ engine.py runs every check on one log
140
+ inputs.py every input format behind open_log()
141
+ report.py text / JSON / who-was-driving rendering
142
+ mcapio.py the layout, hashes, JSON + CDR decoding
143
+ keys.py Ed25519 device keys: sign links, verify, key ids
144
+ chain.py hash chain build + verify (content pairing, sessions, signatures) + witness + clock checks
145
+ gen.py synthetic generator (two scenarios, seventeen defects, json or cdr, six containers, plus a ROS 1 bag)
146
+ checks\ format (L0), control (L2), completeness (L2), profile
147
+ profiles\ quaill-control.json, stvfernlv-anlage3.json
148
+ demo-logs\ output of `quaill demo`
149
+ ```
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "quaill"
7
+ version = "0.0.2"
8
+ description = "Open checker for robot logs: who was in control, was it edited, what's missing."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE", "NOTICE"]
12
+ authors = [{ name = "Quaill LLC" }]
13
+ requires-python = ">=3.12"
14
+ dependencies = [
15
+ "mcap>=1.6",
16
+ "mcap-ros2-support>=0.6",
17
+ "rosbags>=0.11",
18
+ "cryptography>=44",
19
+ "zstandard>=0.25",
20
+ "ruamel.yaml>=0.18",
21
+ ]
22
+ keywords = ["robotics", "ros2", "mcap", "rosbag", "logging", "audit"]
23
+ classifiers = [
24
+ "Development Status :: 2 - Pre-Alpha",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Developers",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Topic :: Scientific/Engineering",
30
+ ]
31
+
32
+ [project.urls]
33
+ Source = "https://github.com/Quaill-Records/Quaill"
34
+ Issues = "https://github.com/Quaill-Records/Quaill/issues"
35
+
36
+ [project.scripts]
37
+ quaill = "quaill.cli:main"
38
+
39
+ [tool.setuptools.packages.find]
40
+ include = ["quaill", "quaill.*"]
41
+
42
+ [tool.setuptools.package-data]
43
+ quaill = ["profiles/*.json"]
@@ -0,0 +1,6 @@
1
+ """Quaill Records: checks a robot's MCAP log for who was in control, what changed, and what is missing.
2
+
3
+ Deterministic. No AI inside. Same file -> same report. It reports facts, not accusations.
4
+ """
5
+
6
+ __version__ = "0.0.2"
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ raise SystemExit(main())