@@ -12,7 +12,7 @@ use crate::core::runner::workspace::types::{RunnerWorkspaceSyncMode, RunnerWorks
1212use crate :: core:: runner:: workspace:: util:: git_output;
1313
1414#[ test]
15- fn controller_routed_git_sync_materializes_private_unavailable_remote_with_changed_since_base ( ) {
15+ fn changed_since_retry_route_materializes_private_unavailable_origin_from_bundle ( ) {
1616 crate :: test_support:: with_isolated_home ( |_| {
1717 let origin = tempfile:: tempdir ( ) . expect ( "origin tempdir" ) ;
1818 let author = tempfile:: tempdir ( ) . expect ( "author tempdir" ) ;
@@ -96,6 +96,28 @@ fn controller_routed_git_sync_materializes_private_unavailable_remote_with_chang
9696 . exists( ) ,
9797 "the fixture must retain a commit graph after its objects are removed"
9898 ) ;
99+ crate :: core:: runner:: create (
100+ & format ! (
101+ r#"{{"id":"lab-local-git-bundle","kind":"local","workspace_root":"{}"}}"# ,
102+ runner_root. path( ) . display( )
103+ ) ,
104+ false ,
105+ )
106+ . expect ( "create runner" ) ;
107+
108+ let args = vec ! [
109+ "homeboy" . to_string( ) ,
110+ "agent-task" . to_string( ) ,
111+ "retry" . to_string( ) ,
112+ "--changed-since" . to_string( ) ,
113+ base. clone( ) ,
114+ ] ;
115+ let changed_since =
116+ crate :: core:: runner:: prepare_git_lab_offload_changed_since ( & args, source. path ( ) )
117+ . expect ( "preflight must resolve the local base without probing private origin" ) ;
118+ assert_eq ! ( changed_since. resolved_base. as_deref( ) , Some ( base. as_str( ) ) ) ;
119+ assert ! ( changed_since. git_fetch_refs. is_empty( ) ) ;
120+
99121 remove_local_packs ( source. path ( ) ) ;
100122 assert ! (
101123 git_without_lazy_fetch(
@@ -113,14 +135,6 @@ fn controller_routed_git_sync_materializes_private_unavailable_remote_with_chang
113135 . is_err( ) ,
114136 "the fixture must leave unrelated promisor objects absent locally"
115137 ) ;
116- crate :: core:: runner:: create (
117- & format ! (
118- r#"{{"id":"lab-local-git-bundle","kind":"local","workspace_root":"{}"}}"# ,
119- runner_root. path( ) . display( )
120- ) ,
121- false ,
122- )
123- . expect ( "create runner" ) ;
124138
125139 let sync_result = sync_workspace (
126140 "lab-local-git-bundle" ,
@@ -130,7 +144,7 @@ fn controller_routed_git_sync_materializes_private_unavailable_remote_with_chang
130144 // The runner first attempts its normal clone. The inaccessible
131145 // origin then exercises the controller bundle fallback.
132146 controller_routed_git : false ,
133- changed_since_base : Some ( base . clone ( ) ) ,
147+ changed_since_base : changed_since . resolved_base ,
134148 git_fetch_refs : Vec :: new ( ) ,
135149 snapshot_includes : Vec :: new ( ) ,
136150 allow_dirty_lab_workspace : false ,
@@ -189,6 +203,10 @@ fn controller_routed_git_sync_materializes_private_unavailable_remote_with_chang
189203 git_output( remote, & [ "merge-base" , & base, "HEAD" ] ) . unwrap( ) ,
190204 base
191205 ) ;
206+ assert_eq ! ( git_output( remote, & [ "rev-parse" , "HEAD" ] ) . unwrap( ) , head) ;
207+ assert ! ( git_output( remote, & [ "status" , "--porcelain=v1" ] )
208+ . expect( "read final checkout status" )
209+ . is_empty( ) ) ;
192210 assert ! (
193211 !git_output(
194212 source. path( ) ,
@@ -599,13 +617,16 @@ fn git_bundle_materialization_disables_lazy_fetches() {
599617 "abc123" ,
600618 None ,
601619 "https://github.example.invalid/example-org/private-source.git" ,
620+ Some ( "def456" ) ,
602621 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" ,
603622 false ,
604623 ) ;
605624
606625 assert ! ( command. contains( "export GIT_NO_LAZY_FETCH=1" ) ) ;
607626 assert ! ( command. contains( "shasum -a 256" ) ) ;
608627 assert ! ( command. contains( "trap 'rm -rf" ) ) ;
628+ assert ! ( command. contains( "rev-parse --verify -q def456^{commit}" ) ) ;
629+ assert ! ( command. contains( "merge-base def456 HEAD" ) ) ;
609630}
610631
611632#[ test]
@@ -616,6 +637,7 @@ fn git_bundle_materialization_rejects_digest_mismatch_before_clone() {
616637 "abc123" ,
617638 None ,
618639 "https://github.example.invalid/example-org/private-source.git" ,
640+ None ,
619641 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" ,
620642 false ,
621643 ) ;
0 commit comments