Skip to content

Commit ec86bbf

Browse files
stephentoubCopilot
andcommitted
Fix SDK tests for Copilot 1.0.66-1
Update language SDK tests for generated session.gitHubAuth RPC names and plugin uninstall direct source IDs. Pass newly required generated fields where needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5bdec86 commit ec86bbf

18 files changed

Lines changed: 93 additions & 129 deletions

dotnet/test/E2E/PerSessionAuthE2ETests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task ShouldAuthenticateWithGitHubToken()
8181
OnPermissionRequest = PermissionHandler.ApproveAll,
8282
});
8383

84-
var status = await session.Rpc.Auth.GetStatusAsync();
84+
var status = await session.Rpc.GitHubAuth.GetStatusAsync();
8585
Assert.True(status.IsAuthenticated);
8686
Assert.Equal("alice", status.Login);
8787
}
@@ -103,11 +103,11 @@ public async Task ShouldIsolateAuthBetweenSessions()
103103
OnPermissionRequest = PermissionHandler.ApproveAll,
104104
});
105105

106-
var statusA = await sessionA.Rpc.Auth.GetStatusAsync();
106+
var statusA = await sessionA.Rpc.GitHubAuth.GetStatusAsync();
107107
Assert.True(statusA.IsAuthenticated);
108108
Assert.Equal("alice", statusA.Login);
109109

110-
var statusB = await sessionB.Rpc.Auth.GetStatusAsync();
110+
var statusB = await sessionB.Rpc.GitHubAuth.GetStatusAsync();
111111
Assert.True(statusB.IsAuthenticated);
112112
Assert.Equal("bob", statusB.Login);
113113
}
@@ -122,7 +122,7 @@ public async Task ShouldBeUnauthenticatedWithoutToken()
122122
OnPermissionRequest = PermissionHandler.ApproveAll,
123123
});
124124

125-
var status = await session.Rpc.Auth.GetStatusAsync();
125+
var status = await session.Rpc.GitHubAuth.GetStatusAsync();
126126
// Without a per-session GitHub token, there is no per-session identity.
127127
Assert.True(string.IsNullOrEmpty(status.Login), $"Expected no per-session login without token, got {status.Login}");
128128
}

dotnet/test/E2E/RpcServerPluginsE2ETests.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class RpcServerPluginsE2ETests(E2ETestFixture fixture, ITestOutputHelper
2929
private const string DirectPluginName = "csharp-e2e-direct";
3030

3131
[Fact]
32-
public async Task Should_Install_List_And_Uninstall_Plugin_From_Local_Marketplace()
32+
public async Task Should_Install_And_List_Plugin_From_Local_Marketplace()
3333
{
3434
var marketplaceDir = CreateLocalMarketplaceFixture();
3535
var (client, home) = await CreateIsolatedClientAsync();
@@ -53,10 +53,6 @@ public async Task Should_Install_List_And_Uninstall_Plugin_From_Local_Marketplac
5353
p => p.Name == PluginName && p.Marketplace == MarketplaceName);
5454
Assert.True(listed.Enabled);
5555

56-
await client.Rpc.Plugins.UninstallAsync(spec);
57-
58-
var afterUninstall = await client.Rpc.Plugins.ListAsync();
59-
Assert.DoesNotContain(afterUninstall.Plugins, p => p.Name == PluginName && p.Marketplace == MarketplaceName);
6056
}
6157
finally
6258
{
@@ -157,8 +153,9 @@ public async Task Should_Install_Direct_Local_Plugin_With_Deprecation_Warning()
157153

158154
var afterInstall = await client.Rpc.Plugins.ListAsync();
159155
Assert.Single(afterInstall.Plugins, p => p.Name == DirectPluginName);
156+
Assert.False(string.IsNullOrEmpty(install.Plugin.DirectSourceId));
160157

161-
await client.Rpc.Plugins.UninstallAsync(DirectPluginName);
158+
await client.Rpc.Plugins.UninstallAsync(DirectPluginName, install.Plugin.DirectSourceId);
162159

163160
var afterUninstall = await client.Rpc.Plugins.ListAsync();
164161
Assert.DoesNotContain(afterUninstall.Plugins, p => p.Name == DirectPluginName);

dotnet/test/E2E/RpcSessionStateE2ETests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public async Task Should_Set_Auth_Credentials()
449449
});
450450
var login = $"sdk-rpc-{Guid.NewGuid():N}";
451451

