Repository navigation
Lab: enforce device ownership before hardware opens - #237
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
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.
Base:
lab/main, which now includes merged #236. The updated branch merges that parent without rewriting history; this diff contains only device ownership (PR2).A separate profile does not stop a test app from opening another console's serial/capture device. macOS GUI lab builds now reserve their profile before settings startup, require a matching
lab-devices.jsonallowlist, and acquire a shared per-device process lease before native serial, camera or audio-input construction. Missing/mismatched policies and busy devices fail closed. Serial identities use freshly resolved USB VID/PID/serial; tty/cu aliases share a lease and ambiguous duplicate USB identities are rejected.Leases survive through native close. Failed serial setup releases them after resource cleanup. Capture rejection is handled inside Qt callbacks, and audio reconfiguration closes the old input before constructing the replacement. Windows/Linux and GUI-free CoreLib do not acquire runtime lab leases; the shared audio replacement ordering applies to all GUI platforms.
How to review
Read
LabDeviceAccessQtfor policy and process locks, thenLabDeviceRuntimefor the macOS adapter, then the serial/QCameraThread/audio call sites. Native tables and the small GUI-free test runner sit beside those sources. The audio helper consolidates the existing teardown sequence and moves it before replacement construction. The camera diffs also remove obsolete disabled error handlers. No application source is moved between files.Setup, identities and limits.
Validation at
45afc7eb0: 29 focused native cases pass on macOS with real locks/subprocesses and scripted opens; the 16 preparation-tool tests pass; code health passes against #236. A focused CMake target and macOS/Linux/Windows CI exercise the same native cases, also registered in the application test database. The local Qt installation lacks SerialPort, so full runtime-adapter/application compilation needs CI. No live profiles, permissions, apps or consoles were changed.Locks are cooperative and per user: old unguarded binaries are not excluded. This is not authorization for a hardware run. Real driver close/replug/permissions behavior still needs separate live validation. #236's older
hardware_ownership_enforced: falsepackage marker is not a runtime capability test; verify the deployed revision instead.Parent refresh: merged current
lab/mainafter #236 landed. Intended-base code health and all 16 preparation-tool tests pass; the focused native lease test executable passes. At refreshed headf0b4bd4c0, device-ownership CI passes on macOS/Linux/Windows, offline-preparation CI passes on macOS/Linux, and code health passes. Full application build jobs remain skipped for the draft; focused native tests do not establish full runtime-adapter compilation. Device CI.