Repository navigation
W0: trait Camera, trait Transport, trait Bus and the registry types - #182
Merged
Merged
Conversation
Adds the crate crates/obsbot-proto with the protocol 2 envelopes (request, reply, event, error), the device and description types with their builders, state and patch types with path helpers, the id and value helpers, and stubs for client, validate (holding Refusal) and schema. Maps are sorted, integral numbers are written without a fraction, and public enums carry a catch-all variant so additive values of a newer daemon still parse. tests/types.rs round-trips every line of tests/golden/types.jsonl byte for byte through its type. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…-check validate_set, validate_do and validate_get check a request against a device description and its state before anything reaches the camera. One refusal order for the whole request: invalid, unsupported, out_of_range, conflict, asleep, then path order. check_value covers Fit::Write and Fit::State; check_description reports the flaws of an inconsistent description. Fixes #173 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
obsbot_proto::schema::protocol_schema builds the draft 2020-12 schema (oneOf Request and ServerMessage, $defs including Description) from the protocol types; schema_text is the file content. tests/schema.rs fails when schema/protocol-2.json is missing or differs, and rewrites it when OBSBOT_REGENERATE is set. A second test checks that $defs holds every envelope, the description types and all 12 error codes. Fixes #174 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nd hand-over
Adds tests/golden/session.jsonl, errors.jsonl and hotplug.jsonl ("> " client
lines, "< " daemon lines, "#" comments) and tests/transcripts.rs. The test
round-trips every line byte for byte, checks that errors.jsonl holds the 12
error codes in the order of 4.1, that revs only go up per entry and a state
event names a listed device, that the hand-over is devices with replaced_by,
devices without the old entry, then state, and that no golden file names a
product id other than fef9 or the synthetic fa0x ids.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…try types Adds obsbot_device::contract (design spec 8.2, 10.3 W0, plan task 5): camera.rs (Camera, CameraError, Tier, Group, LiveTier, Need, Identity, Target, Ctx, Motion, Frame, SendEntry, SendTable), transport.rs (Transport, ControlRange, OnAir), bus.rs (UsbId, IdentitySource, ModelEntry, Registry, Lookup, Found, Bus) and the conformance stub that task 7 fills. The carried code is untouched. Fixes #176 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
nofuturekid
force-pushed
the
fix/176-w0-5-device-contract
branch
from
November 13, 2026 17:19
928d05d to
eca8d30
Compare
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.
Fixes #176
Stacked on #179 (branch
fix/178-w0-1-proto-types): the diff of this PR is only the one commit on top of it. Land #179 first.What changed
Plan task 5 of
docs/superpowers/plans/2026-11-13-obsbot4linux-w0-contracts.md, exactly as written. New moduleobsbot_device::contract:camera.rs:Camera,CameraError,Tier,Group,LiveTier,Need,Identity,Target,Ctx,Motion,Frame,SendEntry,SendTabletransport.rs:Transport,ControlRange,OnAirbus.rs:UsbId,IdentitySource,ModelEntry,Registry,Lookup,Found,Busconformance.rs: empty stub, filled by task 7tests/contract.rs: 5 testsAlso:
obsbot-protoadded tocrates/obsbot-device/Cargo.toml(andCargo.lock),pub mod contract;inlib.rs. The carried code is untouched. No byte sent to a camera, no ioctl, no timing and no read path changes; no test opens a device.Adaptations to the real tree
Two, both only placement:
lib.rs: stage G's file has no "module lines" block in the plan's sense, sopub mod contract;sits first in the alphabetical list ofpub modlines.Cargo.toml:serde_json.workspace = truewas already there from stage G; onlyobsbot-proto.workspace = truewas added (kept in alphabetical order, afternix).The first
cargo testafter adding the dependency ran without--lockedonce to write the newobsbot-device -> obsbot-protoline intoCargo.lock; the gate runs below use--locked.Verification
cargo test -p obsbot-device --test contract: 5 passed.cargo fmt --check: clean.cargo clippy --all-targets --locked -j 3 -- -D warnings: clean.cargo test --locked -j 3(workspace): all ok, none skipped.obsbot-devicelib 171 passed,byte_guard1,contract5,obsbot-proto10 +types4,obsbot4linux25 +cli_surface2.Cargo.lock,crates/obsbot-device/Cargo.toml,src/lib.rs,src/contract/*andtests/contract.rs, nothing else.diff -r):Tier::Minuteperiod 60 s to 30 s:tiers_and_send_tablesfailsCtx::checkignores the deadline:a_context_cuts_at_its_deadline_or_when_interruptedfailsCtx::checkignores the interrupt flag: same test failsshared_pairsdedup replaced by clear:a_pair_of_two_models_is_foundfailsUsbId::from_usbparses the vendor as decimal:usb_ids_come_from_the_hex_strings_of_sysfsfailsRegistry::lookupignores the vendor table:lookup_uses_the_vendor_table_and_the_usb_pairs_onlyfailsSendTable::allowsalways true:tiers_and_send_tablesfailsNo CHANGELOG line: nothing a user can see changes.
🤖 Generated with Claude Code