cody icon indicating copy to clipboard operation
cody copied to clipboard

feat(uninstall): Delete cached credentials during re-install (CODY-1043)

Open jamesmcnamara opened this issue 4 months ago • 0 comments

This is the VSCode half of CODY-1043.

Unfortunately, we don't have access to any VSCode APIs during the uninstall script; it is just a raw node process that VSCode kicks off the next time VSCode is started after an uninstall (could be an arbitrary time after uninstalling). So the way we collected telemetry was to create files in the deactivation subroutine (which is run anytime the extension is stopped, i.e. when it is deactivated, VSCode is closed, the extension is upgraded or uninstalled) that stored all the config needed to boot telemetry and then we read those resources in the uninstall script.

Here we do basically the opposite. The uninstall script is run only when the user explicitly uninstalls the extension and closes and re-opens VSCode (importantly it does not run when the extension is upgraded). We create a marker file in the uninstallation process which we can check when the extension is initializing. When present, we delete the file and perform any cleanup from the previous installation (currently just deleting auth credentials and previous endpoints).

This also fixes some existing errors in the uninstall script (it isn't working today because the client capabilities aren't initialized), adds a check to the bundling step for the uninstaller that no vscode dependencies are transitively included (similar to the vscode-shim) and adds a re-install telemetry event.

Test plan

Finally added an E2E test for the uninstall flow. It took forever, but seeing as how it was broken for gosh knows how long and we didn't know indicates that it was necessary.

Changelog

deletes auth credentials and endpoint history when the extension is reinstalled

jamesmcnamara avatar Oct 05 '24 01:10 jamesmcnamara