+
    5mj:                       ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIHt ^ RIHt ^ RIt]P"                  P%                  ^ ]! ]! ]4      P+                  4       P,                  ^,          4      4       ^ RItR^RRRR	R
R. RORRRRRRRRRR///RRR	R
R. RORRRRRRRR///RRR	RR. RORRRRRRRR///./tR^RR U u. uF  p RRV  2R	R
RRR.RRRRV  2RR///NK  	  up /t]P4                  ! RR7      R  4       tRR! R" lltR# tR$ tR% tR& t R' t!R( t"R) t#R* t$R+ t%R, t&R- t'R. t(R/ t)R0R1R2R3R4R1R5R3/t*R6 R7 lt+R8 R9 lt,R: R; lt-RR< R= llt.R> R? lt/RR@ RA llt0RB t1RC RD lt2RE RF lt3RG RH lt4RI RJ lt5RK RL lt6RM RN lt7RO RP lt8RQ t9RR t:RS t;RT t<RU t=RV t>RW t?RX t@RY tARZ tBR[ tCR\ tDR] tER^ tFR_ tGR` tHRa tIRb tJRc tKRd tLRe tMRf tNRg tORh tPRi tQRj tRRk tSRl tTRm tURn tVRo tWRp tXRq tYRr tZRs t[Rt t\Ru t]Rv Rw lt^Rx t_Ry t`Rz R{ ltaR| tbR} R~ ltcR tdR teR tfR tgR thR ti]P                  P                  RRR.4      R 4       tlR tmR tnR toR tpR tqR trR tsR ttR tuR tvR twR# u up i )    )annotationsN)Counter)Pathschema_versionhostsnamedebian1state	reachableroles
agent-seatagent-sandboxaccesstailscale_iphost	100.0.0.1port  useridentity_filez~/.ssh/id_ed25519_buildboxdebian2	100.0.0.2debian3unreachable	100.0.0.3debianz100.0.0.T)autousec                z    V P                  R4      pVP                  \        P                  \	        V4      4       V# )zJNo test may write placement claims into the real ~/.local/state directory.claims)mktempsetenvremote_dispatchCLAIM_DIR_ENVstr)tmp_path_factorymonkeypatch	directorys   && d/home/user/overdeck-private-tests/workstation-ai-broad/modules/systray/tests/test_remote_dispatch.pyisolated_claim_dirr)   D   s4     !''1I44c)nE    c               $    V ^8  d   QhRRRRRR/# )   tmp_pathr   payloadzdict | Nonereturn )formats   "r(   __annotate__r2   L   s!      T K 4 r*   c                z    V R ,          pTP                  \        P                  ! Ve   TM\        4      RR7       V# )zbuildbox-hosts.jsonutf-8encoding)
write_textjsondumpsREGISTRY)r-   r.   paths   && r(   write_registryr<   L   s3    ++DOODJJ'*=w8LW^O_Kr*   c                l    V P                  \        R R 4       \        P                  ! 4       RJ g   Q hR# )in_containerc                     R # Fr0   r0   r*   r(   <lambda>@test_should_offload_true_when_not_in_container.<locals>.<lambda>S       r*   TNsetattrr"   should_offloadr&   s   &r(   .test_should_offload_true_when_not_in_containerrH   R   s+    G))+t333r*   c                l    V P                  \        R R 4       \        P                  ! 4       RJ g   Q hR# )r>   c                     R # Tr0   r0   r*   r(   rA   =test_should_offload_false_when_in_container.<locals>.<lambda>X       r*   FNrD   rG   s   &r(   +test_should_offload_false_when_in_containerrN   W   s+    F))+u444r*   c                b   V P                  R R4       V P                  RR4       V P                  RR4       V P                  RR4       V P                  \        RR 4       \        P                  ! 4       RJ g   Q hV P                  \        RR	 4       \        P                  ! 4       R
J g   Q hR# )CDX_NO_OFFLOAD1OD_REMOTE_EXECHARNESS_SEAT_CONTAINERCDX_OFFLOAD_STRICT0r>   c                     R # r@   r0   r0   r*   r(   rA   1test_should_offload_ignores_env.<locals>.<lambda>b   rC   r*   Tc                     R # rK   r0   r0   r*   r(   rA   rW   e   rM   r*   FN)r!   rE   r"   rF   rG   s   &r(   test_should_offload_ignores_envrY   \   s    '-'-/5+S1G))+t333F))+u444r*   c                 $   R RR/ /p \         P                  ! \        P                  4      ;_uu_ 4       p\        P                  ! V 4       RRR4       XP
                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)r   r	   r   N)pytestraisesr"   OffloadUnavailable
access_forvaluecodeEXIT_NO_NODE)r   exc_infos     r(   1test_access_for_without_a_door_is_a_no_node_errorrc   i   sf    	"D 
99	:	:h""4( 
;>>/">">>>> 
;	:s   A??B	c                     \         P                  ! \        4       U u. uF  q R ,          NK  	  pp VRR.8X  g   Q hR# u up i )r   r	   r   N)r"   candidate_hostsr:   )hnamess     r(   )test_candidate_hosts_excludes_unreachablerh   s   s@     / ? ? IJ I1vYY IEJY	**** Ks   =c                 X   R \        \        R ,          ^,          4      ./p \        P                  ! \        P
                  4      ;_uu_ 4       p\        P                  ! V 4       RRR4       XP                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)r   N)
dictr:   r[   r\   r"   r]   re   r_   r`   ra   )r.   rb   s     r(   /test_candidate_hosts_raises_when_none_reachablerk   x   so    hw/2345G	99	:	:h''0 
;>>/">">>>> 
;	:s   BB)	c                    a R RRR/o\         P                  ! \         P                  ! \        4      V3R lR7      w  rpV R,          R8X  g   Q hVR,          R8X  g   Q hR	# )
r   g      #@r   g?c                $   < SV R ,          ,          # r   r0   aloadss   &r(   rA   5test_select_host_picks_least_loaded.<locals>.<lambda>       ai(r*   prober   r   r   Nr"   select_hostre   r:   )r   r   _claimrq   s      @r(   #test_select_host_picks_least_loadedry      s]    #{C0E*66''1(D& <9$$$&>[(((r*   c                     \         P                  ! \         P                  ! \        4      R  R7      w  rpV R,          R8X  g   Q hR# )c                &    V R ,          R8X  d   R# R# )r   r   Ng      @r0   rp   s   &r(   rA   Atest_select_host_skips_nodes_that_do_not_answer.<locals>.<lambda>   s    &	[ 8AcAr*   rt   r   r	   Nrv   )r   _accessrx   s      r(   /test_select_host_skips_nodes_that_do_not_answerr      s<    +77''1AD6 <9$$$r*   c                     \         P                  ! \        P                  4      ;_uu_ 4        \        P                  ! \        P
                  ! \        4      R  R7       RRR4       R#   + '       g   i     R# ; i)c                    R # Nr0   r|   s   &r(   rA   >test_select_host_raises_when_no_node_answers.<locals>.<lambda>   s    _cr*   rt   N)r[   r\   r"   r]   rw   re   r:   r0   r*   r(   ,test_select_host_raises_when_no_node_answersr      sB    	99	:	:##O$C$CH$MUcd 
