Add lease-bound Remote key IPC and SDK validation

This commit is contained in:
ak47 committed 2026-11-05 21:28:29 -05:00
1 parent 9ac33560dc
commit 792cac5d0b
12 files changed
+807 -9

No files matched your search

+8 -4
View File
@@ -79,9 +79,10 @@ func sessionSDKProgram(t *testing.T, language string) []string {
return []string{python, "-B", peer}
}
func startSessionSDK(t *testing.T, manager *Manager, language, id string) *Session {
func startSessionSDK(t *testing.T, manager *Manager, language, id string, extraGrants ...string) *Session {
t.Helper()
session, err := manager.Start(t.Context(), Spec{ID: id, Program: sessionSDKProgram(t, language), SessionEvents: true, RemoteGrants: []string{"output-observe", "remote-present", "clipboard-exchange"}})
grants := append([]string{"output-observe", "remote-present", "clipboard-exchange"}, extraGrants...)
session, err := manager.Start(t.Context(), Spec{ID: id, Program: sessionSDKProgram(t, language), SessionEvents: true, RemoteGrants: grants})
if err != nil {
t.Fatal(err)
}
@@ -214,8 +215,11 @@ func TestSessionSDKLifecycleConformance(t *testing.T) {
if _, err := session.RemoteContext(lease, "clipboard-exchange"); !errors.Is(err, ErrPermission) {
t.Fatal("install grant became session grant")
}
if _, code := remoteCall(t, session, "remote.key", map[string]any{}); code != -32601 {
t.Fatal("unimplemented desktop operation accepted")
if _, code := remoteCall(t, session, "remote.key", map[string]any{}); code != -32602 {
t.Fatal("malformed typed key operation accepted", code)
}
if _, code := remoteCall(t, session, "remote.braille", map[string]any{}); code != -32601 {
t.Fatal("unimplemented desktop operation accepted", code)
}
// One blocked handler cannot block the endpoint receive loop or lifecycle calls.
waiting, err := session.Invoke(t.Context(), "wait", nil)