mirror of
https://github.com/lahfir/agent-desktop.git
synced 2026-07-27 01:22:16 +00:00
fix: report PLATFORM_NOT_SUPPORTED instead of PERM_DENIED on stub adapters
The default SystemOps::permission_report returned accessibility Denied, so the CLI preflight short-circuited before dispatch and told Windows and Linux users they had a permissions problem. They do not; those adapters are unimplemented, and the suggested fix does not exist. An adapter that never overrides the probe has not measured permissions at all, which is a different fact from a user denying one. Reporting Unknown lets preflight pass so the call reaches the adapter and surfaces the honest PLATFORM_NOT_SUPPORTED. The skills reference assertion is gated to macOS because the macOS reference document is itself cfg-gated into the binary.
This commit is contained in:
parent
dc5af05753
commit
a341bfbea9
3 changed files with 19 additions and 4 deletions
|
|
@ -15,11 +15,13 @@ pub trait SystemOps: Send + Sync {
|
|||
Err(AdapterError::not_supported("acquire_interaction_lease"))
|
||||
}
|
||||
|
||||
/// An adapter that never overrides this has not probed permissions at all,
|
||||
/// which is not the same fact as a user denying one. `Unknown` routes through
|
||||
/// `unknown_accessibility_means_unsupported` to `PLATFORM_NOT_SUPPORTED`
|
||||
/// rather than the misleading `PERM_DENIED`.
|
||||
fn permission_report(&self, _deadline: Deadline) -> Result<PermissionReport, AdapterError> {
|
||||
Ok(PermissionReport {
|
||||
accessibility: PermissionState::Denied {
|
||||
suggestion: "Platform adapter not available".into(),
|
||||
},
|
||||
accessibility: PermissionState::Unknown,
|
||||
screen_recording: PermissionState::Unknown,
|
||||
automation: PermissionState::NotRequired,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -18,6 +18,17 @@ fn default_surfaces_fail_closed() {
|
|||
assert!(DefaultOnly.supported_surfaces().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_permission_report_is_unknown_not_denied() {
|
||||
let report = DefaultOnly
|
||||
.permission_report(crate::Deadline::standard().unwrap())
|
||||
.expect("default permission report must not error");
|
||||
|
||||
assert_eq!(report.accessibility, crate::PermissionState::Unknown);
|
||||
assert!(!report.accessibility_denied());
|
||||
assert!(DefaultOnly.unknown_accessibility_means_unsupported());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn default_open_session_is_explicitly_unsupported() {
|
||||
let affinity = crate::SessionAffinity {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ fn get_full_inlines_references() {
|
|||
.expect("get full");
|
||||
let content = v["content"].as_str().expect("string");
|
||||
assert!(content.contains("--- references/workflows.md ---"));
|
||||
assert!(content.contains("--- references/macos.md ---"));
|
||||
if cfg!(target_os = "macos") {
|
||||
assert!(content.contains("--- references/macos.md ---"));
|
||||
}
|
||||
assert!(content.contains("@s8f3k2p9:e1"));
|
||||
assert!(content.contains("session start` does not activate later processes"));
|
||||
assert!(content.contains("session-owned ref still requires the same `--session`"));
|
||||
|
|
|
|||
Loading…
Reference in a new issue