;	:	:	:s   2A))A:	c                     \         P                  ! R 4      R8X  g   Q h\         P                  ! R4      e   Q h\         P                  ! R4      e   Q hR# )z0.52 0.31 0.20 1/900 12345
gp=
ף? Ngarbage)r"   parse_loadavgr0   r*   r(   test_parse_loadavgr      sJ    (()GHDPPP((,444((3;;;r*   c                    \         P                  ! \        R 4      4      p \         P                  ! \        R4      4      pV \         P                  ! \        R 4      4      8X  g   Q hW8w  g   Q hV P                  R4      '       g   Q hR# )+/home/user/Projects/overdeck/.worktrees/onez+/home/user/Projects/overdeck/.worktrees/twozsandbox/workspaces/one-N)r"   remote_rel_dirr   
startswith)rp   bs     r(   /test_remote_rel_dir_is_stable_and_path_specificr      sl    &&t,Y'Z[A&&t,Y'Z[A..t4a/bcccc6M6<<12222r*   c                    \        \        4      P                  4       P                  ^,          p V R,          P	                  RR7      pV R,          P	                  RR7      pV R,          P	                  RR7      pRV9   g   Q hRV9   g   Q hRV9   g   Q hR	V9   g   Q hR
V9   g   Q h\        R4      p\
        P                  R8X  g   Q h\
        P                  R8X  g   Q h\
        P                  ! V4      R\
        P                  ! V4       28X  g   Q h\
        P                  ! V4      R\
        P                  ! V4       28X  g   Q hR# )zdispatch, sandbox-run, receiver.mjs and the in-image e2e-remote must name the same
directory, or a dispatched run has no E2E channel and no reachable workspace.z$modules/sandbox/host/bin/sandbox-runr4   r5   z%modules/sandbox/host/lib/receiver.mjsz$modules/sandbox/image/bin/e2e-remotez-SANDBOX_ROOT="${SANDBOX_ROOT:-$HOME/sandbox}"z(WORKSPACE="$SANDBOX_ROOT/workspaces/$ID"z$--volume "$SANDBOX_ROOT:/sandbox:rw"z join(SANDBOX_ROOT, "workspaces")zAWORKSPACES_ROOT="${SANDBOX_WORKSPACES_ROOT:-/sandbox/workspaces}"r   zsandbox/workspacesz/sandbox/workspaceszsandbox/workspaces/z/sandbox/workspaces/N)r   __file__resolveparents	read_textr"   NODE_WORKSPACES_ROOTCONTAINER_WORKSPACES_ROOTr   
sandbox_idcontainer_workspace)reposandbox_runreceiver	image_e2eroots        r(   7test_the_workspace_root_is_the_one_every_party_resolvesr      sL    >!!#++A.D@@KKU\K]K>>IISZI[H>>IISZI[I:kIII5DDD1[@@@-999NR[[[[=>D//3GGGG448MMMM))$/5HIcIcdhIiHj3kkkk..t4
99$?@A  r*   c                 N   \         P                  ! \        R ,          ^ ,          R,          R,          4      p V R,          . RO8X  g   Q hRV 9   d   RV 9   g   Q hV R,          R8X  g   Q h\        ;QJ d    R V  4       F  '       g   K   RM	  R	M! R V  4       4      '       g   Q hR
# )r   r   r   :N   N-p2222zuser@100.0.0.1c              3  B   "   T F  qP                  R 4      x  K  	  R# 5i)id_ed25519_buildboxN)endswith).0rp   s   & r(   	<genexpr>Jtest_ssh_argv_pins_identity_port_and_ignores_ssh_config.<locals>.<genexpr>   s     ?$Qzz/00$s   TFN)sshz-F	/dev/null)r"   ssh_argvr:   anyargvs    r(   7test_ssh_argv_pins_identity_port_and_ignores_ssh_configr      s    ##HW$5a$8$B>$RSD811114<FdN**8''''3?$?333?$?????r*   GIT_AUTHOR_NAMEtGIT_AUTHOR_EMAILzt@example.invalidGIT_COMMITTER_NAMEGIT_COMMITTER_EMAILc               $    V ^8  d   QhRRRRRR/# )r,   argsr$   cwdr   r/   zsubprocess.CompletedProcessr0   )r1   s   "r(   r2   r2      s"     	 	s 	 	"= 	r*   c                    \         P                  ! R .VOV RR/ \        P                  C\        CRRRR/CR7      pVP
                  ^ 8X  g   Q VP                  4       hV# )/usr/bin/gitTGIT_CONFIG_GLOBALr   GIT_CONFIG_SYSTEM)r   capture_outputtextenv)
subprocessrunosenvironGIT_ENV
returncodestderr)r   r   dones   $* r(   gitr      se    >>	$irzziWi&9;H[]hiD ??a,,Kr*   c                    V ^8  d   QhRRRR/# )r,   r-   r   r/   r0   )r1   s   "r(   r2   r2      s        r*   c           	         V R,          pVP                  4        \        RRRRRVR7       VR,          P                  R	R
R7       \        RRVR7       \        RRRVR7       V# )uL   A real checkout — a hand-written `.git` fixture is what let this bug ship.r   init-q-bmain.r   file.txtzone
r4   r5   addcommit-qm)mkdirr   r7   r-   r   s   & r(   	make_repor      s^    fDJJLdFCT2	J""7W"=zt$%T*Kr*   c               $    V ^8  d   QhRRRRRR/# )r,   r   r   slugr$   r/   r0   )r1   s   "r(   r2   r2      s!      t 3 4 r*   c           
     b    V R ,          V,          p\        RRRRRV 2\        V4      V R7       V# )
.worktreesworktreer   r   r   zwt/r   )r   r$   )r   r   r;   s   && r(   add_worktreer      s4    ,%D
E4TF|SYDIKr*   c               (    V ^8  d   QhRRRRRRRR/# )r,   r;   r   runtimer$   r   r/   zremote_dispatch.Credentialr0   )r1   s   "r(   r2   r2      s/     M M$ M Mc MOi Mr*   c                X    V P                  R RR7       \        P                  ! WV R7      # )tokenr4   r5   )r   r   r;   )r7   r"   
Credential)r;   r   r   s   &&&r(   make_credentialr      s%    OOGgO.%%gtLLr*   c                    V ^8  d   QhRRRR/# )r,   urlr$   r/   r0   )r1   s   "r(   r2   r2      s     9 9 9 9r*   c                p    R V P                  R^4      ^,          P                  R ^4      ^,          ,           # )/z://)split)r   s   &r(   _strip_ssh_urlr      s/    5!$Q'--c15a888r*   c                    V ^8  d   QhRRRR/# )r,   	node_homer   callszlist[list[str]] | Noner0   )r1   s   "r(   r2   r2      s        $  /E  r*   c                >   a a S P                  RRR7       VV 3R lpV# )a  Simulate the node as a real local `$HOME` and the bare mirror as a real local git
repo: an `ssh` argv runs its trailing command through `bash -c` with `HOME` and `cwd`
set to `node_home` (matching a real ssh session's default cwd), and any `ssh://` remote
in a `git push`/`fetch` argv is rewritten to the local path it names. This runs
`open_session`'s git-push transport for real, end to end, with no network.T)r   exist_okc                T  < Se   SP                  V 4       V R,          R.8X  d\   \        P                  ! RRV R,          .RR\        S4      / \        P
                  CR\        S4      /CVP                  R4      R7      # V R,          R	.8X  d|   V  Uu. uF&  q"P                  R
4      '       d   \        V4      MTNK(  	  pp\        P                  ! VRRVP                  R4      VP                  R4      VP                  R4      R7      # \        P                  ! V ^ RRR7      # u upi )NN   Nr   bash-cTHOMEtimeout)r   r   r   r   r   r   ssh://r   input)r   r   r   r   r   r   stdoutr   r   )
appendr   r   r$   r   r   getr   r   CompletedProcess)r   kwargstok	rewrittenr   r   s   &,  r(   fake_run$real_node_fake_run.<locals>.fake_run   s   LL8w>>tBx(#	N:rzz:63y>:

9-  8'']ab]aVYx0H0H,cQ]aIb>>#JJu%jj)

9-  **42bII cs   ,D%)r   )r   r   r   s   ff r(   real_node_fake_runr     s"     OOD4O0J0 Or*   c                    \         R ,          ^,          R,          R,          p \        R4      p\        P                  ! V4      p\        P                  ! WV4      p\        P
                  ! WV4      pVR
R V R2RV R2.8X  g   Q hVR
R RV R2V R2.8X  g   Q hV Uu. uF#  qUVR
,          8w  g   K  WSR,          8w  g   K!  VNK%  	  upRR
 V Uu. uF#  qUVR
,          8w  g   K  WTR,          8w  g   K!  VNK%  	  upRR
 8X  g   Q hRV9   d   RV9   g   Q hRV9   d   RV9   g   Q hR	V9   d   R	V9   g   Q hR# u upi u upi )r   r   r   z/home/user/Projects/overdeckNr   zuser@100.0.0.2:node_modulesr   .tmpjail-workr   )r:   r   r"   r   	push_argv	pull_argv)r   r   relpushpullrp   s         r(   <test_push_and_pull_are_mirror_images_with_identical_excludesr    sn   gq!(+N;F./D

(
(
.C$$V37D$$V37D9D6se1%=>>>>9?3%q1dV1:>>>>?t!DH}A2hAAt?DIaR=Qr(]4I	rI    T!n&<<<4LD$888d"$'>>>'> @ Is$    D94
D9D9D>&
D>5D>c                   V ^8  d   QhRR/# r,   r-   r   r0   )r1   s   "r(   r2   r2   $  s     1 1D 1r*   c                   V R ,          pVR,          P                  RR7       VR,          R,          P                  RRR7       VR,          R	,          pVP                  RR7       VP                  ^ 4       V R
,          pVP                  4         \        P                  ! RR.\
        P                  ! 4       OV R2NV R2NRRR7      pVP                  R4       VP                  ^ 8X  g   Q VP                  4       hVR,          R,          P                  RR7      R8X  g   Q hVR,          P                  4       '       d   Q hR#   TP                  R4       i ; i)r   srcTr   zkeep.txtkeepr4   r5   r  workmirrorrsync-ar   r   r   i  N)r   r7   chmodr   r   r"   _exclude_argsr   r   r   exists)r-   r   workdirdestr   s   &    r(   -test_sync_skips_an_unreadable_overlay_workdirr  $  s:   fD	E\&	E\J**6G*D_$v-GMM$MMM%hDJJL~~dU_::<UajUTFRS*U
 	e??a,,5L:%00'0BfLLL&..00000 	es   :E Ec                   V ^8  d   QhRR/# r  r0   )r1   s   "r(   r2   r2   :  s     !^ !^QU !^r*   c                   \        V 4      pVR ,          pVP                  4        VR,          P                  RRR7       VR,          P                  RRR7       \        RRVR	7       \        RR
RVR	7       \        RRRVR	7       VR,          P                  RRR7       VR,          P                  RRR7       V R,          pVP                  4        \        P
                  ! V4      p\        VP                  R4      P                  R4      4      pRV9   g   Q hRV9   g   Q hRV9  g   Q hRV9  g   Q h\        P                  ! \        P                  ! V R2V R24      VRR7      pVP                  ^ 8X  g    Q VP                  P                  4       4       h\        P                  ! . RO\        P                  ! 4       OV R2NV R2NRR7      pVP                  ^ 8X  g    Q VP                  P                  4       4       hVR ,          R,          P!                  RR7      R8X  g   Q hVR ,          R,          P#                  4       '       d   Q hVR ,          R,          P!                  RR7      R8X  g   Q hR# )nestedz
.gitignorez ignored.txt
tracked-ignored.txt
r4   r5   ztracked-ignored.txttrackedr   znested/.gitignorer   -fznested/tracked-ignored.txtr   r   zadd nested ignorezignored.txtignoredzunignored.txt	unignoredr      s   nested/.gitignores   nested/tracked-ignored.txts   nested/unignored.txts   nested/ignored.txtr   T)r   r   )r   N)r  r  --delete)r   r   r7   r   r"   git_mirror_filessetrstripr   r   r   tracked_sync_argvr   r   decoder  r   r  )r-   r   r   r  selectedselected_pathsr!  filtereds   &       r(   Btest_mirror_uses_nested_gitignore_without_dropping_tracked_matchesr/  :  sK   XDH_F
LLNl&&'KV]&^##//	G/L"-t1t<%,$7m''	G'Do))+)HhDJJL//5H/55e<=N>111(N:::".888 666nn))TF!*ajAG
 ";GNN$9$9$;;"~~]_%B%B%D]aj]UYTZZ[R\]H !#=X__%;%;%==#8Oo-88'8JkYYYx-/7799998O33>>>PT]]]]r*   c                    V ^8  d   QhRRRR/# )r,   r-   r   capsyszpytest.CaptureFixture[str]r0   )r1   s   "r(   r2   r2   ^  s     & &&6&r*   c           
         \        V 4      pVR ,          P                  RRR7       VR,          R,          R,          R,          pVP                  P                  RR	7       VP                  R
RR7       VR,          P                  RRR7       \	        RRR RRVR7       \
        P                  ! V4      p\        VP                  R4      P                  R4      4      pRV9  g   Q hRV9   g   Q hRV9   g   Q hVP                  4       P                  pRV9   g   Q hRV9   g   Q hRV9  g   Q h\
        P                  ! V4      p\        \	        RRRWrR7      P                  P                  4       4      pR V9  g   Q hRV9   g   Q hRV9   g   Q hR# )z.envzTOKEN=do-not-ship
