Repository navigation
W0: golden protocol transcripts - #183
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>
nofuturekid
force-pushed
the
fix/175-w0-4-transcripts
branch
from
November 13, 2026 17:18
bfdc44e to
9be99f9
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 #175
Stacked on #179 (branch
fix/178-w0-1-proto-types): this PR's own commit isbfdc44e; the diff against #179 is only that commit. Merge #179 first.What changed
Task 4 of the W0 plan, as written, no adaptations to the real tree were needed (all four files are new, nothing else is touched):
crates/obsbot-proto/tests/golden/session.jsonl: hello, a write with its pending state, a get, an action, a live-topic change, and requests for an unsupported device (>client lines,<daemon lines,#comments).crates/obsbot-proto/tests/golden/errors.jsonl: one reply per error code, in the order of 4.1.crates/obsbot-proto/tests/golden/hotplug.jsonl: plug, unplug,port:entry and the identity hand-over (devices withreplaced_by, devices without the old entry, then state).crates/obsbot-proto/tests/transcripts.rs: 6 tests.The example camera is
sn:EXAMPLE0000001(modelexample, productfa01), the unsupported device isport:3-2.4(productfa02). No golden file names another real product id; a test guards this.No byte sent to a camera, no device access, no version change, no CHANGELOG line (tests only).
Verification
cargo test -p obsbot-proto --test transcriptsgave 3 passed, 3 failed (the_three_transcripts_exist,the_error_transcript_holds_every_error_code,the_hand_over_is_three_events_in_order).test result: ok. 6 passed.busyline fromerrors.jsonl:the_error_transcript_holds_every_error_coderevinsession.jsonl:revs_and_device_lists_follow_the_ordering_rules("rev of sn:EXAMPLE0000001 went from 5 to 4")hotplug.jsonl:revs_and_device_lists_follow_the_ordering_rulesreplaced_byfromhotplug.jsonl:the_hand_over_is_three_events_in_orderfa02changed to0001insession.jsonl:golden_files_name_no_other_real_product_idsession.jsonl:every_transcript_line_round_trips_byte_equal("not byte-equal")cargo fmt --checkclean;cargo clippy --all-targets --locked -- -D warningsclean;cargo test --lockedall green (workspace: 171 + 1 + 10 + 6 + 4 + 25 + 2 tests).🤖 Generated with Claude Code