Skip to content

Commit a9b2312

Browse files
FrankLiu4138Copilot
andcommitted
Fix Java upgrade notification flow telemetry and activation check
Follow-up improvements from v0.27.5 telemetry analysis (devdiv-azure-service-dmitryr/azure-java-migration-copilot-vscode-extension#5979): 1. Add a source field (SOURCE_CVE / SOURCE_JAVA_UPGRADE) to the upgradeNotification.show event so NOTIFY-level data can be split by CVE vs upgrade and aligned with downstream funnel stages. 2. Replace the fixed setTimeout(2000) post-install activation wait with a 15s polling loop to fix the false activation-timeout rate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4db30ab commit a9b2312

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/upgrade/display/notificationManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class NotificationManager implements IUpgradeIssuesRenderer {
9393
sendInfo(operationId, {
9494
operationName: "java.dependency.upgradeNotification.show",
9595
extensionState,
96+
source: hasCVEIssue ? Upgrade.SOURCE_CVE : Upgrade.SOURCE_JAVA_UPGRADE,
9697
});
9798

9899
const buttons = hasCVEIssue

src/upgrade/utility.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,15 @@ export async function checkOrInstallAppModExtensionForUpgrade(
221221

222222
await checkOrPromptToEnableAppModExtension("upgrade");
223223

224-
// Wait briefly for the newly installed extension to activate
225-
await new Promise(resolve => setTimeout(resolve, 2000));
224+
// installExtension resolves on install completion, not when the extension's
225+
// activate() has run, so poll for the target state instead of a fixed sleep.
226+
const deadline = Date.now() + 15000;
227+
let newState = getExtensionState(extensionIdToCheck);
228+
while (newState !== "up-to-date" && Date.now() < deadline) {
229+
await new Promise(resolve => setTimeout(resolve, 500));
230+
newState = getExtensionState(extensionIdToCheck);
231+
}
226232

227-
// Re-check if the newly installed extension is active and meets version requirement
228-
const newState = getExtensionState(extensionIdToCheck);
229233
const canProceed = newState === "up-to-date";
230234
sendInfo(operationId, {
231235
operationName: "java.dependency.upgradeFlow.result",

0 commit comments

Comments
 (0)