Device fixture workflows
Device fixtures turn real hardware observations into repeatable, privacy-safe inputs for device tests. The workflow keeps semantic device state separate from HID traffic, replaces hardware identities with stable synthetic identities, and uses strict replay before it publishes a fixture for later validation or hardware-free tests.
Workflow model
The fixture system has two evidence paths. A semantic profile describes what devices and controls should look like. A HID cassette records proven read exchanges that production device code can replay. A manifest joins these assets through synthetic identities and device routes.
The complete path is:
flowchart LR
Hardware[Real hardware] --> Profile[Agent semantic profile]
Hardware --> Capture[Direct HID recording]
Capture --> Sanitize[Identity and safety audit]
Sanitize --> Case[HID cassette]
Profile --> Identity[Synthetic route and identity plan]
Identity --> Case
Profile --> Manifest[Fixture manifest]
Case --> Manifest
Case --> Replay[Strict self-replay]
Manifest --> Verify[Offline fixture verification]
Replay --> Verify
Verify --> Tests[Hardware-free device tests]
The fixture profiles and validation page describes the asset schemas, canonical profiles, and fixture validation in detail. Device domain runtime explains how the same routes fit into device behavior, while the command-line interface page places these commands beside the other local hardware workflows.
Semantic profile capture
openlogi fixture record profile captures one selected device through the running Agent. This gives the fixture the Agent's normal inventory view and avoids a second process opening the hardware. The command has no direct-hardware fallback, so a healthy Agent is required. The capture takes one snapshot and uses read-only semantic facts for the selected target.
The profile records the device facts that semantic mocks need:
- Receiver or direct-device inventory.
- Paired slots and online or offline state.
- Standalone raw-HID devices.
- Initial setting values and support claims for the selected routes, including DPI, SmartShift, wheel, backlight, Fn-lock, report rate, pointer speed, press force, Disable Keys, Easy-Switch host-slot behavior, and sidetone when those facts are available. Standalone light support is recorded for raw-HID routes.
Profile settings distinguish an unsupported feature from a supported feature with no current value. For an offline route, known support becomes unavailable rather than an invented value. Unknown support causes capture to stop, so the profile cannot claim a capability that the Agent did not establish. For a supported Easy-Switch feature, captured host names are sanitized before they enter the profile.
The command requires a synthetic --id and --name. It selects a target by an exact display name or exact rendered route. A receiver selection retains the receiver's paired inventory and settings, while a direct or standalone selection retains only the selected link. A paired sibling with no usable identity is dropped because it cannot be bound to a fixture principal; the selected device is never dropped for this reason. It validates the profile before writing it, and it stops when an online read fails or an offline device does not provide enough facts to state support safely. The capture does not publish runtime app data, passkey data, or private transport details.
Profile capture is evidence of the Agent's semantic view. It is not proof that the physical device or every protocol exchange behaves as the profile claims. Maintainers must review the result and pair it with cases when protocol behavior matters.
References: crates/…/record_profile.rs• L24-51 crates/…/record_profile.rs• L118-141 crates/…/record_profile.rs• L144-190 crates/…/record_profile.rs• L192-269 crates/…/record_profile.rs• L272-370 crates/…/record_profile.rs• L372-425 crates/…/record_profile.rs• L427-452 crates/…/tests.rs• L485-591 crates/…/tests.rs• L593-697 crates/…/tests.rs• L700-818 crates/…/tests.rs• L820-859 crates/…/tests.rs• L968-1138 crates/…/tests.rs• L1183-1222 crates/…/schema.rs• L121-216
HID case capture
openlogi fixture record case captures one allowed read-only HID++ operation through direct hardware access. The CLI first proves that the Agent is not active, then selects one online, addressable HID++ target, observes its channel traffic, and converts one complete channel lifetime into a cassette.
The native recorder is an opt-in evidence boundary for this path. It groups channel observations by request identity and also keeps standalone raw-writer activity separate from channel traffic. It is bounded and refuses finalization when evidence overflows, a producer remains open, or a transport lifetime is incomplete, so a capture cannot publish partial evidence.
The capture accepts a fixed set of production reads:
| Operation group | Purpose |
|---|---|
| Feature and firmware reads | Describe supported HID++ features and firmware entities. |
| Control reads | Describe reprogrammable controls and their values. |
| Battery and DPI reads | Capture battery diagnostics and DPI information. |
| SmartShift reads | Capture SmartShift status. |
| Wheel and backlight reads | Capture wheel mode and keyboard backlight state. |
The native recorder keeps request facts together by request identity. This matters because response callback order is not a safe replay order. The recorder also keeps potentially request-answering unmatched evidence and malformed evidence so the later audit can reject it. Unrelated unsolicited HID++ input is ignored rather than added to a cassette. A bounded recording fails instead of returning partial evidence when its event limit is reached or its channel remains open.
The cassette builder keeps complete exchanges that fit the fixture contract. A typed unsupported-feature or other typed protocol result can be a valid replayable observation, but host, open, disconnect, timeout, interruption, and other non-replayable errors stop capture. The builder replaces supported receiver and device identities with length-matched synthetic values while preserving repeated-identity relationships. It rejects pairing traffic, unproven writes, unsupported protocol traffic, malformed reports, and incomplete channel lifetimes. The resulting cassette remains valid when replay uses a different HID++ software-ID lease.
Direct capture holds the Agent instance lock for its full lifetime and also checks the Agent endpoint before it opens hardware. This prevents a service that starts after the initial check from sharing the device. Target selection remains exact and excludes offline, duplicate, unaddressable, and raw-HID targets. The capture accepts HID++ 1.0 devices only when the selected operation can be observed as a supported direct case; it does not use a feature table that the device cannot provide.
References: crates/…/record_case.rs• L29-80 crates/…/record_case.rs• L147-190 crates/…/record_case.rs• L226-295 crates/…/record_case.rs• L297-371 crates/…/record_case.rs• L421-474 crates/…/record_case.rs• L598-674 crates/…/audit.rs• L11-45 crates/…/audit.rs• L75-161 crates/…/recording.rs• L27-101 crates/…/recording.rs• L131-206 crates/…/recording.rs• L226-312 crates/…/cassette.rs• L253-377 crates/…/sanitizer.rs• L30-55 crates/…/tests.rs• L32-184 crates/…/tests.rs• L257-506 crates/…/tests.rs• L18-332
Two-phase contribution
openlogi fixture contribute combines semantic capture and protocol capture into one resumable contribution. Phase one reads the profile through the Agent. Phase two starts only after the operator stops the Agent and reruns the same command, so the CLI can own direct HID access without competing with the resident service.
The contribution keeps only synthetic route data in its temporary state. Before phase two records traffic, it checks the same receiver family and slot or the same direct-device identity class. It then derives the cassette identity plan from the sanitized profile so the protocol cases and profile describe the same logical device. The output directory name must match the synthetic fixture ID, which keeps the local contribution path tied to the published identity.
The normal contribution records the standard read-only operation set, builds a manifest, writes the cases, removes the temporary state, and runs strict verification. --profile-only publishes a profile and manifest without direct HID cases. A raw-HID selection also remains profile-only because it has no HID++ cassette workflow. No contribution uploads data; the output is a local directory for review and version control.
The ownership boundary is deliberate. Profile capture needs a responsive Agent. Direct case capture needs the Agent to be stopped and fails closed when the lock or endpoint state is uncertain. Discovery may enable receiver notifications or arrival reports before target selection, and the workflow does not restore those notification flags.
References: crates/…/contribute.rs• L21-46 crates/…/contribute.rs• L58-135 crates/…/contribute.rs• L138-203 crates/…/contribute.rs• L206-276 crates/…/contribute.rs• L278-356 crates/…/contribute.rs• L397-475 crates/…/record_case.rs• L258-319
Fixture identity
Fixture identity gives one physical relationship a stable synthetic form across the profile, cassette, and manifest. The workflow does not hash or retain the original hardware identity. It assigns canonical values by identity kind and preserves the relation between receiver, slot, and device.
The manifest names fixture-local receiver and device principals. It also records where each synthetic identity must occur in the profile or in a named cassette. Case bindings point each cassette to the profile route it exercises. This makes a cassette useful only with the device relationship it claims to represent.
The canonical fixture demonstrates the supported shape: a Bolt receiver with paired devices, a direct HID++ device, and a standalone raw-HID light. Its manifest is profile-only today, so it is a reference for identity and route shape rather than a source of captured protocol traffic.
References: crates/…/identity.rs• L16-31 crates/…/identity.rs• L137-183 crates/…/generate.rs• L16-49 crates/…/generate.rs• L53-142 crates/…/manifest.rs• L12-30 crates/…/profile.json• L1-5 crates/…/manifest.json• L1-16
Deterministic replay
Replay runs production device behavior against a virtual HID topology. The topology can contain virtual nodes, shared logical channels, receiver slots, connection state, hotplug delivery, and response barriers. It changes the environment around the production path without trying to emulate all receiver firmware.
The virtual topology keeps physical presence, open outcome, channel connection, receiver-slot state, and hotplug signals separate. Tests can therefore change one part of the environment without implying the others. A stale channel remains stale after a replacement channel opens, while a hotplug event remains a separate signal that production discovery must handle.
The replay contract is strict:
- An outgoing request must match a pending cassette exchange.
- Exact reports match before HID++ 2.0 candidates. HID++ 2.0 matching ignores only the software-ID nibble needed for a new live channel.
- A response that contradicts declared receiver-slot state is rejected without consuming the queued exchange, so a later valid slot state can use it.
- Required exchanges must be consumed before completion.
- Declared receiver slot state must agree with successful responses and notifications.
- A disconnected or absent node must remain disconnected until a new lifetime opens.
This lets tests separate a topology change from its host event. They can model a missed hotplug event, a stale channel, a delayed response, a receiver slot transition, a partial probe, or recovery. The same backend supports direct self-replay during case capture, where the selected production read must return the same semantic result as the real observation and consume the full cassette. Case capture derives a replay route from the cassette's synthetic receiver identity, keeps direct-device routes tied to their vendor and product IDs, and publishes only when exactly one sanitized candidate passes semantic equality and complete-consumption checks.
Replay also checks that production probes preserve the meaning of a fixture. Direct and receiver-backed routes must return the profile's inventory or setting result, and a write exercise must return the device's read-back value rather than the request value. Presence, open outcome, channel connection, receiver slots, and hotplug signals stay independent so each transport lifetime can be tested without creating an unrelated event.
Session replay also exercises higher-level capture and pairing flows. Capture sessions publish their active channel so shared hardware writes reuse it, re-arm volatile control diversions after wireless reconnects, and keep listening until firmware restoration completes. A keyboard session can change only the controls that join or leave its active set, or take and hand back the complete G-key row when gaming-key capture is enabled. Failed wake-feature discovery ends the capture epoch and restores its controls before retry, while a successful unsupported-feature result keeps the session active. A watched capture channel uses idle pings to detect a dead read path and asks inventory for a replacement rather than retrying on the same channel.
Restoration follows the stop reason. A current channel can restore at shutdown, an offline receiver slot waits for that route to return, a replaced channel waits for fresh inventory, and a handoff restores through the successor route. The restore plan covers diverted controls and wheels while preserving control remaps. When high-resolution main-wheel reporting was enabled for capture, restoration also returns the wheel to the native resolution recorded before diversion. Normal teardown clears the temporary capture slot only when it still names that session's channel. Pairing cancellation stops discovery and restores the receiver notification flags that existed before pairing rather than clearing unrelated flags.
Inventory replay also checks the boundary between a last-good observation and a new channel lifetime. A brief failure can keep known inventory visible, but repeated disconnects retire the stale channel and require a replacement before the device is treated as newly connected. Battery and setting broadcasts request one coalesced reconciliation and update the relevant settings revision without making unrelated channel or slot changes appear as new hardware. Receiver identity evidence remains available for pairing until a confirmed receiver disconnect removes it.
Replay tests also keep profile meaning strict. They reject unknown nested fields, invalid setting values, duplicate identities, unsupported capability claims, and invalid report-rate or unavailable-setting combinations before production behavior can use the fixture. Profile schema additions preserve older version-1 profiles by treating omitted newer setting families as unsupported, while captured values still need capability checks when present.
References: crates/…/replay.rs• L1-59 crates/…/backend.rs• L152-171 crates/…/backend.rs• L226-321 crates/…/channel.rs• L101-151 crates/…/channel.rs• L154-180 crates/…/channel.rs• L239-265 crates/…/slots.rs• L47-145 crates/…/replay.rs• L13-63 crates/…/replay.rs• L66-132 crates/…/channel.rs• L269-327 crates/…/capture.rs• L190-307 crates/…/capture.rs• L378-495 crates/…/capture_restore.rs• L248-357 crates/…/capture_restore.rs• L361-429 crates/…/replay_test_support.rs• L18-68 crates/…/replay_tests.rs• L20-388 crates/…/replay_tests.rs• L390-779 crates/…/replay_tests.rs• L781-835 crates/…/replay_tests.rs• L864-1018 crates/…/replay_tests.rs• L1021-1338 crates/…/replay_tests.rs• L1341-1384 crates/…/session_replay_tests.rs• L50-368 crates/…/session_replay_tests.rs• L370-647 crates/…/session_replay_tests.rs• L649-729 crates/…/tests.rs• L40-428 crates/…/tests.rs• L430-721 crates/…/tests.rs• L724-965 crates/…/schema.rs• L79-101 crates/…/schema.rs• L122-216
Reviewed corpus replay
The contributed fixture corpus is checked against reviewed device observations, not only against JSON shape. Each declared cassette must replay its production read to completion and produce the expected feature table, control table, battery result, or profile setting. The diagnostic registry maps each reviewed specimen to its covered case names and expected feature, control, and raw battery results. This keeps a changed decoder or case from silently changing the meaning of an existing specimen.
The review data covers the operation set declared by FixtureOperation::ALL. It includes a wired G512 specimen with reviewed feature and control results and an explicitly absent raw battery result. A fixture with no repository workspace is skipped by corpus tests, while a workspace corpus must be present and non-empty so missing coverage cannot pass as an empty test run.
References: crates/…/corpus_tests.rs• L19-101 crates/…/corpus_diagnostics.json• L1-560 crates/…/fs.rs• L134-173
Command workflows
The fixture command family exposes separate capture, assembly, and verification actions. The command-line interface page places these commands beside the other local hardware workflows.
| Command | Hardware access | Result |
|---|---|---|
openlogi fixture record profile --id ... --name ... --output ... | Running Agent only | One validated semantic profile. |
openlogi fixture record case --operation ... --name ... --channel ... --output ... | Direct HID access with Agent exclusion | One sanitized cassette after self-replay. |
openlogi fixture contribute --id ... --name ... --output ... | Agent in phase one, direct HID in phase two | A complete resumable fixture directory. |
openlogi fixture contribute --id ... --name ... --output ... --profile-only | Running Agent only | A profile-only fixture directory. |
openlogi fixture verify <directory> | No hardware | Offline schema, relationship, identity, and replay-framing checks. |
openlogi list | Agent inventory when reachable, otherwise direct enumeration | A discovery snapshot for selecting a fixture target; exit status 2 means no HID++ device or webcam was found. |
openlogi list is a discovery aid before fixture capture. It reads the running Agent's inventory when the Agent responds, which matches the inventory seen by the GUI. If the Agent is unavailable, it reads hardware directly and reports that provenance on stderr. This fallback helps an operator find hardware, but it does not change the Agent-only requirement of profile capture or the Agent-exclusion requirement of case capture.
Target selection is exact for fixture work. A selector can match one display name without regard to case or one exact rendered route. An absent or ambiguous match stops the command instead of guessing. Case capture also excludes offline or unaddressable targets. Profile capture uses one Agent snapshot and does not perform writes, pairing, or runtime event reads.
References: crates/…/fixture.rs• L13-59 crates/…/record_case.rs• L31-59 crates/…/record_case.rs• L226-255 crates/…/record_case.rs• L327-352 crates/…/record_profile.rs• L24-51 crates/…/record_profile.rs• L144-179 crates/…/contribute.rs• L28-46 crates/…/contribute.rs• L83-135 crates/…/verify.rs• L16-39 crates/…/target_selection.rs• L13-65 crates/…/record_case.rs• L421-454 crates/…/tests.rs• L744-798 crates/…/list.rs• L20-52 crates/…/list.rs• L72-85
Hardware exercise commands
The CLI also provides direct hardware checks for scenarios that support fixture capture or help diagnose a captured behavior. openlogi diag selects an online HID++ device by name or by required feature, then runs read checks or verified write round trips through the same device path used by the application. openlogi backlight is an Agent-only path for reading or changing persistent keyboard backlight state; it reports the Agent's confirmed state and does not fall back to direct hardware.
The battery command reports the device's raw battery form. The pointer-speed command reads a scaling value, writes a test value, reads it back, and restores the original value before it reports success or failure. The camera command reads UVC controls or writes a selected control directly to the camera so other applications observe the device state. Backlight changes are selected against one online Agent route and are confirmed by the returned state.
| Command | Scenario exercised | Hardware effect |
|---|---|---|
openlogi diag battery [--device NAME] | Raw battery reporting | Read only. |
openlogi diag pointer-speed [--device NAME] [--target VALUE] | Pointer scaling write and restoration | Temporarily writes, then restores the original value. |
openlogi backlight [--device NAME] [status|on|off|auto|level|battery-saving|duration] | Keyboard backlight state and persistent settings | Reads through the Agent; writes are confirmed and persist on the keyboard. |
openlogi camera get [--camera ID] | Camera control discovery | Read only. |
openlogi camera set CONTROL VALUE [--camera ID] | Camera control persistence | Writes the camera's own control register. |
These commands are hardware exercises rather than fixture publication steps. A diagnostic result can guide a fixture scenario, but it does not create a fixture or replace strict cassette replay.
References: crates/…/diag.rs• L1-7 crates/…/diag.rs• L23-57 crates/…/diag.rs• L102-205 crates/…/battery.rs• L1-33 crates/…/pointer_speed.rs• L1-42 crates/…/pointer_speed.rs• L44-117 crates/…/backlight.rs• L24-75 crates/…/backlight.rs• L111-161 crates/…/backlight.rs• L171-247 crates/…/agent_routing.rs• L150-191 crates/…/agent_routing.rs• L194-260 crates/…/camera.rs• L1-5 crates/…/camera.rs• L20-87
Agent automation commands
openlogi api provides a machine-readable Agent-only interface for inventory and common device settings. It returns one versioned JSON envelope for success and failure, uses opaque device IDs from api devices, and keeps internal Agent state out of the external contract.
Read commands report Agent health, known devices, and settings such as DPI, SmartShift, Fn-lock, report rate, and Easy-Switch channels. Write commands validate the requested value, send one change through the Agent, and require the device's read-back state to match before reporting success. The optional --save path stages supported configuration changes and commits them only after hardware confirmation; configuration save and Agent reload failures remain visible as distinct persistence outcomes.
This interface helps scripts exercise the same hardware routes without parsing human output. It is not a fixture capture path: it does not create profiles or cassettes, and its device IDs must be refreshed when the Agent inventory changes.
References: crates/…/api.rs• L24-94 crates/…/api.rs• L145-271 crates/…/api.rs• L274-477 crates/…/persistence.rs• L14-166 crates/…/tests.rs• L126-155 crates/…/tests.rs• L204-332 crates/…/tests.rs• L335-476 crates/…/tests.rs• L507-667
Publication and verification
Fixture publication is fail-closed. Profiles and cassettes are written atomically, and a complete contribution is published only after the assets pass their local checks. Existing output is not replaced unless the operator chooses --force for the single-file recording commands.
openlogi fixture verify <directory> uses the shared fixture filesystem loader and reads the directory without hardware. It requires a manifest and profile, permits a cases directory only when the manifest declares cases, rejects unexpected or symlinked entries, and checks that every declared cassette exists exactly once. It then verifies four contracts:
- Schema versions and asset values are valid.
- Manifest, profile, case names, channels, and routes agree.
- Every identity is canonical, owned by the right principal, and present at the declared locations with the declared count.
- Every cassette has valid report framing, supported protocol evidence, and a case relationship that matches its request targets.
Profiles must describe at least one inventory or standalone device. Each route must have one settings behavior, and declared support must agree with the route's capabilities. A setting may declare support without a current value, but it must still agree with the route capability. Battery percentages are optional when the device has no gauge, but any recorded percentage must stay within the valid range. Cassette reports must use supported widths, while each exchange must use either exact matching or the limited HID++ 2.0 software-ID normalization defined by the schema. Unknown fields and arbitrary request masks are not accepted by the asset contract.
The command does not exercise physical hardware and does not prove semantic correctness beyond the captured and declared evidence. A passing result means the directory is safe to load as a consistent fixture corpus; maintainer review still decides whether the profile and case represent the intended device behavior.
References: crates/…/output.rs• L10-52 crates/…/verify.rs• L24-75 crates/…/verify.rs• L78-177 crates/…/schema.rs• L48-66 crates/…/schema.rs• L103-216 crates/…/schema.rs• L771-815 crates/…/schema.rs• L845-996 crates/…/verify.rs• L122-160 crates/…/tests.rs• L69-195 crates/…/tests.rs• L215-369
Corpus loading
Repository tests and tools use one strict loader for contributed specimens. It walks every fixture directory and returns only assets that pass structure, schema, identity, relationship, and cassette checks. A missing or empty repository corpus is an error, so a test cannot lose all fixture coverage without notice.
The loader belongs to the optional filesystem boundary of openlogi-fixture. The default fixture contract remains usable by portable replay without file access, while CLI verification and workspace corpus tests opt into filesystem loading.
References: crates/…/Cargo.toml• L9-15 crates/…/Cargo.toml• L16-31 crates/…/fs.rs• L55-113 crates/…/fs.rs• L134-173 crates/…/tests.rs• L11-29 crates/…/tests.rs• L212-222
Change checklist
When these files or sections are changed, remember to consider these:
- Keep Agent-owned profile capture and direct case capture as separate ownership paths. A fallback from one path to the other can open the same hardware twice.
- Keep the profile route, cassette identity plan, manifest principal, and case binding aligned. A change to one route form can make a valid-looking case relate to the wrong device.
- Keep the identity sanitizer, replay-route derivation, and manifest occurrence ledger in step. New protocol identity fields need both a replacement rule and an exact verification rule.
- Keep recorder request correlation separate from callback order. Changes to observation events must preserve request grouping and complete channel lifetimes.
- Keep native recording's channel and raw-writer lifetimes explicit. Finalization must not accept overflow, an active producer, a cancelled transport lifetime, or an oversized raw report as complete evidence.
- Keep cassette report support, request matching, long-only transport behavior, and replay channel setup aligned.
- Keep exact matching ahead of HID++ 2.0 software-ID normalization. A broader match can consume the wrong exchange or hide an unexpected request.
- Keep the standard contribution operation list aligned with the operation allowlist and with any canonical fixture coverage.
- Keep the reviewed corpus operation list, diagnostic expectations, and
FixtureOperation::ALLaligned. A new capture operation needs an explicit reviewed expectation or a deliberate coverage decision. - Keep strict directory rules aligned with atomic publication. Temporary contribution state must never be accepted as a complete fixture.
- Keep repository corpus discovery owned by
openlogi-fixture::fs, and keep replay report formatting owned byopenlogi_fixture::format_hex. Do not add a second loader or formatter in a CLI or replay consumer. - Keep replay slot contracts aligned with cassette responses and production inventory transitions. Slot changes must not silently create firmware behavior that the cassette does not contain.
- Keep capture ownership and restoration aligned with channel lifetimes. A session must reuse its published channel, stop on replacement or a dead read path, and retry unfinished control or wheel restoration only through a valid current route.
- Keep capture retargeting and reporting policy aligned. A keyboard update must change only controls that join or leave the active set, and restoration must preserve remap state owned by other clients.
- Keep wheel diversion resolution aligned with restoration. If capture requests high-resolution reports, the restore plan must retain and return the prior native resolution.
- Keep profile support states aligned with route capabilities.
unavailablestill means that the route supports the feature, while an unknown offline capability must remain a capture error. - Keep receiver profile filtering aligned with fixture identity rules. A paired sibling without a usable unit ID or serial must not remain an unbindable profile route.
- Keep Easy-Switch profile support, host-slot sanitization, and capability validation aligned. A captured host list must describe the same route capability without retaining private host names.
- Keep schema rejection rules aligned across all nested profile and cassette values. New fields need an explicit schema decision rather than becoming silently accepted input.
- Keep new profile setting families aligned across Agent capture, schema defaults, capability validation, semantic replay, and the canonical profile. Older version-1 profiles must keep a defined meaning when a field is absent.
- Keep
openlogi list's Agent-first inventory view and direct-enumeration fallback distinct from fixture capture ownership rules. A discovery fallback must not be copied into profile or case capture. - Keep diagnostic feature-based device selection aligned with each diagnostic's required feature set. A new read or write scenario must not silently select an online device that cannot exercise it.
- Keep machine-readable API envelope fields, opaque device-ID selection, error codes, and persistence outcomes aligned. Scripts depend on these contracts rather than on human CLI text.
- Keep Agent-only backlight routing separate from direct diagnostic access. Backlight writes must report the Agent-confirmed state and must not claim success after a timeout or disconnect.
- Keep inventory replay's cache grace, channel retirement, replacement ordering, and broadcast-triggered reconciliation aligned. A change can turn a brief transport fault into a false reconnect or stale setting state.
- Keep receiver identity evidence separate from channel ownership. Pairing needs the receiver identity after inventory channels close, but confirmed disconnect must remove that evidence.
- Keep broadcast handling coalesced and revision-based. Several setting reports must cause one reconciliation without turning each report into a new device or a settings write.
- Keep new capture session scenarios aligned with strict replay cassettes. A session change must publish its channel before shared writes, consume all required exchanges, and restore every form of firmware ownership before it completes.
- Keep HID++ 1.0 case expectations separate from feature-table-based cases. A device without a feature table must not be made to claim feature-derived capability evidence.
- Keep new keyboard wanted-state fields aligned across capture retargeting and replay fixtures. Changes to the wanted set must not cause a full control-table reread or alter keys that remain active.
- Keep G-key row ownership aligned across keyboard wanted state, capture-session setup, strict cassette exchanges, and teardown. A session that takes the row must hand it back before completion.
- Keep pairing cancellation aligned with the notification flags that inventory owned before pairing. Cancellation must restore only the session's additions.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Profile capture starts without a responsive Agent | No semantic profile is written, and the CLI does not use a direct fallback | Start a compatible Agent and retry record profile. |
| An online semantic read fails or an offline device has unknown support | The profile is rejected before output, so it cannot state an unsafe capability fact | Treat failed reads as capture errors and stop instead of guessing. |
| A paired sibling has neither a usable unit ID nor a serial number | The sibling cannot get a fixture principal or settings binding | Drop only the identity-less sibling during capture, and never drop the selected device. |
| Direct case capture runs while the Agent owns the lock or accepts an uncertain endpoint | Two processes can open the same hardware or record mixed identities | Stop the Agent fully. Capture proceeds only after ownership and endpoint checks pass. |
| The resumed contribution uses a different route, slot, ID, or name | Profile and cases can describe different devices, so phase two stops | Reuse the original command metadata and the same structural route. |
| Recording overflows, stays open, or contains an unsafe exchange | Partial or private evidence could become a cassette | The bounded recorder and cassette audit reject the capture. |
| A standalone raw write is cancelled or fails, or a raw report exceeds the recording bound | The evidence cannot be treated as a successful hardware action | Preserve the terminal outcome and fail recording rather than publishing an incomplete raw event. |
| A cassette has an unexpected request or an unused required exchange | Production behavior can diverge from the captured operation | Require strict matching and complete cassette consumption during self-replay. |
| No sanitized candidate passes, or more than one candidate passes | Case capture cannot prove which channel represents the selected observation | Require exactly one candidate with the derived replay route, matching result, and complete consumption. |
| A request matches a broader rule before an exact exchange | Replay can consume the wrong response and hide a protocol change | Resolve exact requests first and normalize only the allowed HID++ 2.0 software-ID nibble. |
| Synthetic identities are missing, malformed, or occur at the wrong locations | Profile and protocol evidence can refer to different principals or expose source data | Generate identities from the shared policy and compare exact ledger occurrences. |
| A fixture directory has an extra, missing, or symlinked asset | The corpus can load a file that the manifest does not describe | Run fixture verify and keep only the declared non-symlink files. |
| Receiver responses contradict declared slot state | Replay may pass a response for an offline or empty link | Declare slot state in the replay topology and retain slot-state diagnostics. |
| A capture channel goes silent while its device still appears current | Captured input stops without a clear transport event, and a restart can reuse the dead channel | Use watched-session activity and repeated idle-ping results to report the channel dead and wait for inventory replacement. |
| A capture stops on channel replacement, an offline slot, or a route handoff | Restoration may write through an obsolete or unavailable transport, leaving controls or wheels diverted | Keep the pending restore plan and retry on the current or successor route selected by the stop reason. |
| Wake-feature discovery fails during capture setup | The session can remain live but unable to recover after the next device sleep | End the capture epoch, restore its controls, and let the supervisor retry discovery. |
| A capture or pairing session returns without restoring shared channel state | Later inventory or device work can use diverted reporting or stale discovery flags | Keep listening through restoration, clear only the owning capture slot, and restore the receiver flags that existed before pairing. |
| A high-resolution wheel divert is restored without its saved native resolution | Later scroll input can report high-resolution data as whole notches or keep the wheel in the wrong mode | Record the wheel resolution before arming and restore it through the route selected by the stop reason. |
| A keyboard binding change rereads or rewrites the full control set | An active key can lose its state or a remap owned by another client can change | Retarget only controls that leave or join the wanted set, then restore the controls owned by that session. |
| A G-key capture takes the gaming row but does not consume its restore exchange | Strict replay fails or the physical keyboard remains owned by the session after it ends | Treat the row as session-owned firmware state and require a hand-back before Restored. |
| A profile route lacks matching settings or declares support that its capabilities do not provide | Semantic mocks can expose a behavior that the inventory does not claim | Run profile validation and correct the route behavior before publication. |
| An Easy-Switch profile has empty or out-of-order slots, an invalid current slot, or host data on an unpaired slot | A semantic mock can expose a host layout that cannot represent the device | Sanitize captured host data and run profile validation before publication. |
| A profile or cassette adds an unknown field or an unsupported request mask | Different readers can assign different meanings to the same asset | Keep nested schema fields explicit and use only the defined exact or HID++ 2.0 match modes. |
openlogi list finds no HID++ device or webcam | The scan returns exit status 2, so a script can distinguish no hardware from an enumeration error | Handle NOTHING_FOUND as an empty result and inspect stderr or Agent status for access guidance. |
| Pointer-speed diagnostics cannot read back or restore the original value | The test cannot prove the write and may leave the device at a test setting | Restore before judging the write, and treat a failed or mismatched restore as a diagnostic failure. |
| A backlight command cannot connect to the Agent or loses the Agent during a write | The command cannot confirm the route or the final keyboard state, and it must not use direct hardware as a fallback | Keep the command Agent-only, report the outcome as unconfirmed, and read status before retrying. |
| An API write returns a successful transport result but the device read-back differs | A script can believe a setting changed when the device kept another state | Require read-back equality before returning ok: true. |
| API configuration save conflicts or Agent reload acknowledgement is lost after hardware read-back | Hardware state and saved configuration can differ, and the caller must know which side completed | Report persistence separately as not saved, saved, or unknown rather than collapsing the result into success. |
| Inventory replay retires a channel without respecting cache grace or replacement order | A brief fault can look like a disconnect, or a stale channel can survive after replacement | Test failure, retirement, reopen, and recovery as separate channel lifetimes. |
| Receiver identity evidence is cleared when inventory channels close | Pairing cannot identify a receiver that still exists but has no paired device route | Retain identity evidence until confirmed receiver disconnect, then clear it. |
| A setting or battery broadcast triggers separate reconciliations or a false reconnect | A burst can cause needless probes, stale settings, or reapplication of unrelated state | Coalesce the event burst and advance only the affected settings revision. |
| A dead report from a receiver-backed slot retires the shared receiver channel | Other paired devices lose a healthy transport because one slot stopped answering | Report dead only for an independently owned direct channel; keep a shared receiver channel published. |
| A new profile setting is omitted from an older profile or disagrees with inventory capabilities | Semantic replay can expose a setting that the profile does not support, or lose a known legacy meaning | Use explicit schema defaults and validate every present setting against the route capability facts. |
| A HID++ 1.0 device is treated as if it has a feature table | Case capture or review can claim evidence that the device cannot provide | Keep feature-table operations and HID++ 1.0 host-side behavior distinct. |
Key files
| File | Why to read it |
|---|---|
| crates/…/Cargo.toml | Shows that the CLI package owns the user-facing fixture commands and depends on the shared fixture contract. |
| crates/…/Cargo.toml | Defines the host-free fixture contract package. Its metadata and dependency boundary keep schemas and privacy checks usable by portable replay and published CLI tooling without host access or file I/O. |
| crates/…/fixture.rs | Defines the fixture command surface and the separation between profile, case, contribution, and verification work. |
| crates/…/record_profile.rs | Shows the Agent-only semantic capture boundary, route projection, setting capture, and support states for online, offline, and standalone routes. |
| crates/…/tests.rs | Shows the privacy, selection, read-safety, unavailable-setting, stable-output, Easy-Switch sanitization, force-sensing, and identity filtering guarantees of profile capture. |
| crates/…/record_case.rs | Shows direct read-only capture, ownership checks, target filtering, typed observation errors, and the operation allowlist. |
| crates/…/audit.rs | Shows how the capture reports identity replacements and rejects unsafe or incomplete cassette evidence. |
| crates/…/corpus_tests.rs | Shows reviewed semantic expectations for every contributed cassette and complete replay coverage. |
| crates/…/corpus_diagnostics.json | Stores the reviewed feature, control, and raw battery expectations for contributed specimens, including the wired G512 case. |
| crates/…/contribute.rs | Shows the resumable two-phase workflow, route matching, profile-only publication, and manifest publication. |
| crates/…/replay.rs | Shows sanitized route derivation, unique candidate selection, and production-operation self-replay. |
| crates/…/verify.rs | Shows offline fixture loading and directory-level checks. |
| crates/…/list.rs | Shows the Agent-first inventory discovery path, direct-enumeration fallback, empty-result exit status, and access guidance used before target capture. |
| crates/…/api.rs | Defines the machine-readable Agent automation surface, device selection contract, read-back checks, and stable JSON result boundary. |
| crates/…/persistence.rs | Defines how optional configuration changes are staged after identity checks and committed only after hardware confirmation. |
| crates/…/tests.rs | Shows stable API envelopes, exact device IDs, read-only behavior, write read-back, and persistence failure outcomes. |
| crates/…/diag.rs | Shows online device selection and dispatch for direct HID++ diagnostic scenarios. |
| crates/…/battery.rs | Shows the raw battery read used to inspect device-specific battery reports. |
| crates/…/pointer_speed.rs | Shows a write, read-back, and unconditional restore diagnostic for pointer scaling. |
| crates/…/backlight.rs | Shows the Agent-only backlight route, supported action selection, confirmed state output, and no-fallback boundary. |
| crates/…/agent_routing.rs | Shows route selection, capability checks, no-retry behavior, and confirmed Agent read-back for backlight exercises. |
| crates/…/camera.rs | Shows the CLI read and write path for device-level camera controls. |
| crates/…/recording.rs | Defines the bounded native evidence boundary, opt-in recording backend, channel and raw-writer lifetimes, and finalization rules. |
| crates/…/cassette.rs | Defines which captured channel evidence can become a cassette. |
| crates/…/sanitizer.rs | Defines relation-preserving protocol identity replacement. |
| crates/…/schema.rs | Defines the shared semantic profile, setting states, compatibility defaults, report rules, and HID cassette contracts. |
| crates/…/generate.rs | Builds manifest relationships from already sanitized assets. |
| crates/…/identity.rs | Defines canonical synthetic identity forms. |
| crates/…/verify.rs | Defines cross-asset schema, relationship, privacy, and replay checks. |
| crates/…/fs.rs | Owns strict fixture and corpus loading for CLI verification and workspace tests. |
| crates/…/tests.rs | Shows the loader's rejection of missing, extra, undeclared, symlinked, and unsafe fixture assets. |
| crates/…/backend.rs | Defines the mutable virtual topology used by self-replay and device tests. |
| crates/…/channel.rs | Defines strict request matching, slot-state-safe response delivery, and completion diagnostics. |
| crates/…/slots.rs | Defines receiver-slot state checks without emulating receiver firmware. |
| crates/…/capture.rs | Defines the shared capture-session lifecycle, channel reuse, reconnect handling, retargeting, liveness checks, and stop conditions. |
| crates/…/capture_restore.rs | Defines capture ownership, restoration plans, route-aware retry, wheel resolution restoration, and preservation of other control mappings. |
| crates/…/replay_test_support.rs | Builds direct-device and receiver-slot scenarios that show how virtual topology and cassette evidence relate. |
| crates/…/replay_tests.rs | Demonstrates receiver identity retention, interleaved receiver slots, bounded repair, cache grace, channel replacement, dead-channel reports, battery and setting reconciliation, and response barriers. |
| crates/…/session_replay_tests.rs | Demonstrates capture-session reporting restoration, G-key row ownership, in-place keyboard retargeting, failed wake discovery cleanup, dead-session boundaries, and pairing cancellation cleanup. |
| crates/…/tests.rs | Demonstrates schema strictness, request matching, direct and receiver production probes, write read-back, topology changes, capability validation, and cassette completion. |
| crates/…/tests.rs | Demonstrates identity sanitization, report-form handling, rejection of unsafe evidence, and replay under a new software-ID lease. |
| crates/…/tests.rs | Demonstrates request correlation, unmatched and malformed evidence retention, raw-writer outcomes, bounded recording, and explicit close behavior. |
| crates/…/profile.json | Provides the canonical synthetic profile shape across receiver, direct, offline, and raw-HID routes, including route-keyed setting support. |
| crates/…/manifest.json | Provides the canonical profile-only identity ledger and route relationships. |