diff --git a/crates/midra-layout/src/device.rs b/crates/midra-layout/src/device.rs index 9a50bc7..02f1e31 100644 --- a/crates/midra-layout/src/device.rs +++ b/crates/midra-layout/src/device.rs @@ -53,21 +53,32 @@ fn number(v: &Value, path: &str) -> Result { .filter(|n| n.is_finite()) .ok_or_else(|| format!("Invalid device number {path}")) } +fn supported_identity(identity: &Value) -> Result { + let kind = text(identity, "/type")?; + if kind.starts_with("AQL") || kind.to_ascii_lowercase().contains("aquilon") { + return Err(format!( + "Aquilon / LivePremier ({kind}) is not supported yet; its separate device adapter is not implemented. This build supports Midra 4K connections only." + )); + } + if !matches!( + kind.as_str(), + "Eikos 4K" | "Pulse 4K" | "QuickVu 4K" | "QuickMatrix 4K" + ) { + return Err(format!( + "Unsupported device {kind}; expected a Midra 4K switcher (Eikos, Pulse, QuickVu or QuickMatrix)." + )); + } + let version = ["major", "minor", "patch"].map(|k| number(identity, &format!("/version/{k}"))); + let [major, minor, patch] = version; + Ok(format!( + "{kind} · firmware {}.{}.{}", + major?, minor?, patch? + )) +} + impl Snapshot { pub fn parse(identity: &Value, raw: &Value) -> Result { - let kind = text(identity, "/type")?; - if !matches!( - kind.as_str(), - "Eikos 4K" | "Pulse 4K" | "QuickVu 4K" | "QuickMatrix 4K" - ) { - return Err(format!( - "Unsupported device {kind}; expected a Midra 4K switcher (Eikos, Pulse, QuickVu or QuickMatrix)." - )); - } - let version = - ["major", "minor", "patch"].map(|k| number(identity, &format!("/version/{k}"))); - let [major, minor, patch] = version; - let identity = format!("{kind} · firmware {}.{}.{}", major?, minor?, patch?); + let identity = supported_identity(identity)?; let device = value(raw, "/device")?; let items = value(device, "/screenList/items")? .as_object() @@ -339,7 +350,7 @@ pub fn address(host: &str) -> Result { Ok(address) } -/// Perform two GET requests on an explicit IP and optional port. Call from a worker thread. +/// Read identity first; fetch state only for supported devices. Call from a worker thread. pub fn fetch(host: &str) -> Result { let authority = address(host)?; let client = reqwest::blocking::Client::builder() @@ -349,6 +360,7 @@ pub fn fetch(host: &str) -> Result { .build() .map_err(|e| e.to_string())?; let identity = read_json(&client, &format!("http://{authority}/api/tpp/v1/system"))?; + supported_identity(&identity)?; let state = read_json(&client, &format!("http://{authority}/api/stores/device"))?; Snapshot::parse(&identity, &state) } diff --git a/crates/midra-layout/tests/device.rs b/crates/midra-layout/tests/device.rs index 2d1ab11..12acf6f 100644 --- a/crates/midra-layout/tests/device.rs +++ b/crates/midra-layout/tests/device.rs @@ -309,3 +309,46 @@ fn fractional_device_content_rounds_with_a_nonblocking_warning() { .is_none() ); } + +#[test] +fn aquilon_identity_is_rejected_before_requesting_large_state() { + use std::io::{BufRead, BufReader, Write}; + let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); + let host = listener.local_addr().unwrap().to_string(); + let server = std::thread::spawn(move || { + let (mut stream, _) = listener.accept().unwrap(); + let mut reader = BufReader::new(stream.try_clone().unwrap()); + let mut line = String::new(); + reader.read_line(&mut line).unwrap(); + assert_eq!(line, "GET /api/tpp/v1/system HTTP/1.1\r\n"); + loop { + line.clear(); + reader.read_line(&mut line).unwrap(); + if line == "\r\n" { + break; + } + } + let body = r#"{"type":"AQL Cmax","version":{"major":6,"minor":2,"patch":79}}"#; + write!( + stream, + "HTTP/1.1 200 OK\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{body}", + body.len() + ) + .unwrap(); + listener + }); + let error = midra_layout::device::fetch(&host).unwrap_err(); + let listener = server.join().unwrap(); + assert!(error.contains("Aquilon / LivePremier"), "{error}"); + assert!(error.contains("not supported yet"), "{error}"); + listener.set_nonblocking(true).unwrap(); + assert_eq!( + listener.accept().unwrap_err().kind(), + std::io::ErrorKind::WouldBlock + ); + assert!( + Snapshot::parse(&json!({"type":"AQL Cmax"}), &json!({})) + .unwrap_err() + .contains("Aquilon") + ); +} diff --git a/docs/interfaces/midra-device-import.md b/docs/interfaces/midra-device-import.md index b99b755..c552c5c 100644 --- a/docs/interfaces/midra-device-import.md +++ b/docs/interfaces/midra-device-import.md @@ -11,6 +11,9 @@ Hardware evidence and usage: [Eikos check](../midra-layout/device-check.md). or custom wrapper is added. This is **vendor state**, not a Midra Layout project. The firmware owns its schema. The Rust adapter accepts Eikos 4K, Pulse 4K, QuickVu 4K and QuickMatrix 4K identities and validates the shared state fields. +The Rust connection checks identity before downloading the device store: unsupported +families, including Aquilon/LivePremier, receive an explicit compatibility error. +Its supported Midra state reads remain capped at 32 MiB. Reads were checked on Eikos 4K 3.3.10 hardware and the Pulse 4K 3.3.7 emulator (one 1920 × 1080 screen with four allocated layers). QuickVu and QuickMatrix have synthetic parser coverage; physical acceptance remains outstanding. diff --git a/docs/midra-layout/aquilon-compatibility.md b/docs/midra-layout/aquilon-compatibility.md index 4ff3ffb..040d7bb 100644 --- a/docs/midra-layout/aquilon-compatibility.md +++ b/docs/midra-layout/aquilon-compatibility.md @@ -4,7 +4,20 @@ Investigated 2026-11-15. **Aquilon is not yet enabled in the application.** This review compared the current Rust adapter with upstream protocol references; -it did not connect to an Aquilon or alter the Midra emulator being tested. +The initial review did not connect to an Aquilon. A subsequent read-only emulator +probe on 2026-11-15 confirmed the transport details below; no settings were changed. + +## Emulator response-size diagnosis + +Read-only GETs at the user-supplied emulator confirmed `/api/tpp/v1/system` +returns `type: "AQL Cmax"`, firmware **6.2.79**, and `/api/stores/device` returns +**124,076,981 bytes** (about 118 MiB). This exceeds the current Midra 32 MiB state +limit. Raising that limit alone would still fail at the unsupported-family check. +The connection now validates identity before requesting state and explains that +Aquilon needs its separate adapter. The large private response is not committed. +Future Aquilon transport work must account for this measured state size, ideally +with targeted reads rather than repeated full-store downloads. These reads do not +validate geometry, crop, bank resolution, capture or writes. ## Finding @@ -90,5 +103,5 @@ No upstream code or new dependency was copied into the application. claiming the entire range from one identity string. No persistent schema or device-send contract changes are made by this research. -The next practical input is an Aquilon emulator address and firmware version; -there is no need to interrupt Midra testing to obtain it now. +The emulator address and firmware are now known; next inspect the captured state +and derive sanitized fixtures before implementing the family-specific adapter. diff --git a/docs/midra-layout/changelog.md b/docs/midra-layout/changelog.md index 2502198..22602e4 100644 --- a/docs/midra-layout/changelog.md +++ b/docs/midra-layout/changelog.md @@ -4,6 +4,11 @@ ## Unreleased +- Validate device identity before downloading state. Aquilon now reports its + unimplemented adapter instead of a misleading 32 MiB limit error. A read-only + AQL Cmax 6.2.79 emulator probe measured a 118 MiB store; Aquilon connectivity + remains pending. Mock HTTP coverage checks that no state request is made. + - Record user acceptance of Figma FIG, FigCraft FIGCRAFT, DXF and DWG import/export; mark these format issues solved in the plan and compatibility notes. diff --git a/docs/midra-layout/plan.md b/docs/midra-layout/plan.md index db5b947..c03900c 100644 --- a/docs/midra-layout/plan.md +++ b/docs/midra-layout/plan.md @@ -67,7 +67,7 @@ device readback and physical-screen acceptance. ## Remaining feature work -- [ ] **Aquilon / LivePremier adapter.** [Protocol investigation and implementation sequence](aquilon-compatibility.md) completed. Next: emulator baseline, firmware-aware geometry import, family-aware saved links, send/apply/readback, then verified crop and capture support. Aquilon is not enabled yet. +- [ ] **Aquilon / LivePremier adapter.** [Protocol investigation and implementation sequence](aquilon-compatibility.md) completed. A read-only AQL Cmax 6.2.79 emulator probe confirmed identity and a 118 MiB state store; unsupported identities now fail before state download. Next: sanitized emulator fixtures, firmware-aware geometry import, family-aware saved links, send/apply/readback, then verified crop and capture support. Aquilon is not enabled yet. - [ ] **Further export/workflow cleanup.** Shared transfer scopes, mapping review and direct linked send/load are implemented; further changes await specifications.