r4   r5   modulesharnessseatzcredentials.jsonTr  z{"items":[]}
z
normal.txtzship me
r   r"  z%modules/harness/seat/credentials.jsonr   r%  s   .envs%   modules/harness/seat/credentials.jsons
   normal.txtz"excluded secret-shaped file '.env'z!environment file (.env or .env.*)zdo-not-shipzls-treez-rz--name-onlyN)r   r7   parentr   r   r"   r'  r(  r)  r   
readouterrerrsnapshot_commitr   
splitlines)	r-   r1  r   manifestr,  pathslogsnapshot
tree_pathss	   &&       r(   Ttest_dispatch_secret_filter_excludes_and_logs_env_but_keeps_manifest_and_normal_filer@  ^  s    XD	F]4wGi)+f47IIHOO$'(7;	L$$[7$CtVDlX\]//5H&,,U34E%3u<<<E!!!




!
!C/3666.#555###..t4HSD-LSS^^`aJ###2j@@@:%%%r*   c                   V ^8  d   QhRR/# r  r0   )r1   s   "r(   r2   r2   {  s     & &QU &r*   c                   \        \        4      P                  ^,          R,          R,          R,          R,          p\        P                  P                  RV4      pV'       d   VP                  '       g   Q h\        P                  P                  V4      pVP                  P                  V4       V R,          pVP                  RRR	7       R
 pVP                  VP                  RV4       \        VP                  VP                  V4      4      4      p\        VP                  R.4      4      pRV9   g   Q hVP                  V4      '       g   Q hR# )r,   sandboxr   libegress-policy.pyegress_policy_test
allow.jsonz0{"schema_version":1,"hosts":["allowed.example"]}r4   r5   c                .    R RRR/p^^^RW0,          ^ 33.# )zallowed.example203.0.113.10denied.examplez203.0.113.99r   r0   )r   _args_kwargsvaluess   &*, r(   fake_getaddrinfo\test_egress_policy_allows_resolved_allowlist_and_omits_denied_host.<locals>.fake_getaddrinfo  s,    #^5E~VAq"v|Q/011r*   getaddrinforJ  rI  N)r   r   r   	importlibutilspec_from_file_locationloadermodule_from_specexec_moduler7   rE   socketr(  resolve_hosts
load_hosts
isdisjoint)	r-   r&   r;   specpolicyconfigrN  alloweddenieds	   &&       r(   Btest_egress_policy_allows_resolved_allowlist_and_omits_denied_hostr`  {  s   >!!!$y069EADVVD>>112FMDDKKK^^,,T2FKKF#$F
HSZ[2 }6FG&&&v'8'8'@ABG%%'7&89:FW$$$f%%%%r*   c                   V ^8  d   QhRR/# r  r0   )r1   s   "r(   r2   r2     s     8 8 8r*   c                   \        \        4      P                  ^,          R,          R,          R,          R,          p\        P                  P                  RV4      pV'       d   VP                  '       g   Q h\        P                  P                  V4      pVP                  P                  V4       V R,          pVP                  RRR	7       VP                  R
\        V4      .4      ^8X  g   Q hR# )r,   rC  r   rD  rE  egress_policy_invalid_testrG  z{"schema_version":1,"hosts":[]}r4   r5   z--configN)r   r   r   rQ  rR  rS  rT  rU  rV  r7   r   r$   )r-   r;   r[  r\  r]  s   &    r(   9test_egress_policy_fails_closed_when_allowlist_is_invalidrd    s    >!!!$y069EADVVD>>112NPTUDDKKK^^,,T2FKKF#$F
7'J;;
CK01R777r*   c                   V ^8  d   QhRR/# r  r0   )r1   s   "r(   r2   r2     s     "% "%SW "%r*   c                   \        V R ,          4      pV R,          p\        P                  ! RRRVRRR.\        P                  ! V4      R7      pV\	        \        P
                  4      R	RR
\        P                  ! V4      RRRRRRRRRR.8X  g   Q h\        P                  ! V4      P                  R4      '       g   Q hRV9  g   Q hR# )	cred.json	workspacer	   z//home/nodeuser/cdx-offload/git-common/repo-9999z"/home/nodeuser/.git/worktrees/maincodexexeczhello world)	host_name
git_commongit_dir
credential	exec_nameforwarded_argvr   z--hostz--idz	--runtime--git-common	--git-dir--z
workspace-z--workspaceN)r   r"   launcher_argvr   r$   AGENT_SANDBOX_BINr   )r-   credr   r   s   &   r(   Dtest_launcher_argv_starts_the_container_with_pinned_invocation_shaperw    s    8k12Dk!D((D4."--d3D O--.""4(9,   $ %%d+66|DDDD $$$r*   c                   V ^8  d   QhRR/# r  r0   )r1   s   "r(   r2   r2     s     6 6T 6r*   c                |    \         P                  ! R \        V R,          4      RRR.RR7      pVRR . R	O8X  g   Q hR# )
r	   z
cred2.jsonri  rj  hizcdx-offload-d-1234)rk  rn  ro  rp  r   N)rs  ri  rj  rz  )r"   rt  r   )r-   r   s   & r(   >test_launcher_invocation_puts_the_command_after_bare_dash_dashr|    sF    (("8l#:;~'D 95555r*   c           	     `  a a . oS R ,          pV3R lpVP                  \        RRV 3R ll4       \        P                  ! RRR.\        V4      \	        S 4      VR R	7      pVP
                  R
8X  g   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       g   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       g   Q hVP                  ^ ,          \        \        P                  4      8X  g   Q hVP                  \        P                  ! S R,          4      8X  g   Q hVP                  R8X  g   Q hVP                  RVP                   28X  g   Q hVP                  R8X  g   Q hVP                  \        V4      8X  g   Q hR# )rg  c                  < SP                  V 4       V R ,          R.8X  d   \        P                  ! V ^ RRR7      # RRP                  V 4      9   d   \        P                  ! V ^ RRR7      # \        P                  ! V ^ RRR7      # r   r  r   r   printf '%s\n' "$HOME" /home/nodeuser
r   r   r   joinr   r   r   s   &,r(   r   Ctest_open_session_pushes_then_returns_remote_argv.<locals>.fake_run  t    T8y ..tQr"MM%$7..tQ?QZ\]]**42bIIr*   	repo_rootNc                   < SR ,          # r   r0   r   r-   s   &r(   rA   Ctest_open_session_pushes_then_returns_remote_argv.<locals>.<lambda>      xRXGXr*   ri  rj  rz  c                &    V R ,          R8X  d   R# R# r   r         ?g      @r0   r|   s   &r(   rA   r        qyK7@S@r*   rn  registry_pathr   ru   r	   c              3  J   "   T F  pR RP                  V4      9   x  K  	  R# 5izmkdir -pr  Nr  r   cs   & r(   r   Dtest_open_session_pushes_then_returns_remote_argv.<locals>.<genexpr>       8%QzSXXa[(%   !#TFc              3  8   "   T F  q^ ,          R8H  x  K  	  R# 5ir   r  Nr0   r  s   & r(   r   r         .1tw   r   z/home/nodeuserz/home/nodeuser/r   r0   )rE   r"   open_sessionr   r<   rk  r   r   r$   ru  r   r   rh  rel_dirmountsrn  )r-   r&   	cred_pathr   sessionr   s   f&   @r(   1test_open_session_pushes_then_returns_remote_argvr    sf   E;&IJ 6XY**	"9-$X.@G 	)))38%83338%888883..333......<<?c/"C"CDDDD!;!;Hv<M!NNNN 0000/'//1B CCCC>>R!;;;;r*   c           	        \         P                  ! \        P                  4      ;_uu_ 4       p\        P                  ! R RR.\        V 4      R R7       RRR4       XP                  P                  \        P                  8X  g   Q hR \        VP                  4      9   g   Q h\        VP                  R4      4      . 8X  g   Q hR#   + '       g   i     Lz; i)ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   @test_open_session_requires_a_credential_object.<locals>.<lambda>      Cr*   )r  ru   N*.claim)r[   r\   r"   r]   r  r<   r_   r`   EXIT_CREDENTIALr$   listglob)r-   r)   rb   s   && r(   .test_open_session_requires_a_credential_objectr    s    	99	:	:h$$TN(2		
 
; >>/"A"AAAAc(..))))"''	23r999 
;	:s   'CC	c                x   V R ,          pVP                  RRR7       VP                  4        \        P                  ! \        P
                  4      ;_uu_ 4       p\        P                  ! RRR.\        P                  ! RRV4      \        V 4      R R	7       R
R
R
4       XP                  P                  \        P                  8X  g   Q hR\        VP                  4      9  g   Q hR\        VP                  4      9   g   Q h\        V4      \        VP                  4      9   g   Q hR
#   + '       g   i     L; i)rg  zvery-sensitive-tokenr4   r5   ri  rj  rz  acctc                    R # r  r0   r|   s   &r(   rA   Stest_open_session_rejects_a_missing_or_unreadable_credential_path.<locals>.<lambda>  r  r*   rn  r  ru   N)r7   unlinkr[   r\   r"   r]   r  r   r<   r_   r`   r  r$   )r-   credential_pathrb   s   &  r(   Atest_open_session_rejects_a_missing_or_unreadable_credential_pathr    s    ,O5H	99	:	:h$$TN&11'6?S(2	
 