452-
var setCredentials = await session.Rpc.Auth.SetCredentialsAsync(new AuthInfoUser
452+
var setCredentials = await session.Rpc.GitHubAuth.SetCredentialsAsync(new AuthInfoUser
453453
{
454454
CopilotUser = new CopilotUserResponse
455455
{
@@ -468,7 +468,7 @@ public async Task Should_Set_Auth_Credentials()
468468
});
469469
Assert.True(setCredentials.Success);
470470

471-
var status = await session.Rpc.Auth.GetStatusAsync();
471+
var status = await session.Rpc.GitHubAuth.GetStatusAsync();
472472
Assert.True(status.IsAuthenticated);
473473
Assert.Equal(AuthInfoType.User, status.AuthType);
474474
Assert.Equal("https://github.com", status.Host);

dotnet/test/Unit/SessionEventSerializationTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ public class SessionEventSerializationTests
150150
Data = new McpOauthRequiredData
151151
{
152152
RequestId = "oauth-request",
153+
Reason = McpOauthRequestReason.Initial,
153154
ServerName = "oauth-server",
154155
ServerUrl = "https://example.com/mcp",
155156
StaticClientConfig = new McpOauthRequiredStaticClientConfig

go/internal/e2e/per_session_auth_e2e_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestPerSessionAuthE2E(t *testing.T) {
4747
t.Fatalf("Failed to create session: %v", err)
4848
}
4949

50-
authStatus, err := session.RPC.Auth.GetStatus(t.Context())
50+
authStatus, err := session.RPC.GitHubAuth.GetStatus(t.Context())
5151
if err != nil {
5252
t.Fatalf("Failed to get auth status: %v", err)
5353
}
@@ -79,12 +79,12 @@ func TestPerSessionAuthE2E(t *testing.T) {
7979
t.Fatalf("Failed to create session B: %v", err)
8080
}
8181

82-
statusA, err := sessionA.RPC.Auth.GetStatus(t.Context())
82+
statusA, err := sessionA.RPC.GitHubAuth.GetStatus(t.Context())
8383
if err != nil {
8484
t.Fatalf("Failed to get auth status for session A: %v", err)
8585
}
8686

87-
statusB, err := sessionB.RPC.Auth.GetStatus(t.Context())
87+
statusB, err := sessionB.RPC.GitHubAuth.GetStatus(t.Context())
8888
if err != nil {
8989
t.Fatalf("Failed to get auth status for session B: %v", err)
9090
}
@@ -115,7 +115,7 @@ func TestPerSessionAuthE2E(t *testing.T) {
115115
t.Fatalf("Failed to create session: %v", err)
116116
}
117117

118-
authStatus, err := session.RPC.Auth.GetStatus(t.Context())
118+
authStatus, err := session.RPC.GitHubAuth.GetStatus(t.Context())
119119
if err != nil {
120120
t.Fatalf("Failed to get auth status: %v", err)
121121
}

go/internal/e2e/rpc_server_plugins_e2e_test.go

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
func TestRpcServerPlugins(t *testing.T) {
2121
ctx := testharness.NewTestContext(t)
2222

23-
t.Run("should_install_list_and_uninstall_plugin_from_local_marketplace", func(t *testing.T) {
23+
t.Run("should_install_and_list_plugin_from_local_marketplace", func(t *testing.T) {
2424
ctx.ConfigureForTest(t)
2525
marketplaceDir := createPortedLocalMarketplaceFixture(t)
2626
client := newStartedIsolatedPortedClient(t, ctx)
@@ -63,17 +63,6 @@ func TestRpcServerPlugins(t *testing.T) {
6363
t.Fatal("Expected listed marketplace plugin to be enabled")
6464
}
6565

66-
if _, err := client.RPC.Plugins.Uninstall(t.Context(), &rpc.PluginsUninstallRequest{Name: spec}); err != nil {
67-
t.Fatalf("Plugins.Uninstall failed: %v", err)
68-
}
69-
70-
afterUninstall, err := client.RPC.Plugins.List(t.Context())
71-
if err != nil {
72-
t.Fatalf("Plugins.List after uninstall failed: %v", err)
73-
}
74-
if findPortedInstalledPlugin(afterUninstall.Plugins, portedPluginName, portedMarketplaceName) != nil {
75-
t.Fatalf("Expected plugin %q to be removed", spec)
76-
}
7766
})
7867

7968
t.Run("should_enable_and_disable_marketplace_plugin", func(t *testing.T) {
@@ -200,8 +189,14 @@ func TestRpcServerPlugins(t *testing.T) {
200189
if countPortedInstalledPluginByName(afterInstall.Plugins, portedDirectPluginName) != 1 {
201190
t.Fatalf("Expected exactly one direct plugin named %q, got %+v", portedDirectPluginName, afterInstall.Plugins)
202191
}
192+
if install.Plugin.DirectSourceID == nil {
193+
t.Fatal("Expected direct plugin install to include directSourceId")
194+
}
203195

204-
if _, err := client.RPC.Plugins.Uninstall(t.Context(), &rpc.PluginsUninstallRequest{Name: portedDirectPluginName}); err != nil {
196+
if _, err := client.RPC.Plugins.Uninstall(t.Context(), &rpc.PluginsUninstallRequest{
197+
DirectSourceID: install.Plugin.DirectSourceID,
198+
Name: portedDirectPluginName,
199+
}); err != nil {
205200
t.Fatalf("Plugins.Uninstall direct failed: %v", err)
206201
}
207202
afterUninstall, err := client.RPC.Plugins.List(t.Context())

go/internal/e2e/rpc_session_state_e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ func TestRPCSessionStateE2E(t *testing.T) {
704704

705705
api := ctx.ProxyURL
706706
telemetry := "https://localhost:1/telemetry"
707-
setCredentials, err := session.RPC.Auth.SetCredentials(t.Context(), &rpc.SessionSetCredentialsParams{
707+
setCredentials, err := session.RPC.GitHubAuth.SetCredentials(t.Context(), &rpc.SessionSetCredentialsParams{
708708
Credentials: &rpc.UserAuthInfo{
709709
CopilotUser: &rpc.CopilotUserResponse{
710710
AnalyticsTrackingID: rpcPtr("rpc-session-state-tracking-id"),
@@ -727,7 +727,7 @@ func TestRPCSessionStateE2E(t *testing.T) {
727727
t.Fatalf("Expected Auth.SetCredentials Success=true, got %+v", setCredentials)
728728
}
729729

730-
status, err := session.RPC.Auth.GetStatus(t.Context())
730+
status, err := session.RPC.GitHubAuth.GetStatus(t.Context())
731731
if err != nil {
732732
t.Fatalf("Auth.GetStatus failed: %v", err)
733733
}

java/src/main/java/com/github/copilot/CopilotClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ CompletableFuture<Void> updateSessionOptionsForMode(CopilotSession session, Bool
864864
return CompletableFuture.completedFuture(null);
865865
}
866866

867-
var params = new SessionOptionsUpdateParams(null, // sessionId set by SessionOptionsApi
867+
var params = new SessionOptionsUpdateParams(null, // sessionId - set by SessionOptionsApi
868868
null, // model
869869
null, // modelCapabilitiesOverrides
870870
null, // reasoningEffort
@@ -886,6 +886,7 @@ CompletableFuture<Void> updateSessionOptionsForMode(CopilotSession session, Bool
886886
null, // sandboxConfig
887887
null, // logInteractiveShells
888888
null, // envValueMode
889+
null, // allowAllMcpServerInstructions
889890
null, // skillDirectories
890891
null, // disabledSkills
891892
null, // enableOnDemandInstructionDiscovery
@@ -914,7 +915,8 @@ CompletableFuture<Void> updateSessionOptionsForMode(CopilotSession session, Bool
914915
null, // enableHostGitOperations
915916
null, // enableSessionStore
916917
null, // enableSkills
917-
null // contextTier
918+
null, // contextTier
919+
null // responseBudget
918920
);
919921

920922
return session.getRpc().options.update(params).<Void>thenCompose(result -> {

java/src/test/java/com/github/copilot/PerSessionAuthTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.junit.jupiter.api.BeforeAll;
1414
import org.junit.jupiter.api.Test;
1515

16-
import com.github.copilot.generated.rpc.SessionAuthGetStatusResult;
16+
import com.github.copilot.generated.rpc.SessionGitHubAuthGetStatusResult;
1717
import com.github.copilot.rpc.CopilotClientOptions;
1818
import com.github.copilot.rpc.PermissionHandler;
1919
import com.github.copilot.rpc.SessionConfig;
@@ -73,7 +73,7 @@ void shouldAuthenticateWithGitHubToken() throws Exception {
7373
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get();
7474

7575
try {
76-
SessionAuthGetStatusResult authStatus = session.getRpc().auth.getStatus().get();
76+
SessionGitHubAuthGetStatusResult authStatus = session.getRpc().gitHubAuth.getStatus().get();
7777

7878
assertTrue(authStatus.isAuthenticated(), "Expected session to be authenticated");
7979
assertEquals("alice", authStatus.login());
@@ -94,8 +94,8 @@ void shouldIsolateAuthBetweenSessions() throws Exception {
9494
.setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get();
9595

9696
try {
97-
SessionAuthGetStatusResult statusA = sessionA.getRpc().auth.getStatus().get();
98-
SessionAuthGetStatusResult statusB = sessionB.getRpc().auth.getStatus().get();
97+
SessionGitHubAuthGetStatusResult statusA = sessionA.getRpc().gitHubAuth.getStatus().get();
98+
SessionGitHubAuthGetStatusResult statusB = sessionB.getRpc().gitHubAuth.getStatus().get();
9999

100100
assertTrue(statusA.isAuthenticated(), "Expected session A to be authenticated");
101101
assertEquals("alice", statusA.login());
@@ -131,7 +131,7 @@ void shouldBeUnauthenticatedWithoutToken() throws Exception {
131131
.createSession(new SessionConfig().setOnPermissionRequest(PermissionHandler.APPROVE_ALL)).get();
132132

133133
try {
134-
SessionAuthGetStatusResult authStatus = session.getRpc().auth.getStatus().get();
134+
SessionGitHubAuthGetStatusResult authStatus = session.getRpc().gitHubAuth.getStatus().get();
135135

136136
// With no global or per-session token, there is no identity at all.
137137
assertNull(authStatus.login(), "Expected no login without per-session token");

nodejs/test/e2e/per_session_auth.e2e.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe("Per-session GitHub auth", async () => {
4242
gitHubToken: "token-alice",
4343
});
4444

45-
const authStatus = await session.rpc.auth.getStatus();
45+
const authStatus = await session.rpc.gitHubAuth.getStatus();
4646
expect(authStatus.isAuthenticated).toBe(true);
4747
expect(authStatus.login).toBe("alice");
4848
expect(authStatus.copilotPlan).toBe("individual_pro");
@@ -60,8 +60,8 @@ describe("Per-session GitHub auth", async () => {
6060
gitHubToken: "token-bob",
6161
});
6262

63-
const statusA = await sessionA.rpc.auth.getStatus();
64-
const statusB = await sessionB.rpc.auth.getStatus();
63+
const statusA = await sessionA.rpc.gitHubAuth.getStatus();
64+
const statusB = await sessionB.rpc.gitHubAuth.getStatus();
6565

6666
expect(statusA.isAuthenticated).toBe(true);
6767
expect(statusA.login).toBe("alice");
@@ -92,7 +92,7 @@ describe("Per-session GitHub auth", async () => {
9292
onPermissionRequest: approveAll,
9393
});
9494

95-
const authStatus = await session.rpc.auth.getStatus();
95+
const authStatus = await session.rpc.gitHubAuth.getStatus();
9696
// Without a per-session GitHub token, there is no per-session identity.
9797
// In CI the process-level fake token may still authenticate globally,
9898
// so we check login rather than isAuthenticated.

0 commit comments

Comments
 (0)