@@ -335,7 +335,7 @@ suite('DeepnoteEnvironmentManager', () => {
335335 verify ( mockStorage . saveEnvironments ( anything ( ) ) ) . once ( ) ;
336336 } ) ;
337337
338- test ( 'should not migrate environments with correct UUID paths in correct storage' , async ( ) => {
338+ test ( 'should not migrate environments with correct ID-based paths in correct storage' , async ( ) => {
339339 const testDate = new Date ( ) ;
340340 const correctConfig = {
341341 id : '12345678-1234-1234-1234-123456789abc' ,
@@ -372,6 +372,38 @@ suite('DeepnoteEnvironmentManager', () => {
372372 verify ( mockStorage . saveEnvironments ( anything ( ) ) ) . never ( ) ;
373373 } ) ;
374374
375+ test ( 'should not migrate environments with non-UUID IDs when path already matches' , async ( ) => {
376+ const testDate = new Date ( ) ;
377+ const customIdConfig = {
378+ id : 'my-custom-env-id' ,
379+ name : 'Custom ID Environment' ,
380+ pythonInterpreter : testInterpreter ,
381+ venvPath : Uri . file ( '/global/storage/deepnote-venvs/my-custom-env-id' ) ,
382+ createdAt : testDate ,
383+ lastUsedAt : testDate ,
384+ toolkitVersion : '1.0.0'
385+ } ;
386+
387+ when ( mockStorage . loadEnvironments ( ) ) . thenResolve ( [ customIdConfig ] ) ;
388+ when ( mockStorage . saveEnvironments ( anything ( ) ) ) . thenResolve ( ) ;
389+ when ( mockContext . globalStorageUri ) . thenReturn ( Uri . file ( '/global/storage' ) ) ;
390+
391+ manager . activate ( ) ;
392+ await manager . waitForInitialization ( ) ;
393+
394+ const configs = manager . listEnvironments ( ) ;
395+ assert . strictEqual ( configs . length , 1 ) ;
396+
397+ // Path should remain unchanged
398+ assert . strictEqual ( configs [ 0 ] . venvPath . fsPath , '/global/storage/deepnote-venvs/my-custom-env-id' ) ;
399+
400+ // Toolkit version should NOT be cleared
401+ assert . strictEqual ( configs [ 0 ] . toolkitVersion , '1.0.0' ) ;
402+
403+ // Should NOT have saved (no migration needed)
404+ verify ( mockStorage . saveEnvironments ( anything ( ) ) ) . never ( ) ;
405+ } ) ;
406+
375407 test ( 'should migrate multiple environments at once' , async ( ) => {
376408 const configs = [
377409 {
0 commit comments