; >>/"A"AAAA!X^^)<<<<c(..))))3x~~#6666 
;	:s   >D))D9	c                  a  R  pVP                  \        RRV 3R ll4       \        P                  ! \        P                  RR7      ;_uu_ 4       p\        P
                  ! RRR.\        S R	,          4      \        S 4      VR
 R7       RRR4       XP                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)c                    V ^ ,          R8X  d   ^M^ pV ^ ,          R8X  d   \         P                  ! V ^ RRR7      # \         P                  ! WRRR7      # )r   r  r   r  r   r   	disk fullr   r   r   r   rcs   &, r(   r   Dtest_open_session_fails_closed_when_the_push_fails.<locals>.fake_run
  sT    q'W$Q!7e..a 22  **4B{SSr*   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Dtest_open_session_fails_closed_when_the_push_fails.<locals>.<lambda>  r  r*   zmirror push failed)matchri  rj  rz  rg  c                    R # r  r0   r|   s   &r(   rA   r    r  r*   r  r   )rE   r"   r[   r\   r]   r  r   r<   r_   r`   EXIT_MIRROR)r-   r&   r   rb   s   f&  r(   2test_open_session_fails_closed_when_the_push_failsr  	  s    T 6XY	99AU	V	VZb$$TN&x+'=>(2	
 
W >>/"="==== 
W	Vs   9B>>C	c                    \         P                  ! R \        R,          ^ ,          R,          R,          V RR.R7      pVP                  R R7      pVe   R V9   d   R
V9   g   Q hVP                  R R7       e   Q hR	# )r	   r   r   r   zcdx-offload/xr   )rk  r   r   r  r   c                6    \         P                  ! V ^RRR7      # )   r   boomr   r  r   kws   &,r(   rA   Ctest_pull_back_reports_failure_instead_of_raising.<locals>.<lambda>(  s    z::4BW]^r*   r   Nr  c                6    \         P                  ! V ^ RRR7      # r   r   r   r  r  s   &,r(   rA   r  ,  s    z::42VXYr*   )r"   Sessionr:   	pull_back)r-   r  r8  s   &  r(   1test_pull_back_reports_failure_instead_of_raisingr    s    %% #H-n=WG 

^  C ?yC/FcMAAY  	  r*   c                &   \         P                  ! \        P                  4      ;_uu_ 4       p\        P                  ! V R ,          4       RRR4       XP
                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)z	nope.jsonN)r[   r\   r"   r]   load_registryr_   r`   ra   )r-   rb   s   & r(   6test_load_registry_missing_file_is_offload_unavailabler  0  sX    	99	:	:h%%h&<= 
;>>/">">>>> 
;	:s   B  B	c                L    \         P                  ! \        V 4      4      e   Q hR # r   )r"   
git_mirrorr   )r-   s   &r(   ,test_git_mirror_is_none_for_a_plain_checkoutr  6  s    %%i&9:BBBr*   c                l    V R ,          pVP                  4        \        P                  ! V4      e   Q hR# )notrepoN)r   r"   r  )r-   plains   & r(   ,test_git_mirror_is_none_outside_a_repositoryr  :  s,    y E	KKM%%e,444r*   c                   \        V 4      p\        VR 4      p\        P                  ! V4      pVf   Q hVP                  VR,          R,          R ,          P                  4       8X  g   Q hVP                  VR,          P                  4       8X  g   Q hVP                  P                  R4      '       g   Q hVP                  VP                   R28X  g   Q hR# )alphaN.git	worktreeszcdx-offload/git-common/repo-z/worktrees/alpha)
r   r   r"   r  rm  r   
common_dirremote_commonr   remote_git_dir)r-   r   wtr  s   &   r(   Ntest_git_mirror_detects_a_linked_worktree_and_targets_the_common_worktrees_dirr  @  s    XD	dG	$B''+F>>dVmk9GCLLNNNN 7 7 9999**+IJJJJ  v';';&<<L$MMMMr*   c                   \        V 4      p\        P                  ! \        VR 4      4      p\        P                  ! \        VR4      4      pVP                  VP                  8X  g   Q hVP
                  VP
                  8w  g   Q hR# )onetwoN)r   r"   r  r   r  r  )r-   r   r  r  s   &   r(   Itest_two_worktrees_of_one_repo_share_the_common_mirror_but_not_the_gitdirr  K  sn    XD

$
$\$%>
?C

$
$\$%>
?C 1 1111!3!3333r*   c                    \         R ,          ^,          R,          R,          p \        P                  ! \        R4      \        R4      RRR7      p\        P                  ! W4      pRV9  g   Q hW"P                  R	4      ^,           ,          R
8X  g   Q hVRR RR.8X  g   Q h\        P                  ! W4      pRV9   g   Q hVRR RR.8X  g   Q hR# )r   r   r   z/r/.git/worktrees/a/r/.gitcdx-offload/git-common/r-abcz(cdx-offload/git-common/r-abc/worktrees/arm  r  r  r  r&  	--excludez
/worktreesNz/r/.git/z,user@100.0.0.2:cdx-offload/git-common/r-abc/z/r/.git/worktrees/a/z8user@100.0.0.2:cdx-offload/git-common/r-abc/worktrees/a/r  )r:   r"   	GitMirrorr   git_common_push_argvindexgit_dir_push_argv)r   r  r   gitdirs       r(   >test_common_push_keeps_sibling_worktrees_out_and_never_deletesr  S  s    gq!(+N;F&&*+	?4A	F //?DT!!!

;'!+,<<<9%STTTT..v>F"#;B   r*   c            	       a \         R ,          ^,          R,          R,          p \        P                  ! \        R4      \        R4      RRR7      p. oV3R lp\        P                  ! V R	R
RVVR7       e   Q hS^ ,          RR \        P
                  ! V 4      8X  g   Q hS^ ,          R,          R8X  g   Q hS^,          \        P                  ! W4      8X  g   Q hS^,          \        P                  ! W4      8X  g   Q hR# )r   r   r   /r/.git/worktrees/a br  r  z*cdx-offload/git-common/r-abc/worktrees/a br  c                Z   < SP                  V 4       \        P                  ! V ^ RRR7      # r  )r   r   r   )r   rL  r   s   &,r(   r   Ktest_prepare_remote_git_creates_destinations_before_rsync.<locals>.fake_runr  s&    T**42bIIr*   r   zcdx-offload/rz/home/user/cdx-offload/rr  NzRmkdir -p cdx-offload/git-common/r-abc 'cdx-offload/git-common/r-abc/worktrees/a b'r   )r:   r"   r  r   prepare_remote_gitr   r  r  )r   r  r   r   s      @r(   9test_prepare_remote_git_creates_destinations_before_rsyncr  h  s   gq!(+N;F&&,-	?4C	F  EJ --	?,F 
   8CR=O44V<<<<8B<	7   8;;FKKKK888HHHHr*   c            	         \         R ,          ^,          R,          R,          p \        R4      p\        P                  \        P                  3 F%  pRV! WRRR7      9   g   Q hRV! WR4      9  d   K%  Q h	  R# )	r   r   r   z)/home/user/Projects/overdeck/.worktrees/xz/.gitdT)exclude_gitN)r:   r   r"   r  r  )r   r   builds      r(   ?test_dot_git_is_excluded_both_ways_only_for_a_worktree_dispatchr    sn    gq!(+N;F;<D!++_-F-FG%ctDDDDeF#6666 Hr*   c           
        \        V 4      p\        VR4      p\        P                  ! V4      p\        P                  ! V4      p\        P
                  ! V4      pV R,          p\        P                  ! W&V,          \        P                  ! R4      R7       \        P                  ! VP                  WcP                  ,          \        P                  ! R4      R7       \        P                  ! VP                  WcP                  ,          4       \        P                  ! RR\        P                  ! WEV4      .RR/ \         P"                  C\$        CR	\'        V4      /CR
7      pVP(                  ^ 8X  g   Q VP*                  4       hWd,          pVR,          P-                  RR7      RWcP                  ,           R28X  g   Q hWcP                  ,          R,          P-                  RR7      R8X  g   Q hWcP                  ,          R,          P-                  RR7      V R28X  g   Q h\/        RRVR7      P0                  P3                  4       \'        V4      8X  g   Q hR\/        RRVR7      P0                  9   g   Q hVR,          P5                  RRR7       \/        RRVR7       \/        RRRVR7       \/        RR R!VR7      P0                  P3                  4       R8X  g   Q hR"# )#zNRuns the real remote script against a real mirror laid out under a fake $HOME.r  zremote-homer  )ignorer  r   r   Tr   )r   r   r   r4   r5   zgitdir: 
	commondirz../..
r  z/.git
	rev-parsez--show-toplevelr   zwt/alphastatusz-sbr   zedited on the node
r   r   r   z	node editr=  -1z--pretty=%sN)r   r   r"   r  r   r   shutilcopytreeignore_patternsr  r  rm  r  r   r   git_pointer_commandr   r   r   r$   r   r   r   r   r   stripr7   )	r-   r   r  r  r  container_dirhomer   	remote_wts	   &        r(   Ctest_pointer_command_makes_the_mirrored_worktree_a_working_checkoutr    sn   XD	dG	$B''+F,,R0G#77;Mm#D
OOBwv/E/Ef/MN
OO4"6"66v?U?UVa?b OOFNND+@+@$@A>>	::7SYZ[8rzz8W8fc$i8	D ??a,,I))7);
4///03   (((;6AA7ASW````(((83>>>P/!   {-9=DDJJLPST]P^^^^Xu)<CCCCC''(>'Qzy)%)4udMy9@@FFHKWWWr*   c            	     F   \         P                  ! \        R 4      \        R4      RRR7      p \         P                  ! RRV 4      p\        P
                  ! RRR	VP                  R
