Files
vscode/src/vs/platform/agentHost/test/common/cloudSandboxProjectMeta.test.ts
T
roblourensandCopilot 7ca7edcbdb sessions: show Cloud Sandbox setup progress (#339604)
* sessions: show Cloud Sandbox setup progress

Reuse draft preparation progress for sandbox provisioning and repository cloning. Wait for repository readiness before dispatching the first turn and handing off to the remote session.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Merge main into Cloud Sandbox setup progress

Preserve upstream sandbox renaming and startup progress regression coverage.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* sessions: harden Cloud Sandbox preparation lifecycle

Keep provisioning protected until its connection attempt settles, reference-count overlapping preparation activities, and preserve clone retry progress. Localize preparation errors and add regression coverage for these cases.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-04 15:25:51 -07:00

35 lines
1.7 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
import { readCloudSandboxCloneResult, readCloudSandboxProjects } from '../../common/meta/cloudSandboxProjectMeta.js';
suite('CloudSandboxProjectMeta', () => {
ensureNoDisposablesAreLeakedInTestSuite();
test('reads finite clone percentages, clamps their range, and ignores progress after cloning', () => {
const project = { id: 'checkout', path: '/checkout', git: true };
assert.deepStrictEqual({
cloning: [undefined, 0, 58, 100, -1, 101, NaN, Infinity, '58'].map(progress =>
readCloudSandboxCloneResult({ project: { ...project, status: 'cloning', progress } })?.progress),
otherStates: [undefined, 'ready', 'failed'].map(status =>
readCloudSandboxCloneResult({ project: { ...project, status, progress: 58 } })?.progress),
root: readCloudSandboxProjects({
agents: [],
_meta: { 'copilot.projectManagement': { available: true } },
config: {
schema: { type: 'object', properties: {} },
values: { copilot: { projects: [{ ...project, status: 'cloning', progress: 58 }] } },
},
})?.map(project => ({ status: project.status, progress: project.progress })),
}, {
cloning: [undefined, 0, 58, 100, 0, 100, undefined, undefined, undefined],
otherStates: [undefined, undefined, undefined],
root: [{ status: 'cloning', progress: 58 }],
});
});
});