Skip to content

Commit a694a47

Browse files
mkdinhCopilot
andcommitted
Fix CLI 1.0.89-6 test regressions
Resolve schemas across standalone and runtime layouts, update RPC surface coverage, and make Rust workspace context assertions cross-platform and single-purpose. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent d34c6a7 commit a694a47

3 files changed

Lines changed: 18 additions & 45 deletions

File tree

‎nodejs/test/e2e/rpc_surface_coverage.e2e.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ describe("Generated RPC surface coverage", () => {
313313
...collectRuntimeFunctions(session.rpc, "session"),
314314
]);
315315

316-
expect(inventory).toHaveLength(359);
316+
expect(inventory).toHaveLength(368);
317317
expect([...runtimeFunctions.keys()].sort()).toEqual(
318318
inventory.map((method) => `${method.scope}.${method.path}`)
319319
);

‎nodejs/test/rust-codegen.test.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
normalizeSchemaBrandCasing,
44
postProcessSchema,
55
propagateInternalVisibility,
6+
resolveCopilotSchemaPaths,
67
stripBooleanLiterals,
78
} from "../../scripts/codegen/utils.ts";
89
import type { JSONSchema7 } from "json-schema";
@@ -772,18 +773,14 @@ describe("Rust x-legacy-parameters", () => {
772773
).toThrow(/Rust string enum Kind is requested for different values/);
773774
});
774775

775-
it("keeps every const discriminator of the committed API schema distinct in Rust", () => {
776+
it("keeps every const discriminator of the selected API schema distinct in Rust", async () => {
777+
const { apiSchemaPath } = await resolveCopilotSchemaPaths();
776778
// Mirror the generator's own schema preparation so emission order matches.
777779
const schema = propagateInternalVisibility(
778780
postProcessSchema(
779781
stripBooleanLiterals(
780782
normalizeSchemaBrandCasing(
781-
JSON.parse(
782-
readFileSync(
783-
new URL("../../../../generated/api.schema.json", import.meta.url),
784-
"utf8"
785-
)
786-
) as ApiSchema
783+
JSON.parse(readFileSync(apiSchemaPath, "utf8")) as ApiSchema
787784
)
788785
) as JSONSchema7
789786
)

‎rust/tests/e2e/rpc_workspace_checkpoints.rs‎

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use std::path::Path;
22
use std::process::Command;
3-
use std::sync::Arc;
43

5-
use github_copilot_sdk::ResumeSessionConfig;
6-
use github_copilot_sdk::handler::ApproveAllHandler;
74
use github_copilot_sdk::rpc::{
85
WorkspaceDiffFileChangeType, WorkspaceDiffMode, WorkspacesDiffRequest,
96
WorkspacesReadCheckpointRequest, WorkspacesReadFileRequest, WorkspacesSaveLargePasteRequest,
@@ -187,6 +184,15 @@ fn normalize_path(path: &str) -> String {
187184
path.replace('\\', "/")
188185
}
189186

187+
fn canonical_normalized_path(path: &str) -> String {
188+
normalize_path(
189+
std::fs::canonicalize(path)
190+
.expect("canonicalize workspace path")
191+
.to_string_lossy()
192+
.as_ref(),
193+
)
194+
}
195+
190196
#[tokio::test]
191197
async fn should_record_git_context_in_a_new_session_workspace() {
192198
super::support::with_e2e_context_no_snapshot(|ctx| {
@@ -233,11 +239,10 @@ async fn should_record_git_context_in_a_new_session_workspace() {
233239
// The repository was created exactly at the session's working
234240
// directory, so the recorded root is that directory and not an
235241
// ancestor of it.
236-
let git_root = normalize_path(workspace.git_root.as_deref().expect("git root"));
237-
assert_eq!(
238-
Some(git_root.as_str()),
239-
workspace.cwd.as_deref().map(normalize_path).as_deref()
240-
);
242+
let git_root =
243+
canonical_normalized_path(workspace.git_root.as_deref().expect("git root"));
244+
let cwd = canonical_normalized_path(workspace.cwd.as_deref().expect("workspace cwd"));
245+
assert_eq!(git_root, cwd);
241246
let work_dir_name = ctx
242247
.work_dir()
243248
.file_name()
@@ -254,36 +259,7 @@ async fn should_record_git_context_in_a_new_session_workspace() {
254259
);
255260
assert_eq!(workspace.client_name.as_deref(), Some("rust-e2e-client"));
256261

257-
// The recorded context survives a resume rather than being dropped
258-
// or re-derived into something else.
259-
let session_id = session.id().clone();
260262
session.disconnect().await.expect("disconnect session");
261-
let resumed = client
262-
.resume_session(
263-
ResumeSessionConfig::new(session_id)
264-
.with_permission_handler(Arc::new(ApproveAllHandler))
265-
.with_github_token(super::support::DEFAULT_TEST_TOKEN),
266-
)
267-
.await
268-
.expect("resume session");
269-
let resumed_workspace = resumed
270-
.rpc()
271-
.workspaces()
272-
.get_workspace()
273-
.await
274-
.expect("get workspace after resume")
275-
.workspace
276-
.expect("workspace after resume");
277-
assert_eq!(
278-
resumed_workspace.repository.as_deref(),
279-
Some("test-org/test-repo")
280-
);
281-
assert_eq!(
282-
resumed_workspace.branch.as_deref(),
283-
Some("feature/test-branch")
284-
);
285-
286-
resumed.disconnect().await.expect("disconnect resumed");
287263
client.stop().await.expect("stop client");
288264
})
289265
})

0 commit comments

Comments
 (0)