^4      ^,           2.RRR7      pRVP                  9   g   Q hRVP                  9   g   Q hR# )r  r  z#cdx-offload/git-common/r' $(id)-abcz1cdx-offload/git-common/r' $(id)-abc/worktrees/a br  zsandbox/workspaces/x y-1z/sandbox/workspaces/x y-1r   r   zprintf '%s' z	bash -lc Tr  z$(id)z'sandbox/workspaces/x y-1'N)r"   r  r   r	  r   r   r   r   )r  cmdproofs      r(   >test_pointer_command_survives_a_path_with_shell_metacharactersr    s    &&,-	?;J	F 
-
-"$?C NN	ciiQ&?&B%CDEE
 ell"""'5<<777r*   c           	     f  a \        V 4      p\        VR 4      oSR,          P                  RRR7       . pV R,          p\        V R,          V4      pVP	                  \
        RR$V3R	 ll4       \
        P                  ! R
RR.\        V4      \        V 4      VR R7      pVP                  RJ g   Q hVP                  e   Q hVP                  RJ g   Q hVP                  VP                  38X  g   Q hRVP                  9   d   VP                  VP                  9   g   Q hRVP                  9  g   Q hVP                  f   Q h\         ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   Q hV R,          VP"                  ,          pVR,          P%                  RR7      R8X  g   Q h\'        RRVR7      pVP(                  P+                  4       R8X  g   Q h\'        RRRVR7      P(                  P+                  4       VP                  8X  g   Q hVR,          P                  RRR7       VP-                  VR7      p	V	e   Q hSR,          P%                  RR7      R8X  g   Q hSR,          P%                  RR7      R8X  g   Q h\'        RRSR7      P(                  P/                  4        U
u/ uF  qR,          V
R ,          bK  	  pp
VP1                  R4      R!8X  g   Q hVP1                  R4      R!8X  g   Q hR"V9  g   Q hSR#,          P3                  4       '       d   Q hR# u up
i )%r  untracked.txtzscratch
r4   r5   rg  r   r  Nc                   < S# r   r0   )r   r  s   &r(   rA   Ztest_open_session_uses_git_push_for_a_worktree_and_the_result_comes_home.<locals>.<lambda>  s    rr*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r        r*   r  TFrq  rr  c              3  8   "   T F  q^ ,          R8H  x  K  	  R# 5ir  r0   r  s   & r(   r   [test_open_session_uses_git_push_for_a_worktree_and_the_result_comes_home.<locals>.<genexpr>       2EqQ47?Er  r  z--shortr   r   r=  r  z--format=%Hzmade-remotely.txtzresult
r  z--porcelain:r   NN:Nr,   Nz??zcdx-offload.lockz.cdx-offload.lockr   )r   r   r7   r  rE   r"   r  r   r<   git_pushgit_warningr  r  bare_absr   pre_shar   r  r   r   r   r
  r  r:  r   r  )r-   r&   r   r   r  r   r  node_workspacer  errorline	porcelainr  s   &&          @r(   Htest_open_session_uses_git_push_for_a_worktree_and_the_result_comes_homer$    s   XD	dG	$B/%%kG%DE;&I!(["8%@H6IJ**	"9-$X.G t###&&&%'''>>g..0000W\\)g.>.>',,.NNNgll***??&&&s2E2sss2E22222+goo=N_,777I[XXX9.9F== B&&&udM~>EEKKMQXQ`Q````))55j75S(+E==$$///AZOOO ++W+=LLL 14HmQS0T0[0[0f0f0hi0hb48#0hIi==,-555==)T111Y...((0022222	 js   9L.c           	       a \        V 4      o. pV R ,          p\        V R,          V4      pVP                  \        RRV3R ll4       \        P                  ! RRR.\        V4      \        V 4      VR R	7      pVP                  R
J g   Q hVP                  f   VP                  RJ g   Q hVP                  VP                  38X  g   Q h\        ;QJ d    R V 4       F  '       g   K   R
M	  RM! R V 4       4      '       d   Q hR# )rg  r   r  Nc                   < S# r   r0   r   r   s   &r(   rA   Jtest_open_session_uses_git_push_for_a_plain_checkout_too.<locals>.<lambda>      tr*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r(     r  r*   r  TFc              3  8   "   T F  q^ ,          R8H  x  K  	  R# 5ir  r0   r  s   & r(   r   Ktest_open_session_uses_git_push_for_a_plain_checkout_too.<locals>.<genexpr>  r  r  r   )r   r  rE   r"   r  r   r<   r  r  r  r  r  r   )r-   r&   r   r  r   r  r   s   &&    @r(   8test_open_session_uses_git_push_for_a_plain_checkout_toor-    s    XDE;&I!(["8%@H6KL**	"9-$X.G t###&7+>+>%+GGG>>g..0000s2E2sss2E222222r*   c           	       a \        V 4      oV R ,          p\        V R,          4      pVP                  \        RRV3R ll4       \        P                  ! RRR.\        V4      \        V 4      VR R	7      pSR
,          P                  RRR7       VP                  VR7      pVf   Q hRV9   g   Q hSR
,          P                  RR7      R8X  g   Q hR# )rg  r   r  Nc                   < S# r   r0   r'  s   &r(   rA   Stest_open_session_pull_back_refuses_when_the_local_checkout_moved.<locals>.<lambda>  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r0    r  r*   r  z	raced.txtzowner touched this
r4   r5   r  znot overwritingr   )
r   r  rE   r"   r  r   r<   r7   r  r   )r-   r&   r  r   r  r!  r   s   &&    @r(   Atest_open_session_pull_back_refuses_when_the_local_checkout_movedr2    s    XD;&I!(["89H6KL**	"9-$X.G 
K##$:W#M(+E%%%;))7);?UUUUr*   c                  aa \        V 4      oV R ,          p\        V R,          4      oV3R lpVP                  \        RRV3R ll4       \        P
                  ! \        P                  4      ;_uu_ 4       p\        P                  ! RRR.\        V4      \        V 4      VR	 R
7       RRR4       XP                  P                  \        P                  8X  g   Q hR\        VP                  4      9   g   Q hR#   + '       g   i     LY; i)rg  r   c                   < V R ,          R.8X  d)   RV R,          9   d   \         P                  ! V ^RRR7      # S! V 3/ VB # )r   r   zgit init -q --barer   no space left on devicer   r   r  r   r   base_fake_runs   &,r(   r   Xtest_open_session_fails_closed_when_the_bare_mirror_cannot_be_prepared.<locals>.fake_run"  sE    8w#748#C..tQrJcddT,V,,r*   r  Nc                   < S# r   r0   r'  s   &r(   rA   Xtest_open_session_fails_closed_when_the_bare_mirror_cannot_be_prepared.<locals>.<lambda>'  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r:  /  r  r*   r  r5  r   )r   r  rE   r"   r[   r\   r]   r  r   r<   r_   r`   r  r$   )r-   r&   r  r   rb   r7  r   s   &&   @@r(   Ftest_open_session_fails_closed_when_the_bare_mirror_cannot_be_preparedr<    s    XD;&I&x+'=>M-
 6KL	99	:	:h$$TN&y1(2	
 
; >>/"="====$HNN(;;;; 
;	:s   82C;;D	c           	       aa V R ,          oSP                  4        \        P                  ! . ROSRR7       . oV R,          pV3R lpVP                  \        RRV3R ll4       \        P
                  ! RR	R
.\        V4      \        V 4      VR R7      pVP                  RJ g   Q hVP                  e   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       g   Q hR# )z
fresh-repoTr   checkrg  c                
  < V R ,          R.8X  d   \         P                  ! V RRR7      # SP                  V 4       RRP                  V 4      9   d   \         P                  ! V ^ RRR7      # \         P                  ! V ^ RRR7      # )	r   r   Tr  r  r  r  r   r   )r   r   r   r  r   r  s   &,r(   r   ]test_open_session_falls_back_to_the_tree_copy_transport_when_head_is_unborn.<locals>.fake_run<  sq    8''>>$t$GGT%$7..tQ?QZ\]]**42bIIr*   r  Nc                   < S# r   r0   r'  s   &r(   rA   ]test_open_session_falls_back_to_the_tree_copy_transport_when_head_is_unborn.<locals>.<lambda>D  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   rC  K  r  r*   r  Fc              3  8   "   T F  q^ ,          R8H  x  K  	  R# 5ir  r0   r  s   & r(   r   ^test_open_session_falls_back_to_the_tree_copy_transport_when_head_is_unborn.<locals>.<genexpr>O  r  r  )r   r   r   r   r   r   r   )r   r   r   rE   r"   r  r   r<   r  r  r   )r-   r&   r  r   r  r   r   s   &&   @@r(   Ktest_open_session_falls_back_to_the_tree_copy_transport_when_head_is_unbornrG  5  s    l"DJJLNND$VZ[E;&IJ 6KL**	"9-$X.G u$$$??"""3..333......r*   c                    \        V 4      p\        R RVR7      P                  P                  4       p\        P
                  ! V4      V8X  g   Q hR# )r  HEADr   N)r   r   r   r
  r"   r9  )r-   r   heads   &  r(   6test_snapshot_commit_returns_head_unchanged_when_cleanrK  R  sB    XD{F-44::<D**40D888r*   c                   \        V 4      p\        R RVR7      P                  P                  4       pVR,          P	                  RRR7       \
        P                  ! V4      pW28w  g   Q h\        R RVR7      P                  P                  4       V8X  g   Q h\        RRV R	2VR7      P                  R8X  g   Q hVR,          P                  4       '       g   Q hR
