duck-ble: the wire contract, extracted now that a second client wants it - #293
Open
pierre-rouanet wants to merge 1 commit into
Open
pierre-rouanet wants to merge 1 commit into
pierre-rouanet wants to merge 1 commit into
Conversation
Three modules moved out of `btd` — `gatt`, `framing` and `adv`. Each was already marked as wire contract where it lived, each says why in its own header, and what they have in common is that a second implementation would agree only with itself: a client that chunked differently, or decoded the advertisement's address by hand, works until it does not and the failure looks like a robot problem. They stayed in `btd` because there was one client and it did not matter. Two things changed that. **`duckctl` was pulling a daemon to reach them** — and on Linux, `bluer` and a vendored libdbus with it, for a tool whose whole point is talking to a robot rather than being one. It now depends on `duck-ble` and not on `btd` at all. **And the phone app carried `clap` and `tracing-subscriber` into an iPhone binary** for the sake of one module. `mobile-app.md` §3 records that as a known cost and §8 as an open item to settle "before there is a second consumer". There is now, and this is the settling. The new crate has one dependency, `uuid`, because the GATT UUIDs are values of that type. No radio, no runtime, no logging, no argument parser: it is bytes and arithmetic, so it builds for a phone, a laptop and the board alike. Adding anything to it adds it to all three, which is the bar its manifest states. No behaviour changes. `btd`'s 63 tests are now 43 in `btd` and 20 in `duck-ble`, which is the same 63. Assisted-by: Claude:claude-opus-5
Coverage71.97% lines on this branch, against a floor of 70%. Per-file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three modules move out of
btdinto a new crate:gatt,framingandadv.Each was already marked as wire contract where it lived, and each says why in its own header.
adv.rsputs it best: "a decoder written separately in the client would agree only with itself." That is exactly the risk, and it is not hypothetical — the phone app had already hand-rolled the advertisement's IPv4 decode before this existed.Why now
They stayed in
btdbecause there was one client and it did not matter. Two things changed.duckctlwas pulling a daemon to reach them. On Linux that meansbluerand a vendored libdbus, compiled for a tool whose whole point is talking to a robot rather than being one. It now depends onduck-bleand not onbtdat all —cargo tree -p duckctlconfirms.The phone app carried
clapandtracing-subscriberinto an iPhone binary for the sake of one module.mobile-app.md§3 records that as a known cost and §8 as an open item to settle before there is a second consumer. There is now.The crate
One dependency,
uuid, because the GATT UUIDs are values of that type. No radio, no async runtime, no logging, no argument parser — bytes and arithmetic, so it builds foraarch64-apple-ios, three desktop platforms and the board alike. Adding a dependency here adds it to all three, which is the bar its manifest states.No behaviour change
Pure move plus import rewrites.
btd's 63 tests are now 43 inbtdand 20 induck-ble— the same 63.cargo clippy -p duck-ble -p btd -p duckctl --all-targetsunder-D warningsis clean, as iscargo fmt --all --check. (A workspace-wide clippy also flags a pre-existingmanual_option_zipinrobotd/src/chorale.rs, untouched here and not flagged by CI's toolchain.)🤖 Generated with Claude Code