-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add no-result permission handling for extensions #802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0c1b8e
9ae7eac
42474eb
5e31212
f1681db
1cb363a
0938b0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ public void WellKnownKinds_HaveExpectedValues() | |
| Assert.Equal("denied-by-rules", PermissionRequestResultKind.DeniedByRules.Value); | ||
| Assert.Equal("denied-no-approval-rule-and-could-not-request-from-user", PermissionRequestResultKind.DeniedCouldNotRequestFromUser.Value); | ||
| Assert.Equal("denied-interactively-by-user", PermissionRequestResultKind.DeniedInteractivelyByUser.Value); | ||
| Assert.Equal("no-result", new PermissionRequestResultKind("no-result").Value); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cross-SDK Consistency: .NET is missing behavioral tests for the TypeScript has comprehensive tests:
Python has:
Suggestion: Add tests to verify:
Example test structure: [Fact]
public async Task V3PermissionNoResult_DoesNotRespond()
{
// Similar to nodejs test: verify HandlePendingPermissionRequestAsync is not called
}
[Fact]
public async Task V2PermissionAdapter_RejectsNoResult()
{
// Verify OnPermissionRequestV2 throws InvalidOperationException when handler returns no-result
} |
||
| } | ||
|
|
||
| [Fact] | ||
|
|
@@ -115,6 +116,7 @@ public void JsonRoundTrip_PreservesAllKinds() | |
| PermissionRequestResultKind.DeniedByRules, | ||
| PermissionRequestResultKind.DeniedCouldNotRequestFromUser, | ||
| PermissionRequestResultKind.DeniedInteractivelyByUser, | ||
| new PermissionRequestResultKind("no-result"), | ||
| }; | ||
|
|
||
| foreach (var kind in kinds) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -51,6 +51,8 @@ import ( | |||||
| "github.com/github/copilot-sdk/go/rpc" | ||||||
| ) | ||||||
|
|
||||||
| const noResultPermissionV2Error = "permission handlers cannot return 'no-result' when connected to a protocol v2 server" | ||||||
|
||||||
| const noResultPermissionV2Error = "permission handlers cannot return 'no-result' when connected to a protocol v2 server" | |
| const noResultPermissionV2Error = "Permission handlers cannot return 'no-result' when connected to a protocol v2 server." |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ func TestPermissionRequestResultKind_Constants(t *testing.T) { | |
| {"DeniedByRules", PermissionRequestResultKindDeniedByRules, "denied-by-rules"}, | ||
| {"DeniedCouldNotRequestFromUser", PermissionRequestResultKindDeniedCouldNotRequestFromUser, "denied-no-approval-rule-and-could-not-request-from-user"}, | ||
| {"DeniedInteractivelyByUser", PermissionRequestResultKindDeniedInteractivelyByUser, "denied-interactively-by-user"}, | ||
| {"NoResult", PermissionRequestResultKind("no-result"), "no-result"}, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cross-SDK Consistency: Go is missing behavioral tests for the TypeScript has comprehensive tests:
Python has:
Suggestion: Add tests in Go to verify:
This ensures the behavior is tested and won't regress. |
||
| } | ||
|
|
||
| for _, tt := range tests { | ||
|
|
@@ -42,6 +43,7 @@ func TestPermissionRequestResult_JSONRoundTrip(t *testing.T) { | |
| {"DeniedByRules", PermissionRequestResultKindDeniedByRules}, | ||
| {"DeniedCouldNotRequestFromUser", PermissionRequestResultKindDeniedCouldNotRequestFromUser}, | ||
| {"DeniedInteractivelyByUser", PermissionRequestResultKindDeniedInteractivelyByUser}, | ||
| {"NoResult", PermissionRequestResultKind("no-result")}, | ||
| {"Custom", PermissionRequestResultKind("custom")}, | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The v2 adapter now throws when a permission handler returns
NoResult, but the .NET test suite here only validates the new kind constant. Adding a test that drivesOnPermissionRequestV2(or the underlying session handler) and asserts thatNoResultcauses an exception would lock in the intended “fail loudly” behavior.