# )r  rI  r   r  zx
r4   r5   zcat-filer   z:untracked.txtN)r   r   r   r
  r7   r"   r9  r  )r-   r   rJ  shas   &   r(   Atest_snapshot_commit_captures_untracked_files_without_moving_headrN  X  s    XD{F-44::<D	O'''@

)
)$
/C;;{F-44::<DDDz4C5!7TBIIURRR?"**,,,,r*   c                    V R ,          pVP                  4        \        P                  ! . ROVRR7       \        P                  ! V4      e   Q hR# )freshTr>  N)r   r   r   r   )r   r   r   r"   r9  r   s   & r(   4test_snapshot_commit_returns_none_for_an_unborn_headrQ  c  s=    gDJJLNN6DM**40888r*   c                6   \        V 4      pR p\        P                  ! \        P                  4      ;_uu_ 4       p\        P
                  ! WR7       RRR4       XP                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)u   A hung/timed-out local git call must surface as `OffloadUnavailable` (a nonzero exit
downstream) — never as a raw exception or a swallowed success.c                P    \         P                  ! WP                  R ^4      R7      h)r   )r  r   )r   TimeoutExpiredr   r   r   s   &,r(   timing_out_runZtest_a_transport_timeout_during_snapshot_fails_closed_not_silently.<locals>.timing_out_runo  s    ''D**YPQ:RSSr*   r  N)	r   r[   r\   r"   r]   r9  r_   r`   r  )r-   r   rV  rb   s   &   r(   Btest_a_transport_timeout_during_snapshot_fails_closed_not_silentlyrX  j  sg     XDT 
99	:	:h''A 
;>>/"="==== 
;	:s   BB	c                 <   \         P                  ! \        R 4      4      p V \         P                  ! \        R 4      4      8X  g   Q h\         P                  ! V 4      \         P                   RV  R28X  g   Q h\         P                  \         P
                  8w  g   Q hR# )z/home/user/repo/.gitr   r  N)r"   repo_keyr   remote_bare_dirREMOTE_GIT_BARE_ROOTREMOTE_GIT_COMMON_ROOT)keys    r(   ;test_repo_key_and_remote_bare_dir_are_stable_and_namespacedr_  w  s    

"
"4(>#?
@C/**40F+GHHHH**3/o6Z6Z5[[\]`\aae3ffff//?3Y3YYYYr*   c                     \         P                  ! R RRR/R4      R8X  g   Q h\         P                  ! R RRRRR/R4      R8X  g   Q hR	# )
r   rf   r   uz/a/b.gitzssh://u@h/a/b.gitr   r   zssh://u@h:2222/a/b.gitN)r"   bare_ssh_urlr0   r*   r(   -test_bare_ssh_url_includes_port_only_when_setrc  ~  sV    ''fc(BJOSffff$$fc63%MzZ#	$	$r*   c                 `    \         P                  ! \        R 4      RRR4      p V . RO8X  g   Q hR# )/repossh://u@h/a.gitdeadbeefrefs/cdx/x/inN)r   -Cre  r
  r   z--no-verifyrf  zdeadbeef:refs/cdx/x/in)r"   push_commit_argvr   r   s    r(   test_push_commit_argv_shaperk    s5    ++DM;LjZijD    r*   c                 X   \         P                  ! R R4      \         P                  ! R 4      8w  g   Q h\         P                  ! R R4      P                  \         P                  4      '       g   Q h\         P                  ! R 4      P                  \         P                  4      '       g   Q hR# )idd1N)r"   dispatch_ref
result_refr   PUSH_REF_PREFIXr0   r*   r(   5test_dispatch_and_result_refs_are_distinct_namespacesrr    s{    ''d37Q7QRV7WWWW''d3>>?^?^____%%d+667V7VWWWWr*   c                 F   \         P                  ! 4       \         P                  ! 4       rW8w  g   Q h\         P                  ! R V 4      \         P                  ! R V4      8w  g   Q hW3 F5  p\         P                  ! R V4      \         P                   RV R28X  d   K5  Q h	  R# )sboxz/sbox//inN)r"   new_dispatch_idro  rq  )rp   r   dispatch_ids      r(   ?test_dispatch_ref_is_unique_per_invocation_for_the_same_sandboxrx    s    **,o.M.M.Oq6M6''2o6R6RSY[\6]]]]v++FK@../vk]#F
 	
 
 r*   c           	       a	 \        V 4      o	. pV R ,          p\        V R,          V4      pVP                  \        RRV	3R ll4       \        P                  ! RRR.\        V4      \        V 4      VR R	7      pV Uu. uF,  qfR
,          R.8X  g   K  RVR,          9   g   K#  VR,          NK.  	  pp\        V4      ^8X  g   Q hR\        P                   RVP                   R2pW^ ,          9   g   Q hRV^ ,          9   g   Q hRV^ ,          9   g   Q hR\        P                   RVP                   R2V^ ,          9  g   Q hR# u upi )rg  r   r  Nc                   < S# r   r0   r'  s   &r(   rA   Ftest_open_session_fetches_the_exact_per_dispatch_ref.<locals>.<lambda>  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r{    r  r*   r  r   r   zcheckout -qf+r   z:refs/cdx/inz/in:refs/cdx/inz/in:r   r   )
r   r  rE   r"   r  r   r<   lenrq  r   )
r-   r&   r   r  r   r  r  checkout_scriptsexpectedr   s
   &&       @r(   4test_open_session_fetches_the_exact_per_dispatch_refr    sV   XDE;&I!(["8%@H6KL**	"9-$X.G !"% 0^qu5L"u    A%%%?2231W5G5G4HJH****-a0000 0 3333../q1C1C0DDIQabcQdddds   =EE"Ec           	     ~  a \        V 4      oV R ,          p\        V R,          4      pVP                  \        RRV3R ll4       \        P                  ! RRR.\        V4      \        V 4      VR R	7      pV R,          \        P                  ! \        P                  ! \        P                  ! S4      4      4      ,          pVP                  p\        P                   R
V 2pV R
\        ^4       RR R2pV R
\        \        P                  P                  4       4       RR R2p	\        RRSR7      P                  P!                  4       p
W3 F!  p\        RR\#        V4      V
 RV 2SR7       K#  	  \        P$                  ! S\#        V4      V\        P&                  ! VR4      \(        P*                  \,        P.                  R7      pVe   Q h\        R\#        V4      V R2SR7      P                  P1                  4        Uu0 uF  pVP3                  4       ^,          kK  	  ppW9  g   Q hW9   g   Q hR# u upi )rg  r   r  Nc                   < S# r   r0   r'  s   &r(   rA   Wtest_gc_dispatch_refs_deletes_only_stale_refs_never_the_in_flight_one.<locals>.<lambda>  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r    r  r*   r  r   -ru  r  rI  r   r
  r   :zkeep-mer   r   	ls-remote/*/inr    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)r   r  rE   r"   r  r   r<   r[  rZ  git_common_dirr   rq  inttimer   r   r
  r$   gc_dispatch_refsro  r   r   r   r   r:  r   )r-   r&   r  r   r  bare_dirrt  prefix	stale_ref	fresh_refrJ  refwarningr"  	remainingr   s   &&             @r(   Etest_gc_dispatch_refs_deletes_only_stale_refs_never_the_in_flight_oner    s   XD;&I!(["89H6KL**	"9-$X.G +%(G(G  !?!?!EF) H D//0$8F(!CF81XJc2I(!C 4 4 9 9 ;<=QxjLI{F-44::<D%FD#h-D63%dC & ..c(mT?#?#?i#PVXV`V`fpftftG ?? S]vhe4D$OVVaaccD 	

Qc   %%%!!!s    H:c           	        \        V 4      pV R ,          p\        RRR\        V4      V R7       Rp\        P                  ! 4       p\        P
                  ! W44      p\        P
                  ! VRR 24      p\        RRVR7      P                  P                  4       pWV3 F!  p\        R	R\        V4      V R
V 2VR7       K#  	  \        P                  ! V\        V4      W5\        P                  \        P                  R7      p	V	e   Q h\        R\        V4      RV R2VR7      P                  P                  4        U
u0 uF  p
V
P                  4       ^,          kK  	  pp
W[9   g   Q hWk9  g   Q hR# u up
i )zbare.gitr   r   z--barer   rt  z1-r  rI  r
  r  r  Nr  z	refs/cdx/r   cccccccccccccccccccccccccccccccc)r   r   r$   r"   rv  ro  r   r
  r  r   r   r   r   r:  r   )r-   r   r  rt  keep_idkeep_refold_refrJ  r  r  r"  r  s   &           r(   7test_gc_dispatch_refs_never_deletes_the_ref_just_pushedr    sW   XD*$HhH8<D--/G++D:H**42hZAG{F-44::<D"FD#h-D63%dC # ..c(mTG ?? S]ivU4KQUV]]hhjjD 	

Qj      ###s   ? E3c           
         \        V 4      pR  p\        P                  ! VRRR\        P                  RVR7      pVf   Q hRV9   g   Q hRV9  g   Q hRV9  g   Q hR# )	c                6    \         P                  ! V ^RRR7      # )r   r   connection refusedr   r  rU  s   &,r(   failing_runItest_gc_dispatch_refs_failure_is_a_non_fatal_warning.<locals>.failing_run  s    **42FZ[[r*   zssh://u@h/gone.gitrt  zrefs/cdx/sbox/x/indebian9)r   rk  r   Nr  r   )r   r"   r  r   r   )r-   r   r  r  s   &   r(   4test_gc_dispatch_refs_failure_is_a_non_fatal_warningr    sr    XD\ .."F,@JJ)G w...7"""r*   c           	       aa \        V 4      oV R ,          p\        V R,          4      oV3R lpVP                  \        RRV3R ll4       \        P                  ! RRR.\        V4      \        V 4      VR	 R
7      pVP                  RJ g   Q hVP                  f   Q hVP                  VP                  9   g   Q hRVP                  9  g   Q hR# )rg  r   c                v   < V R ,          R.8X  d"   RV 9   d   \         P                  ! V ^RRR7      # S! V 3/ VB # )r   r   r  r   could not resolve hostr   r  r6  s   &,r(   r   Rtest_open_session_still_succeeds_when_gc_cannot_reach_the_remote.<locals>.fake_run  sA    8''K4,?..tSLdeeT,V,,r*   r  Nc                   < S# r   r0   r'  s   &r(   rA   Rtest_open_session_still_succeeds_when_gc_cannot_reach_the_remote.<locals>.<lambda>  r)  r*   ri  rj  rz  c                    R # r  r0   r|   s   &r(   rA   r    r  r*   r  Tr  r   )
r   r  rE   r"   r  r   r<   r  r  rk  )r-   r&   r  r   r  r7  r   s   &&   @@r(   @test_open_session_still_succeeds_when_gc_cannot_reach_the_remoter    s    XD;&I&x+'=>M-
 6KL**	"9-$X.G t###*** 3 3333#7+>+>>>>r*   c                     \         P                  ! R RRR4      p RV 9   g   Q h\         P                   F  pRV 2V 9   d   K  Q h	  R# )sandbox/workspaces/x/home/n/cdx-offload/repos/k.gitrh  rg  zclean -qffdz-e N)r"   remote_checkout_scriptSYNC_EXCLUDES)scriptexcludeds     r(   9test_remote_checkout_script_scopes_clean_to_sync_excludesr    sR    33 A?T^F F"""#11XJ6))) 2r*   c                     \         P                  ! RRRR4      p \         P                  ! RRR4      pW3 F  pRV9   g   Q hRV9  d   K  Q h	  R# )	zA lock file in the worktree root is an untracked path `git add -A` in
remote_result_script would pick up and round-trip home as spurious state.r  r  rh  rg  refs/cdx/x/outz"$w/.git/cdx-offload.lock"z"$w/.cdx-offload.lock"N)r"   r  remote_result_script)checkoutresultr  s      r(   Etest_checkout_and_result_scripts_lock_inside_git_dir_not_the_worktreer  (  se     55 A?T^H 11 ACSF $+v555'v555 %r*   c                 H    \         P                  ! RRR4      p RV 9   g   Q hR# )zThe out ref points at the latest result, not at a history. A reused workspace whose
base moved makes the push a non-fast-forward, and a rejected push strands the run.r  r  r  z.git push -q --force "$b" "$sha:refs/cdx/x/out"N)r"   r  )r  s    r(   'test_result_push_forces_the_scratch_refr  6  s-     11 ACSF <vEEEr*   c                   V ^8  d   QhRR/# )r,   r   r   r0   )r1   s   "r(   r2   r2   ?  s       r*   c                f    \         P                  ! \         P                  ! \        4      R V R7      # )uQ   Every node reports the same lagging load average — placement must still spread.c                    R # )g      ?r0   r|   s   &r(   rA   %flat_load_selection.<locals>.<lambda>C  r  r*   ru   r   )r"   rw   re   THREE_REACHABLE)r   s   &r(   flat_load_selectionr  ?  s)    &&''8 r*   c                   \        ^4       Uu. uF  p\        V 4      NK  	  pp\        R V 4       4      . RO8X  g   Q h\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   Q hR# u upi )r   c              3  8   "   T F  w  rq1R ,          x  K  	  R# 5i)r   Nr0   )r   r   r~   rx   s   &   r(   r   Stest_selections_with_identical_probe_results_spread_across_hosts.<locals>.<genexpr>J  s     AD#84&v,,Dr  c              3  .   "   T F  w  rq3R Jx  K  	  R # 5ir   r0   )r   _hostr~   claims   &   r(   r   r  O  s     Cd%:UUD ds   FTN)r	   r   r   )ranger  sortedall)r)   _helds   &  r(   @test_selections_with_identical_probe_results_spread_across_hostsr  H  ss    =B1XFX 23XDFADAA F   
 3CdC333CdCCCCC Gs   A=c                    \        ^4       Uu. uF  p\        V 4      NK  	  ppV^,          w  r4pVP                  4        \        V 4      w  rdpVR,          VR,          8X  g   Q hR# u upi )r   r   N)r  r  release)r)   r  r  
freed_hostr~   r  r   rx   s   &       r(   ;test_a_released_claim_frees_its_host_for_the_next_selectionr  R  se    =B1XFX 23XDF!%aJ	MMO/0BCD6<:f----	 Gs   A'c               $    V ^8  d   QhRRRRRR/# )r,   r   r$   resultsr/   Noner0   )r1   s   "r(   r2   r2   Z  s!      S 3  r*   c                2   \         P                  ! 4        VP                  ^R7       \        \	        V 4      4      w  rEp\	        V4      \        \        P                  ! 4       4      ,          P                  VR,          RR7       VP                  ^R7       R# )   r   r   r4   r5   N)	randomseedwaitr  r   r$   r   getpidr7   )r   r  startholdr   r~   rx   s   &&&&   r(   _child_selectionr  Z  se    
KKM	JJrJ/V=D6	']S%%11$v,1QIIbIr*   c           
     p   \         P                  ! R4      pVR,          pVP                  4        VP                  ^4      VP                  ^4      rT\	        ^4       Uu. uF/  pVP                  \        \        V 4      \        V4      WE3R7      NK1  	  ppV F  pVP                  4        K  	  V F  pVP                  ^<R7       K  	  \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g!   Q V U	u. uF  qP                  NK  	  up	4       hVP                  4        U
u. uF  qP                  RR	7      NK  	  pp
\        V4      ^8X  g   Q h\        \!        V4      P#                  4       4      ^8:  g   Q h\        \%        V4      4      ^8  g   Q hR
# u upi u up	i u up
i )zQThe measured defect: seven simultaneous probes saw one idle node and all took it.spawnr  )targetr   r  c              3  >   "   T F  qP                   ^ 8H  x  K  	  R# 5i)r   N)exitcode)r   childs   & r(   r   Jtest_concurrent_dispatches_do_not_all_stack_on_one_host.<locals>.<genexpr>s  s     9u~~"s   FTr4   r5   N)multiprocessingget_contextr   Barrierr  Processr  r$   r  r  r  r  iterdirr   r~  maxr   rM  r(  )r)   r-   ctxr  r  r  r  childrenr  r  r;   chosens   &&          r(   7test_concurrent_dispatches_do_not_all_stack_on_one_hostr  b  su   

%
%g
.C"GMMO++a.#++a.4 q
 A	 	#()3w<E 	 	
     

2
 3993339999YPX;YPX1JJPX;YY9;B??;LM;L4nngn.;LFMv;!wv%%'(A---s6{q    <ZMs   5F)F.5F3c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r,   r'   r   r   r$   pidr  start_ticksr/   r0   )r1   s   "r(   r2   r2   z  s/      D  # C D r*   c                H    W R V R V R2,          pVP                  4        V# )__z__planted.claim)touch)r'   r   r  r  r;   s   &&&& r(   _plant_claimr  z  s+    r#b_EEDJJLKr*   c                  a \         P                  ! R.4      pVP                  4        \        V RVP                  R4      p\        V R\
        P                  ! 4       R4      pRRRRR	R/o\        P                  ! \        P                  ! \        4      V3R
 lV R7      w  rEpVR,          R8X  g   Q hVP                  4       '       d   Q hVP                  4       '       d   Q hR# )zJA crashed or killed dispatch must not leave its node looking busy forever.z	/bin/truer	   rU   	999999999r   g?r   g333333?r   c                $   < SV R ,          ,          # rn   r0   ro   s   &r(   rA   Ftest_a_claim_whose_pid_is_dead_is_reaped_and_ignored.<locals>.<lambda>  rs   r*   r  r   N)r   Popenr  r  r  r   r  r"   rw   re   r  r  )r)   gonecorpselive_pid_wrong_identityr   r~   rx   rq   s   &      @r(   4test_a_claim_whose_pid_is_dead_is_reaped_and_ignoredr    s    [M*DIIK,i3GF*Iryy{K #{CcBE+77''8(!D6 <9$$$}}&--/////r*   c           	        \        T R \        P                  ! 4       \        P                  ! \        P                  ! 4       4      ;'       g    R4      p\        V 4      w  r#pVR,          R 8w  g   Q hVP                  4       '       g   Q hR# )r	   rU   r   N)r  r   r  r"   _process_start_ticksr  r  )r)   miner   r~   rx   s   &    r(   1test_a_live_claim_is_counted_and_survives_reapingr    sk    
		,,RYY[9@@S	D 00BCD6<9$$$;;===r*   c                   a V R ,          pVP                  RRR7       RRRRRR	/o\        P                  ! \        P                  ! \        4      V3R
 lVR7      w  r#pVR,          R8X  g   Q hVe   Q hR# )znot-a-directoryr   r4   r5   r   g      "@r   g?r   g      @c                $   < SV R ,          ,          # rn   r0   ro   s   &r(   rA   Otest_claim_bookkeeping_failure_degrades_to_plain_least_loaded.<locals>.<lambda>  rs   r*   r  r   r   N)r7   r"   rw   re   r  )r-   unusabler   r~   r  rq   s   &    @r(   =test_claim_bookkeeping_failure_degrades_to_plain_least_loadedr    sz    ++HW-#{CcBE*66''8(D5
 <9$$$==r*   c                  a  S R ,          pR pVP                  \        RRV 3R ll4       \        P                  ! \        P                  4      ;_uu_ 4        \        P
                  ! RRR.\        S R,          4      \        S \        4      VR	 VR
7       RRR4       \        VP                  R4      4      . 8X  g   Q hR#   + '       g   i     L3; i)r   c                X    V ^ ,          R8X  d   ^M^ p\         P                  ! WRRR7      # )r   r  r   r  r   r  r  s   &, r(   r   Qtest_open_session_releases_the_claim_when_the_mirror_push_fails.<locals>.fake_run  s)    q'W$Q!**4B{SSr*   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Qtest_open_session_releases_the_claim_when_the_mirror_push_fails.<locals>.<lambda>  r  r*   ri  rj  rz  rg  c                    R # r  r0   r|   s   &r(   rA   r    r  r*   rn  r  r   ru   r   r  r   )rE   r"   r[   r\   r]   r  r   r<   r  r  r  )r-   r&   r   r   s   f&  r(   ?test_open_session_releases_the_claim_when_the_mirror_push_failsr    s     FT 6XY	99	:	:$$TN&x+'=>(?C	
 
; I&'2--- 
;	:s   ?CC	c           
       a  S R ,          pVP                  \        RRV 3R ll4       \        P                  ! RRR.\        S R,          4      \	        S \
        4      R R	 VR
7      p\        \        VP                  R4      4      4      ^8X  g   Q hVP                  4        \        VP                  R4      4      . 8X  g   Q hVP                  4        R# )r   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Jtest_session_release_frees_the_claim_at_the_end_of_a_run.<locals>.<lambda>  r  r*   ri  rj  rz  rg  c                6    \         P                  ! V ^ RRR7      # )r   r  r   r   r  r  s   &,r(   rA   r    s    z::!.r 
r*   c                    R # r  r0   r|   s   &r(   rA   r    r  r*   r  r  r   )
rE   r"   r  r   r<   r  r~  r  r  r  )r-   r&   r   r  s   f&  r(   8test_session_release_frees_the_claim_at_the_end_of_a_runr    s     F6XY**	"8k#9:$X?
 
G tFKK	*+,111OOI&'2---OOr*   c           	        a R  pVP                  \        RR	V3R ll4       VP                  \        RV3R l4       \        P                  ! RV\        V R,          4      \	        V 4      VR R7      # )
c                    R RP                  V 4      9   d   \        P                  ! V ^ RRR7      # \        P                  ! V ^ RRR7      # r  r  r  r   r   )r  r   r   rU  s   &,r(   r   "_workdir_session.<locals>.fake_run  sB    %$7..tQ?QZ\]]**42bIIr*   r  c                   < S# r   r0   r'  s   &r(   rA   "_workdir_session.<locals>.<lambda>  r)  r*   git_toplevelc                   < S# r   r0   r'  s   &r(   rA   r    s    Tr*   ri  rg  c                    R # r  r0   r|   s   &r(   rA   r    r  r*   r  r   )rE   r"   r  r   r<   )r-   r&   rp  r   r   s   &&&f r(   _workdir_sessionr#    se    J
 6KL9IJ''"8k#9:$X. r*   flagri  z--cdc           
     X   V R,          pVR,          P                  RR7       V R,          P                  R4       \        WRV\        VR,          4      R.V4      p\        P
                  ! V4       R	2pWeP                  9   g   Q h\        VR,          4      VP                  9  g   Q hR
# )zOA workstation path forwarded verbatim makes codex die with a bare `os error 2`.r   subTr  rg  {}rj  rz  z/subN)r   r7   r#  r$   r"   r   r   )r-   r&   r$  r)   r   r  r  s   &&&&   r(   Ctest_open_session_translates_the_workdir_flag_to_its_container_pathr(    s    
 fD	E\&''-c$,.?FG "55d;<DAH||###te|GLL000r*   c                   V R ,          pV R,          pVP                  RR7       VP                  4        V R,          P                  R4       \        P                  ! \        P
                  4      ;_uu_ 4       p\        WRR\        V4      R.V4       R	R	R	4       XP                  P                  \        P                  8X  g   Q hR
\        VP                  4      9   g   Q hR	#   + '       g   i     LY; i)r   	elsewhereTr  rg  r'  rj  ri  rz  Nzoutside the mirrored checkout)r   r7   r[   r\   r"   r]   r#  r$   r_   r`   r  )r-   r&   r)   r   outsiderb   s   &&&   r(   Atest_open_session_refuses_a_workdir_outside_the_mirrored_checkoutr,    s     fD$GJJtJMMO''-	99	:	:hs7|T0RTXY 
;>>/"="====*c(...AAAA 
;	:s   9C%%C5	c           
     6   V R,          pVP                  4        V R,          P                  R4       VP                  \        RR 4       \        P
                  ! \        P                  4      ;_uu_ 4       p\        P                  ! RRR\        V4      R	.\        V R,          4      \        V 4      R
7       RRR4       XP                  P                  \        P                  8X  g   Q hR\        VP                  4      9   g   Q hR#   + '       g   i     LY; i)zWWithout this guard a non-repo `-C` makes repo_root fall back to it and mirror it whole.looserg  r'  r   c                    R # r   r0   r   s   &r(   rA   Otest_open_session_refuses_a_workdir_that_is_not_in_a_checkout.<locals>.<lambda>  s    Tr*   ri  rj  ri  rz  )rn  r  Nznot inside a git checkout)r   r7   rE   r"   r[   r\   r]   r  r$   r   r<   r_   r`   r  )r-   r&   r)   r.  rb   s   &&&  r(   =test_open_session_refuses_a_workdir_that_is_not_in_a_checkoutr1    s     wE	KKM''-9IJ	99	:	:h$$T3u:t,&x+'=>(2		
 
; >>/"="====&#hnn*==== 
;	:s   6ADD	c                     \         P                  ! . RO4      R8X  g   Q h\         P                  ! . RO4      e   Q h\         P                  ! R R.4      e   Q hR# )rj  Nrz  )rj  ri  /az--cd=/bx)r   r   z/b)rj  rs  ri  r3  )r"   find_workdirr0   r*   r(   Mtest_find_workdir_takes_the_last_occurrence_and_stops_at_the_prompt_separatorr6    sP    ''(LMQ]]]]''(BCKKK''7???r*   c                     \         P                  ! RR/\        R4      R4      p \        \	        W R,          4      4      pRV9   g   Q hR# )zK`.tmpjail-work/work` is mode 000 by kernel requirement; rsync aborts on it.r   rf   re  r	  :r   NNN)r  r  )r"   r  r   r  zip)r   pairss     r(   3test_push_excludes_the_tmpjail_overlay_scratch_rootr:  !  s?    $$fc]DM5IDT8$%E)U222r*   c                    V P                  \        P                  R R7       \        P                  ! 4       R J g   Q hV P	                  \        P                  R4       \        P                  ! 4       RJ g   Q hR# )FraisingrQ   TN)delenvr"   NO_WORKSPACE_ENVno_workspace_requestedr!   rG   s   &r(   -test_no_workspace_requested_reads_the_env_varrA  (  s_    77G113u<<<77=113t;;;r*   c                    V R ,          p\         P                  ! V4      \         P                  ! V4      8w  g   Q h\         P                  ! V4      P                  \         P                  ! V4      4      '       g   Q hR# )r   N)r"   remote_scratch_dirr   r   r   s   & r(   ;test_remote_scratch_dir_never_collides_with_the_real_mirrorrD  /  s_    fD--d37U7UVZ7[[[[--d3>>?]?]^b?cddddr*   c           	       a a . oS R ,          pV3R lpVP                  \        P                  R4       VP                  \        RRV 3R ll4       \        P                  ! RRR.\        V4      \        S 4      VR	 R
7      pVP                  R8X  g   Q hVP                  RJ g   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       d   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       g   Q hVP                  \        P                  ! S R,          4      8X  g   Q hVP                  R8X  g   Q hVP                  e   Q hVP                  VR7      e   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  RM! R S 4       4      '       d   Q h\        P                  ! S R,          4      pVP                   V8X  g   Q hVP                  P#                  V4      '       g   Q hRV R2RP%                  VP&                  4      9   g   WTP&                  9   g   Q hR# R# )rg  c                   < SP                  V 4       R RP                  V 4      9   d   \        P                  ! V ^ RRR7      # \        P                  ! V ^ RRR7      # r  )r   r  r   r   r  s   &,r(   r   Btest_open_session_no_workspace_transfers_nothing.<locals>.fake_run9  sO    T%$7..tQ?QZ\]]**42bIIr*   rQ   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Btest_open_session_no_workspace_transfers_nothing.<locals>.<lambda>@  r  r*   ri  rj  zreply OKc                &    V R ,          R8X  d   R# R# r  r0   r|   s   &r(   rA   rI  G  r  r*   r  r	   Tc              3  L   "   T F  q;'       d    V^ ,          R9   x  K  	  R# 5ir   N)r  scpr0   r  s   & r(   r   Ctest_open_session_no_workspace_transfers_nothing.<locals>.<genexpr>K  #     A5a111!1115   $$Fc              3  J   "   T F  pR RP                  V4      9   x  K  	  R# 5ir  r  r  s   & r(   r   rN  L  r  r  r   r  c              3  L   "   T F  q;'       d    V^ ,          R9   x  K  	  R# 5irL  r0   r  s   & r(   r   rN  Q  rO  rP  z--id r  r   r0   )r!   r"   r?  rE   r  r   r<   rk  no_workspacer   r  rC  r  r  r  scratch_sandbox_idr   r   r  r   )r-   r&   r  r   r  
scratch_idr   s   f&    @r(   0test_open_session_no_workspace_transfers_nothingrV  5  s   E;&IJ 77=6XY**	"9-$X.@G 	)))4'''sA5AsssA5AAAAA38%83338%88888??o@@FARSSSS>>R&&&*222sA5AsssA5AAAAA !33Hv4EFJ+++??##J////:,a CHHW\\$::jLL>XXX>X:r*   c           
     @  a  VP                  \        P                  R 4       VP                  \        RRV 3R ll4       \        P
                  ! \        P                  4      ;_uu_ 4       p\        P                  ! RRR\        S 4      R.\        S R,          4      \        S 4      R	 R
7       RRR4       XP                  P                  \        P                  8X  g   Q h\        P                  \        VP                  4      9   g   Q hR#   + '       g   i     Lg; i)rQ   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Gtest_open_session_no_workspace_refuses_a_workdir_flag.<locals>.<lambda>\  r  r*   ri  rj  ri  rz  rg  c                    R # r  r0   r|   s   &r(   rA   rY  c  r  r*   r  r   )r!   r"   r?  rE   r[   r\   r]   r  r$   r   r<   r_   r`   r  r-   r&   rb   s   f& r(   5test_open_session_no_workspace_refuses_a_workdir_flagr\  Z  s    77=6XY	99	:	:h$$T3x=$/&x+'=>(2	
 
; >>/"="====++s8>>/BBBB 
;	:s   +ADD	c                  a  VP                  \        P                  R 4       VP                  \        RRV 3R ll4       \        P
                  ! \        P                  4      ;_uu_ 4       p\        P                  ! RRR.\        S R,          4      \        S R. /4      R	 R
7       RRR4       XP                  P                  \        P                  8X  g   Q hR#   + '       g   i     L=; i)rQ   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Ztest_open_session_no_workspace_still_fails_closed_with_no_reachable_host.<locals>.<lambda>k  r  r*   ri  rj  rz  rg  r   c                    R # r  r0   r|   s   &r(   rA   r_  r  r  r*   r  r   )r!   r"   r?  rE   r[   r\   r]   r  r   r<   r_   r`   ra   r[  s   f& r(   Htest_open_session_no_workspace_still_fails_closed_with_no_reachable_hostra  i  s    77=6XY	99	:	:h$$TN&x+'=>(GR=A	
 
; >>/">">>>> 
;	:s   +;CC+	c           	       a a VP                  \        P                  R R7       . oV3R lpVP                  \        RRV 3R ll4       \        P                  ! RRR.\        S R	,          4      \        S 4      VR
 R7      pVP                  R J g   Q h\        ;QJ d    R S 4       F  '       g   K   RM	  R M! R S 4       4      '       g   Q hR# )Fr<  c                  < SP                  V 4       V R ,          R.8X  d   \        P                  ! V ^ RRR7      # RRP                  V 4      9   d   \        P                  ! V ^ RRR7      # \        P                  ! V ^ RRR7      # r  r  r  s   &,r(   r   Ktest_open_session_normal_path_still_pushes_when_env_unset.<locals>.fake_run{  r  r*   r  Nc                   < SR ,          # r  r0   r  s   &r(   rA   Ktest_open_session_normal_path_still_pushes_when_env_unset.<locals>.<lambda>  r  r*   ri  rj  rz  rg  c                &    V R ,          R8X  d   R# R# r  r0   r|   s   &r(   rA   rf    r  r*   r  c              3  L   "   T F  q;'       d    V^ ,          R8H  x  K  	  R# 5ir  r0   r  s   & r(   r   Ltest_open_session_normal_path_still_pushes_when_env_unset.<locals>.<genexpr>  s!     4e$$QqTW_$erP  Tr   )	r>  r"   r?  rE   r  r   r<   rS  r   )r-   r&   r   r  r   s   f&  @r(   9test_open_session_normal_path_still_pushes_when_env_unsetrj  w  s    77GEJ 6XY**	"8k#9:$X.@G 5(((34e43334e44444r*   c                    \         P                  ! V R,          4      p\        P                  ! RV4      '       g   Q V4       hVP	                  R4      '       g   Q hR# )zsandbox-run enforces ^[a-z0-9][a-z0-9._-]{0,63}$; a capital letter in the
checkout directory name must fold, not kill the dispatch before it starts.	Botmasterz[a-z0-9][a-z0-9._-]{0,63}z
botmaster-N)r"   r   re	fullmatchr   )r-   sids   & r(   3test_sandbox_id_survives_an_uppercase_checkout_namerp    sK     
$
$X%;
<C<<4c::?C?:>>,''''r*   )builderr   r   )r   r,   r   r   )ri  r  )x
__future__r   r8   importlib.utilrQ  rm  r  r   r  r  r   syscollectionsr   pathlibr   r[   r;   insertr$   r   r   r   r"   r:   r  fixturer)   r<   rH   rN   rY   rc   rh   rk   ry   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r/  r@  r`  rd  rw  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r-  r2  r<  rG  rK  rN  rQ  rX  r_  rc  rk  rr  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r#  markparametrizer(  r,  r1  r6  r:  rA  rD  rV  r\  ra  rj  rp  )ns   0r(   <module>r|     s   "   	  	    
    3tH~--/77:; <  aI[?KDF#%A	!		
 I[?~VT6SY'Z[		
 I]?~VT6SY'Z[		
)B a  A fQCL[lO4~(1#'OP		
   4
5

5?+
?)%e
<3.@ s+#.		M
9 F? 1,!^H&:&(8"%J6<@
:7$>,"?C5N4*I67%XP8&*3Z3*V*<0/:9-9
>ZX
e6""J$0#"?2*6FD.!00,	
.*($ $01 11B>&@3<e"YJC?52(q*s   !I=
