Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2704831
Implement public API for Aspire extension and add fetchAppHostsOnce m…
LittleLittleCloud May 29, 2026
91dc92d
Merge remote-tracking branch 'upstream/main' into pr-17705-csdk
adamint Jun 1, 2026
a030a21
Add Aspire test run DCP leases
adamint Jun 1, 2026
33dcde3
Clean lease notifications after release
adamint Jun 1, 2026
0e68f5b
Address Aspire extension API review feedback
adamint Jun 1, 2026
8d8861b
Harden Aspire test run lease integration
adamint Jun 1, 2026
12f2768
Refactor Aspire API to use DCP server for test run session management
LittleLittleCloud Jun 1, 2026
45487b5
Merge branch 'main' into u/xiaoyun/aspireC#DK
LittleLittleCloud Jun 2, 2026
2129f65
Refactor AspireDcpServer constructor to remove unused app parameter a…
LittleLittleCloud Jun 2, 2026
fdbba30
Update API function signatures to use inline arrow functions for DCP …
LittleLittleCloud Jun 2, 2026
c8739a3
Merge branch 'main' into u/xiaoyun/aspireC#DK
LittleLittleCloud Jun 3, 2026
b918206
Fix extension test failures by returning full E2E API from activate
LittleLittleCloud Jun 3, 2026
5ca3d02
Refactor Aspire extension API: consolidate resource command functions…
LittleLittleCloud Jun 3, 2026
b9a3118
Fix stopRunSession cleanup and remove redundant closeLeaseNotificatio…
LittleLittleCloud Jun 3, 2026
d6666bc
Merge branch 'main' into u/xiaoyun/aspireC#DK
LittleLittleCloud Jun 10, 2026
1321ec5
Enhance resource command handling and error logging in DCP server and…
LittleLittleCloud Jun 10, 2026
9939510
Remove terminalProvider parameter from createExtensionApi function ca…
LittleLittleCloud Jun 10, 2026
9fb1d95
Refactor process termination logic in AppHostDataRepository for clarity
LittleLittleCloud Jun 10, 2026
79b9dbe
Refactor DCP server and test run session manager for improved session…
LittleLittleCloud Jun 15, 2026
bbdefca
Refactor AspireDcpServer and TestRunSessionManager for improved clari…
LittleLittleCloud Jun 15, 2026
4d1ce6e
Fix test run session DCP credentials
adamint Jun 17, 2026
03f2ff5
Merge remote-tracking branch 'upstream/main' into copilot/pr-17705-fix
adamint Jun 17, 2026
8dbae32
Fix VS Code extension API lifecycle issues
adamint Jun 19, 2026
0131c76
Handle selected test comment permission failures
adamint Jun 19, 2026
778aea1
Merge upstream/main into PR 17705 fixes
adamint Jun 19, 2026
08fabc5
Grant issue comment permission to CI tests workflow
adamint Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ jobs:
continue-on-error: true
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Download selection summary
Expand Down Expand Up @@ -194,14 +195,19 @@ jobs:
const mine = comments.filter(c => c.body && c.body.includes(marker));
const current = mine.filter(c => c.body.includes(sha)).at(-1);
let keepId;
if (current) {
await github.rest.issues.updateComment({ owner, repo, comment_id: current.id, body });
keepId = current.id;
core.info(`Updated selection comment ${current.id} for ${shortSha}.`);
} else {
const created = await github.rest.issues.createComment({ owner, repo, issue_number, body });
keepId = created.data.id;
core.info(`Created selection comment ${created.data.id} for ${shortSha}.`);
try {
if (current) {
await github.rest.issues.updateComment({ owner, repo, comment_id: current.id, body });
keepId = current.id;
core.info(`Updated selection comment ${current.id} for ${shortSha}.`);
} else {
const created = await github.rest.issues.createComment({ owner, repo, issue_number, body });
keepId = created.data.id;
core.info(`Created selection comment ${created.data.id} for ${shortSha}.`);
}
} catch (error) {
core.info(`Could not create or update selection comment for ${shortSha}: ${error.message}`);
return;
}

// Collapse every other prior selection comment (superseded commits, or the legacy single
Expand Down
15 changes: 15 additions & 0 deletions extension/loc/xlf/aspire-vscode.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
"aspire-vscode.strings.debugSessionAlreadyExists": "A debug session is already active for id {0}.",
"aspire-vscode.strings.processExceptionOccurred": "Encountered an exception ({0}) while running the following command: {1}.",
"aspire-vscode.strings.failedToStartDebugSession": "Failed to start debug session.",
"aspire-vscode.strings.aspireCliCommandFailed": "{0} exited with code {1}{2}",
"aspire-vscode.strings.aspireCliCommandTimedOut": "timed out after {0}ms",
"aspire-vscode.strings.aspireCliOutputParseFailed": "Failed to parse {0} output: {1}",
"aspire-vscode.strings.appHostPathMustBeNonEmptyAbsolute": "appHostPath must be a non-empty absolute path",
"aspire-vscode.strings.aspireCliDescribeNotSupported": "Workspace resources require Aspire CLI {0} or newer. Update the Aspire CLI and refresh the Aspire panel.",
"aspire-vscode.strings.appHostDescribeMayNotBeSupported": "No workspace resources were returned. Workspace resources require the AppHost to reference Aspire.Hosting {0} or newer.",
"aspire-vscode.strings.failedToGetConfigInfo": "Failed to get Aspire config info (exit code: {0}). Try updating the Aspire CLI with: aspire update",
Expand All @@ -118,6 +122,7 @@
"aspire-vscode.strings.authorizationHeaderMustStartWithBearer": "Authorization header must start with 'Bearer '.",
"aspire-vscode.strings.authorizationAndDcpHeadersRequired": "Authorization and Microsoft-Developer-DCP-Instance-ID headers are required.",
"aspire-vscode.strings.authorizationHeaderRequired": "Authorization header is required.",
"aspire-vscode.strings.testRunSessionManagerNotInitialized": "Test run session manager has not been initialized with DCP server connection information.",
"aspire-vscode.strings.buildFailedForProjectWithError": "Build failed for project {0} with error: {1}.",
"aspire-vscode.strings.failedToInspectRuntimeConfig": "Failed to inspect runtimeconfig for {0}: {1}",
"aspire-vscode.strings.dotNetRunFallbackDisablesDebugger": "Project output {0} is not directly runnable; launching {1} with dotnet run without debugger attach. Breakpoints will not be hit for this resource.",
Expand Down
149 changes: 149 additions & 0 deletions extension/src/dcp/TestRunSessionManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import * as vscode from 'vscode';
import { getRunSessionInfo, getSupportedCapabilities } from '../capabilities';
import { AspireDebugSession } from '../debugger/AspireDebugSession';
import type { AspireTerminalProvider } from '../utils/AspireTerminalProvider';
import { extensionLogOutputChannel } from '../utils/logging';
import { testRunSessionManagerNotInitialized } from '../loc/strings';
import type AspireRpcServer from '../server/AspireRpcServer';
import { generateToken } from '../utils/security';
import { DcpServerConnectionInfo, RunSessionInfo } from './types';
import { generateDcpIdPrefix } from './AspireDcpServer';
import type AspireDcpServer from './AspireDcpServer';

export interface TestRunSessionAcquireOptions {
debug: boolean;
}

export interface AcquiredTestRunSession {
id: string;
sessionId: string;
env: Record<string, string>;
}

interface TestRunSessionLease {
id: string;
sessionId: string;
}

export interface TestRunSessionDebugSessionOptions {
rpcServer: AspireRpcServer;
dcpServer: AspireDcpServer;
terminalProvider: AspireTerminalProvider;
addAspireDebugSession: (session: AspireDebugSession) => void;
removeAspireDebugSession: (session: AspireDebugSession) => void;
getAspireDebugSession: (debugSessionId: string | null) => AspireDebugSession | null;
}

export class TestRunSessionManager {
private readonly leases = new Map<string, TestRunSessionLease>();
private connectionInfo?: DcpServerConnectionInfo;
private debugSessionSubscription?: vscode.Disposable;
private readonly leasedDebugSessionDisposers = new Map<string, () => void>();

constructor(
connectionInfo?: DcpServerConnectionInfo,
private readonly getSupportedLaunchConfigurations: () => string[] = getSupportedCapabilities) {
this.connectionInfo = connectionInfo;
}

initializeConnectionInfo(connectionInfo: DcpServerConnectionInfo): void {
this.connectionInfo = connectionInfo;
}

listenForLeasedDebugSessions(options: TestRunSessionDebugSessionOptions): vscode.Disposable {
this.debugSessionSubscription?.dispose();
const startSubscription = vscode.debug.onDidStartDebugSession(session => {
const lease = this.tryGetLeaseForDebugSession(session);
if (!lease || options.getAspireDebugSession(lease.sessionId)) {
return;
}

const aspireDebugSession = new AspireDebugSession(
session,
options.rpcServer,
options.dcpServer,
options.terminalProvider,
options.removeAspireDebugSession,
lease.sessionId);

options.addAspireDebugSession(aspireDebugSession);
this.leasedDebugSessionDisposers.set(lease.id, () => aspireDebugSession.dispose());
extensionLogOutputChannel.info(`Registered leased Aspire debug session ${lease.sessionId} for VS Code debug session ${session.id}.`);
});
const terminateSubscription = vscode.debug.onDidTerminateDebugSession(session => {
const lease = this.tryGetLeaseForDebugSession(session);
if (lease) {
this.releaseLease(lease.id);
}
});
this.debugSessionSubscription = vscode.Disposable.from(startSubscription, terminateSubscription);

return this.debugSessionSubscription;
}

private tryGetLeaseForDebugSession(session: vscode.DebugSession): TestRunSessionLease | undefined {
const dcpInstanceIdPrefix = session.configuration.env?.DCP_INSTANCE_ID_PREFIX;
if (typeof dcpInstanceIdPrefix !== 'string') {
return undefined;
}

return this.tryGetLeaseForSessionId(dcpInstanceIdPrefix.replace(/-$/, ''));
}

acquireTestRunSession(options: TestRunSessionAcquireOptions): AcquiredTestRunSession {
if (!this.connectionInfo) {
throw new Error(testRunSessionManagerNotInitialized);
}

const id = generateToken();
const sessionId = generateDcpIdPrefix();
const runSessionInfo: RunSessionInfo = {
...getRunSessionInfo(),
supported_launch_configurations: this.getSupportedLaunchConfigurations()
};

this.leases.set(id, { id, sessionId });

return {
id,
sessionId,
env: {
DEBUG_SESSION_PORT: this.connectionInfo.address,
DEBUG_SESSION_TOKEN: this.connectionInfo.token,
DEBUG_SESSION_SERVER_CERTIFICATE: this.connectionInfo.certificate,
DCP_INSTANCE_ID_PREFIX: `${sessionId}-`,
DEBUG_SESSION_RUN_MODE: options.debug ? 'Debug' : 'NoDebug',
DEBUG_SESSION_INFO: JSON.stringify(runSessionInfo)
}
};
}

releaseTestRunSession(id: string): Promise<void> {
this.releaseLease(id);

return Promise.resolve();
}

private releaseLease(id: string): TestRunSessionLease | undefined {
const lease = this.leases.get(id);
this.leases.delete(id);
this.removeLeasedDebugSession(id);
return lease;
}

private removeLeasedDebugSession(id: string): void {
const dispose = this.leasedDebugSessionDisposers.get(id);
this.leasedDebugSessionDisposers.delete(id);
dispose?.();
}

private tryGetLeaseForSessionId(sessionId: string): TestRunSessionLease | undefined {
for (const lease of this.leases.values()) {
if (lease.sessionId === sessionId) {
return lease;
}
}

return undefined;
}
}
Comment thread
adamint marked this conversation as resolved.
Resolved
4 changes: 2 additions & 2 deletions extension/src/debugger/AspireDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ export class AspireDebugSession implements vscode.DebugAdapter {
return this._startupCompleted;
}

constructor(session: vscode.DebugSession, rpcServer: AspireRpcServer, dcpServer: AspireDcpServer, terminalProvider: AspireTerminalProvider, removeAspireDebugSession: (session: AspireDebugSession) => void) {
constructor(session: vscode.DebugSession, rpcServer: AspireRpcServer, dcpServer: AspireDcpServer, terminalProvider: AspireTerminalProvider, removeAspireDebugSession: (session: AspireDebugSession) => void, debugSessionId: string = generateDcpIdPrefix()) {
this._session = session;
this._rpcServer = rpcServer;
this._dcpServer = dcpServer;
this._terminalProvider = terminalProvider;
this.configuration = session.configuration as AspireExtendedDebugConfiguration;

this.debugSessionId = generateDcpIdPrefix();
this.debugSessionId = debugSessionId;

this._disposables.push({
dispose: () => removeAspireDebugSession(this)
Expand Down
Loading