@@ -590,22 +590,20 @@ exit 1
590590 ) ;
591591
592592 test . concurrent (
593- "rejects tilde paths in srcBaseDir (SSH only)" ,
593+ "resolves tilde paths in srcBaseDir to absolute paths (SSH only)" ,
594594 async ( ) => {
595- // Skip if SSH server not available
596595 if ( ! sshConfig ) {
597- console . log ( "Skipping SSH-specific test: SSH server not available" ) ;
598- return ;
596+ throw new Error ( "SSH server is required for SSH integration tests" ) ;
599597 }
600598
601599 const env = await createTestEnvironment ( ) ;
602600 const tempGitRepo = await createTempGitRepo ( ) ;
603601
604602 try {
605- const branchName = generateBranchName ( "tilde-rejection -test" ) ;
603+ const branchName = generateBranchName ( "tilde-resolution -test" ) ;
606604 const trunkBranch = await detectDefaultTrunkBranch ( tempGitRepo ) ;
607605
608- // Try to use tilde path - should be rejected
606+ // Use tilde path - should be accepted and resolved
609607 const tildeRuntimeConfig : RuntimeConfig = {
610608 type : "ssh" ,
611609 host : `testuser@localhost` ,
@@ -614,17 +612,32 @@ exit 1
614612 port : sshConfig . port ,
615613 } ;
616614
617- const result = await env . mockIpcRenderer . invoke (
618- IPC_CHANNELS . WORKSPACE_CREATE ,
615+ const { result, cleanup } = await createWorkspaceWithCleanup (
616+ env ,
619617 tempGitRepo ,
620618 branchName ,
621619 trunkBranch ,
622620 tildeRuntimeConfig
623621 ) ;
624622
625- // Should fail with error about tilde
626- expect ( result . success ) . toBe ( false ) ;
627- expect ( result . error ) . toMatch ( / c a n n o t s t a r t w i t h t i l d e / i) ;
623+ // Should succeed and resolve tilde to absolute path
624+ expect ( result . success ) . toBe ( true ) ;
625+ if ( ! result . success ) {
626+ throw new Error ( `Failed to create workspace: ${ result . error } ` ) ;
627+ }
628+
629+ // Verify the stored runtimeConfig has resolved path (not tilde)
630+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
631+ const projectWorkspaces =
632+ projectsConfig . projects . get ( tempGitRepo ) ?. workspaces ?? [ ] ;
633+ const workspace = projectWorkspaces . find ( ( w ) => w . name === branchName ) ;
634+
635+ expect ( workspace ) . toBeDefined ( ) ;
636+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . toBeDefined ( ) ;
637+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . toMatch ( / ^ \/ h o m e \/ / ) ;
638+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . not . toContain ( "~" ) ;
639+
640+ await cleanup ( ) ;
628641 } finally {
629642 await cleanupTestEnvironment ( env ) ;
630643 await cleanupTempGitRepo ( tempGitRepo ) ;
@@ -634,22 +647,20 @@ exit 1
634647 ) ;
635648
636649 test . concurrent (
637- "rejects bare tilde in srcBaseDir (SSH only)" ,
650+ "resolves bare tilde in srcBaseDir to home directory (SSH only)" ,
638651 async ( ) => {
639- // Skip if SSH server not available
640652 if ( ! sshConfig ) {
641- console . log ( "Skipping SSH-specific test: SSH server not available" ) ;
642- return ;
653+ throw new Error ( "SSH server is required for SSH integration tests" ) ;
643654 }
644655
645656 const env = await createTestEnvironment ( ) ;
646657 const tempGitRepo = await createTempGitRepo ( ) ;
647658
648659 try {
649- const branchName = generateBranchName ( "bare-tilde-rejection " ) ;
660+ const branchName = generateBranchName ( "bare-tilde-resolution " ) ;
650661 const trunkBranch = await detectDefaultTrunkBranch ( tempGitRepo ) ;
651662
652- // Try to use bare tilde - should be rejected
663+ // Use bare tilde - should be accepted and resolved to home directory
653664 const tildeRuntimeConfig : RuntimeConfig = {
654665 type : "ssh" ,
655666 host : `testuser@localhost` ,
@@ -658,17 +669,32 @@ exit 1
658669 port : sshConfig . port ,
659670 } ;
660671
661- const result = await env . mockIpcRenderer . invoke (
662- IPC_CHANNELS . WORKSPACE_CREATE ,
672+ const { result, cleanup } = await createWorkspaceWithCleanup (
673+ env ,
663674 tempGitRepo ,
664675 branchName ,
665676 trunkBranch ,
666677 tildeRuntimeConfig
667678 ) ;
668679
669- // Should fail with error about tilde
670- expect ( result . success ) . toBe ( false ) ;
671- expect ( result . error ) . toMatch ( / c a n n o t s t a r t w i t h t i l d e / i) ;
680+ // Should succeed and resolve tilde to home directory
681+ expect ( result . success ) . toBe ( true ) ;
682+ if ( ! result . success ) {
683+ throw new Error ( `Failed to create workspace: ${ result . error } ` ) ;
684+ }
685+
686+ // Verify the stored runtimeConfig has resolved path (not tilde)
687+ const projectsConfig = env . config . loadConfigOrDefault ( ) ;
688+ const projectWorkspaces =
689+ projectsConfig . projects . get ( tempGitRepo ) ?. workspaces ?? [ ] ;
690+ const workspace = projectWorkspaces . find ( ( w ) => w . name === branchName ) ;
691+
692+ expect ( workspace ) . toBeDefined ( ) ;
693+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . toBeDefined ( ) ;
694+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . toMatch ( / ^ \/ h o m e \/ / ) ;
695+ expect ( workspace ?. runtimeConfig ?. srcBaseDir ) . not . toContain ( "~" ) ;
696+
697+ await cleanup ( ) ;
672698 } finally {
673699 await cleanupTestEnvironment ( env ) ;
674700 await cleanupTempGitRepo ( tempGitRepo ) ;
@@ -783,10 +809,8 @@ exit 1
783809 test . concurrent (
784810 "forwards origin remote instead of bundle path" ,
785811 async ( ) => {
786- // Skip if SSH server not available
787812 if ( ! sshConfig ) {
788- console . log ( "Skipping SSH-specific test: SSH server not available" ) ;
789- return ;
813+ throw new Error ( "SSH server is required for SSH integration tests" ) ;
790814 }
791815
792816 const env = await createTestEnvironment ( ) ;
0 commit comments