Skip to content

Lab: enforce device ownership before hardware opens - #237

Merged
dayfine merged 7 commits into
lab/mainfrom
lab/device-ownership
Nov 6, 2026
Merged

dayfine merged 7 commits into
lab/mainfrom
lab/device-ownership

Conversation

@dayfine

@dayfine dayfine commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

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.json allowlist, 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 LabDeviceAccessQt for policy and process locks, then LabDeviceRuntime for 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: false package marker is not a runtime capability test; verify the deployed revision instead.

Parent refresh: merged current lab/main after #236 landed. Intended-base code health and all 16 preparation-tool tests pass; the focused native lease test executable passes. At refreshed head f0b4bd4c0, 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.

Base automatically changed from lab/profile-preparation to lab/main November 6, 2026 22:10
@dayfine
dayfine marked this pull request as ready for review November 6, 2026 22:42
@dayfine
dayfine merged commit 83dec64 into lab/main Nov 6, 2026
18 of 22 checks passed
@dayfine
dayfine deleted the lab/device-ownership branch November 6, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant