@@ -5,6 +5,7 @@ import (
55 "testing"
66
77 "github.com/stretchr/testify/assert"
8+ "github.com/stretchr/testify/require"
89)
910
1011func TestPermissionService_AllowedCommands(t *testing.T) {
@@ -81,14 +82,16 @@ func TestPermissionService_AllowedCommands(t *testing.T) {
8182func TestPermissionService_SkipMode(t *testing.T) {
8283 service := NewPermissionService("/tmp", true, []string{})
8384
84− result := service.Request(CreatePermissionRequest{
85+ result, err := service.Request(t.Context(), CreatePermissionRequest{
8586 SessionID: "test-session",
8687 ToolName: "bash",
8788 Action: "execute",
8889 Description: "test command",
8990 Path: "/tmp",
9091 })
91−
92+ if err != nil {
93+ t.Errorf("unexpected error: %v", err)
94+ }
9295 if !result {
9396 t.Error("expected permission to be granted in skip mode")
9497 }
@@ -115,7 +118,7 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
115118
116119 go func() {
117120 defer wg.Done()
118− result1 = service.Request(req1)
121+ result1, _ = service.Request(t.Context(), req1)
119122 }()
120123
121124 var permissionReq PermissionRequest
@@ -136,7 +139,8 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
136139 Params: map[string]string{"file": "test.txt"},
137140 Path: "/tmp/test.txt",
138141 }
139− result2 := service.Request(req2)
142+ result2, err := service.Request(t.Context(), req2)
143+ require.NoError(t, err)
140144 assert.True(t, result2, "Second request should be auto-approved")
141145 })
142146 t.Run("Sequential requests with temporary grants", func(t *testing.T) {
@@ -156,7 +160,7 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
156160 var wg sync.WaitGroup
157161
158162 wg.Go(func() {
159− result1 = service.Request(req)
163+ result1, _ = service.Request(t.Context(), req)
160164 })
161165
162166 var permissionReq PermissionRequest
@@ -170,7 +174,7 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
170174 var result2 bool
171175
172176 wg.Go(func() {
173− result2 = service.Request(req)
177+ result2, _ = service.Request(t.Context(), req)
174178 })
175179
176180 event = <-events
@@ -215,7 +219,8 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
215219 wg.Add(1)
216220 go func(index int, request CreatePermissionRequest) {
217221 defer wg.Done()
218− results = append(results, service.Request(request))
222+ result, _ := service.Request(t.Context(), request)
223+ results = append(results, result)
219224 }(i, req)
220225 }
221226
@@ -241,7 +246,8 @@ func TestPermissionService_SequentialProperties(t *testing.T) {
241246 assert.Equal(t, 2, grantedCount, "Should have 2 granted and 1 denied")
242247 secondReq := requests[1]
243248 secondReq.Description = "Repeat of second request"
244− result := service.Request(secondReq)
249+ result, err := service.Request(t.Context(), secondReq)
250+ require.NoError(t, err)
245251 assert.True(t, result, "Repeated request should be auto-approved due to persistent permission")
246252 })
247253}