+
    5mj                        R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIt^ RIt^ RIt^ RIt^ RIt]P                   P#                  ^ ]! ]
! ]4      P)                  4       P*                  ^,          4      4       ^ RIt^ RIHt ^ RIHtHtHtHtHtHtH t  ^ RI!H"t" Rt#R R lt$R	 R
 lt%R R lt&]PN                  R R l4       t(R R lt)R R lt*R R lt+R R lt,R R lt-R R lt.R R lt/R R lt0R R  lt1R! R" lt2R# R$ lt3R% R& lt4R' R( lt5R) R* lt6R+ R, lt7R- R. lt8R/ R0 lt9R1 R2 lt:R3 R4 lt;R5 R6 lt<R7 R8 lt=R9 R: lt> ! R; R<4      t?R= R> lt@R? R@ ltARA RB ltBRC RD ltCRE RF ltDRG RH ltERI RJ ltFRK RL ltGRM RN ltHRO RP ltIRQ RR ltJRS RT ltKRU RV ltLRW RX ltMRY RZ ltNR[ R\ ltOR] R^ ltPR_ R` ltQRa Rb ltRRc Rd ltSRe Rf ltTRg Rh ltURi Rj ltVRk Rl ltWRm Rn ltXRo Rp ltYRq Rr ltZRs Rt lt[Ru Rv lt\Rw Rx lt]Ry Rz lt@]P                  P                  RR{R|R}R~//3RRR/3.4      R R l4       t`R R ltaR R ltb]P                  P                  RRR.4      R R l4       tcR R ltdR R lteR R ltfR R ltgR R lthR R ltiR R ltj]P                  P                  R. RO4      R R l4       tkR R ltlR R ltmR R ltnR R lto]pR8X  d   ]q! ]o! 4       4      hR R ltrR R ltsR# )z;:"
ACCOUNT_REGISTRY_SHIM_ACTIVE=1 exec python3 "$0" "$@"
":)annotationsN)Path)AccountLockedError)Account
AccountRefAccountRegistryAccountRegistryKindAuthorityBindingAuthorityModeStagedAccount)pin_account_uuidc               (    V ^8  d   QhRRRRRRRR/# )   emailstrplan
account_idreturn )formats   "e/home/user/overdeck-private-tests/workstation-ai-broad/modules/systray/tests/test_account_registry.py__annotate__r   '   s(     
) 
)S 
) 
) 
) 
)    c                    R V RRVRV//p\         P                  ! \        P                  ! V4      P	                  R4      4      P                  R4      pVP                  R4      pRV R2# )	r   https://api.openai.com/authchatgpt_plan_typechatgpt_account_idutf-8ascii=header.
.signaturebase64urlsafe_b64encodejsondumpsencodedecoderstrip)r   r   r   payloadencodeds   &&&  r   make_auth_payloadr,   '   so    % *(
G &&tzz'':'A'A''JKRRSZ[GnnS!GWIZ((r   c               (    V ^8  d   QhRRRRRRRR/# )r   r   r   r   auth_claimsdict[str, object]r   r   )r   s   "r   r   r   4   s0     ) ))) #) 		)r   c                    R V R/ VCRV/C/p\         P                  ! \        P                  ! V4      P	                  R4      4      P                  R4      pVP                  R4      pRV R2# )r   r   r   r   r   r   r    r!   r"   )r   r   r.   r*   r+   s   &&&  r   make_auth_payload_with_claimsr1   4   sy     	% (
(
 *(
G &&tzz'':'A'A''JKRRSZ[GnnS!GWIZ((r   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r   pathr   r   r   r   r   r   Noner   )r   s   "r   r   r   E   s/      T # S c d r   c                    V P                   P                  R R R7       V P                  \        P                  ! RR\        WV4      //4      RR7       R# )T)parentsexist_oktokensid_tokenr   encodingN)parentmkdir
write_textr%   r&   r,   )r3   r   r   r   s   &&&&r   
write_authr?   E   sK    KKdT2OO

Hz+<U*+UVWX  r   c                    V ^8  d   QhRRRR/# r   tmp_pathr   r   r   r   )r   s   "r   r   r   N   s     
D 
Dt 
D 
Dr   c                    V R ,          pV R,          pVP                  4        \         F7  pW,          pRV9   d   VP                  VRR7       K'  VP                  4        K9  	  \        W!R7      # )legacytray.r   r:   base_dirlegacy_codex_home)r=   SHARED_FIXTURE_NAMESr>   r   )rB   rD   basenametargets   &    r   registryrN   M   s`     FfD
LLN$$;dW5LLN % DCCr   c                    V ^8  d   QhRRRR/# r   rN   r   r   r4   r   )r   s   "r   r   r   [   s     7 7/ 7^b 7r   c                
   V P                   p\        VR ,          RRR4       \        VR,          RRR4       \        VR,          RRR4       VR ,          P                  4       pV P                  4        V P                  4        V P	                  4       pV Uu. uF  qDP
                  NK  	  upR	R
.8X  g   Q hV P                  4       R	8X  g   Q hVR ,          P                  4       V8X  g   Q hV P                  R	,          R,          pVR,          P                  4       '       g   Q h\         FO  pWV,          pVP                  4       '       g   Q h\        P                  ! V4      \        W,          4      8X  d   KO  Q h	  R# u upi )zauth.roy.jsonroy@example.complusacct-royzauth.rafa.jsonrafa@example.compro	acct-rafa	auth.jsonrafaroy
CODEX_HOMEN)rI   r?   
read_bytesmigrate_legacylistslugdefault_slugaccounts_direxistsrJ   
is_symlinkosreadlinkr   )rN   rD   original_bytesaccountsaccount	rafa_homerL   links   &       r   ;test_migrate_legacy_is_additive_idempotent_and_sets_defaultrk   [   sM   ''Fv'):FJOv((*<e[Qv#%7L.::<N}}H(01WLL1fe_DDD  "f,,,_$002nDDD%%.=I#++----$    {{4 C$6666 % 2s   F c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   r   s     ' ''	'r   c                   \        V P                  R ,          RRR4       V P                  4        V P                  R4       \	        V P
                  V P                  R7      pVP                  4        VP                  4       . 8X  g   Q hR# )auth.avi.jsonavi@example.comrS   acct-aviavirG   N)r?   rI   r]   remover   rH   r^   )rN   fresh_registrys   & r   =test_removing_legacy_account_prevents_future_legacy_migrationrt   r   s~     ""_4	 OOE$"""44N !!# B&&&r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r      s     / //	/r   c                *   \        V P                  R ,          RRR4       V P                  4        V P                  R4       V P	                  RR4       \
        P                  ! V P                  P                  RR7      4      pVR,          . 8X  g   Q hR	# )
rn   ro   rS   rp   rq   Avir   r:   deleted_legacy_slugsN)	r?   rI   r]   rr   add_dirr%   loadsregistry_path	read_text)rN   states   & r   Ctest_explicitly_readding_a_deleted_legacy_slug_clears_its_tombstoner~      s     ""_4	 OOEUE"JJx--777IJE'(B...r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r      s     / //	/r   c                   \        V P                  R ,          RRR4       V P                  4        V P                  R4       V P	                  R4      p\        VP
                  R,          RRR4       VP                  4        \        P                  ! V P                  P                  RR7      4      pVR	,          . 8X  g   Q hR
# )rn   ro   rS   rp   rq   rw   rX   r   r:   rx   N)r?   rI   r]   rr   	stage_addaccount_homecommitr%   rz   r{   r|   )rN   stagedr}   s   &  r   :test_committing_a_deleted_legacy_slug_clears_its_tombstoner      s     ""_4	 OOE&Fv""[02CVZX
MMOJJx--777IJE'(B...r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r      s     <F <Fo <FZ^ <Fr   c                L   V P                   R ,          R,          pVP                  RR7       VR,          P                  RRR7       VR,          P                  R	RR7       VR
,          P                  RRR7       VR,          P                  RRR7       VR,          pVP                  4        VR,          P                  RRR7       VR,          P                  RRR7       V P                  R,          P                  RRR7       V P                  R,          P                  RRR7       V P                  R,          R,          pVP                  P                  4        VP                  RRR7       VR,          R,          pVP                  P                  4        VP                  RRR7       V P                  R,          R,          R,          R,          pVP                  P                  RR7       VP                  RRR7       VR,          R,          R,          R,          pVP                  P                  RR7       VP                  RRR7       V P                  V4       . \        ORNRNRNRNRNRN FY  pW,          pVP                  4       '       g   Q hVP                  4       V P                  V,          P                  4       8X  d   KY  Q h	  VR,          R,          P                  RR7      R8X  g   Q hV P                  R,          P                  RR7      P                  4       R R!.8X  g   Q hVR,          P                  RR7      R8X  g   Q hVR,          P                  4       '       d   Q hVR,          P                  RR7      R	8X  g   Q hVR,          P                  4       '       d   Q hVR
,          P                  RR7      R8X  g   Q hVR
,          P                  4       '       d   Q hVP                  RR7      R"8X  g   Q hVP                  RR7      R8X  g   Q hR## )$rZ   r[   Tr6   rX   zaccount-authr   r:   zauth.json.bakzaccount-backupzstate_5.sqlitez
account-dbzhistory.jsonlz1{"session_id":"account","ts":2,"text":"account"}
agentszreviewer.mdreviewerzfuture-state.jsonfuturez/{"session_id":"shared","ts":1,"text":"shared"}
z
hooks.jsonhookslogzcodex-login.logzshared-log
zaccount-log
z.tmppluginsz.git
FETCH_HEADzshared-cachezaccount-cachez.{"session_id":"shared","ts":1,"text":"shared"}z0{"session_id":"account","ts":2,"text":"account"}zshared-log
account-log
N)ra   r=   r>   rI   r<   sync_shared_linksrJ   rc   resolver|   
splitlines)	rN   
codex_homer   
shared_logaccount_logshared_cacheaccount_cacherL   shared_entrys	   &        r   7test_sync_shared_links_shares_every_noncredential_entryr      s   &&.=JT"+)).7)K/!--.>-Q""..|g.N/!--< .  ("F
LLNm''
W'E%%11(W1M/1==: >  ,.::7W:U++e36GGJ.7;u$'88K?W=--6BVKlZLd+NW=')3f<|KMt,_w?z*	 	 		
 	 	 	 "(&&((((##%(*D*Dt*K)T)T)VVVV !M1<<g<NR\\\\&&8CC D jl8:   $///A^SSS[(446666(33W3EIYYYY_,88::::))44g4F,VVV--99;;;;15PPPP!!7!3~EEEr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r      s     ! !!	!r   c                   V P                   R ,          R,          pV P                   R,          R,          p\        R4      p\        R4      p\        R4      pW3 FB  pVR,          V,          pVP                  P                  RR7       VP	                  R	R
R7       KD  	  VR,          V,          pVP	                  RR
R7       VR,          V,          p	V	P                  P                  RR7       V	P	                  RR
R7       V P                  4        V P                  4        W3 F  pVR,          P                  4       '       g   Q hVR,          P                  4       '       g   Q hVR,          V,          P                  R
R7      R	8X  g   Q hVR,          V,          P                  R
R7      R8X  g   Q hVR,          V,          P                  R
R7      R8X  d   K  Q h	  R# )rY   r[   rZ   z2026/07/02/rollout-shared.jsonlz2026/07/02/rollout-rafa.jsonlz2026/07/01/rollout-roy.jsonlsessionsTr   zshared
r   r:   rafa
archived_sessionsroy
N)ra   r   r<   r=   r>   sync_all_shared_linksrc   r|   )
rN   ri   roy_homeshared_sessionrafa_only_sessionroy_only_archiver   r3   	rafa_onlyroy_archives
   &         r   =test_sync_all_shared_links_merges_existing_conversation_stater      s    %%.=I$$u,|;H;<N<=:; +
J&7$'
W5 , J&)::IG4003CCKT*7W5""$""$ +
Z'33555500<<>>>>Z'.8CCWCU
 	
 
 Z'*;;FF G 
 	  003CCNN O 
 	  ,r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     > >>	>r   c                @   \        R 4      pV P                  R,          R,          R,          V,          pV P                  R,          R,          R,          V,          pVP                  P                  RR7       VP                  P                  RR7       VP	                  RRR	7       VP	                  R
RR	7       V P                  4       pW49   g   Q hV P                  R,          V,          pVP                  RR	7      R8X  g   Q hVP                  RR	7      R
8X  g   Q hR# )z!2026/07/02/rollout-conflict.jsonlrY   r[   r   rZ   Tr   r   r   r:   r   N)r   ra   r<   r=   r>   r   rI   r|   )rN   relative_pathrafa_sessionroy_session	conflicts	canonicals   &     r   >test_sync_all_shared_links_preserves_conflicting_session_filesr     s	    <=M((61L@:MP]]L''%/,>Km[Kd+T*Hw77W5..0I###**Z7-GI0H<<<  ' 2g===r   c               $    V ^8  d   QhRRRRRR/# )r   rN   r   capsyszpytest.CaptureFixture[str]r   r4   r   )r   s   "r   r   r   $  s)     M MM'AM	Mr   c           
     >   V P                  R R4      pVR,          P                  RRR7       V P                  4       pVP                  4       pV\	        \        RR 4      RVRRRR7      .8X  g   Q hV^ ,          P                  R	8X  g   Q hR
VP                  9   g   Q hR# )brokenBrokenrX   z	{not-jsonr   r:   codexNrefaliasr   r   r   r   zcodex:brokenz/failed to decode auth.json for account 'broken')ry   r>   r^   
readouterrr   r   tray_keyerr)rN   r   r   rg   captureds   &&   r   (test_list_keeps_undecodable_auth_entriesr   $  s     !!(H5J+))+)H}}H  "H7H-#	
	 	 	 	 A;>111<LLLr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   ;  s      	r   c                   V P                  R R4      pVR,          P                  \        P                  ! RR\	        RRRRR	R
/4      //4      RR7       V P                  4       \        \        RR 4      RVRR
RR7      .8X  g   Q hR# )rY   RafarX   r8   r9   rU   rW   r   profiler   rS   r   r:   r   r   N)ry   r>   r%   r&   r1   r^   r   r   rN   r   s   & r   =test_list_ignores_profile_account_type_and_uses_plan_fallbackr   ;  s     !!&&1J+))

 =*#/"F!		
  * $ ==?7F+#$"	
	 	 	 	r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   ]  s      o $ r   c                   V P                  R R4      pVP                  R4      P                  \        P                  ! RR\        RRR4      /RR	R
RR//4      RR7       V P                  4       \        R RVRRRR7      .8X  g   Q hR# )rY   r   rX   r8   r9   rU   rS   rW   rate_limitsprimary_reset_atz2026-07-01T12:00:00Zsecondary_reset_atz2026-07-07T00:00:00Zr   r:   )r_   r   r   r   r   r   N)ry   joinpathr>   r%   r&   r,   r^   r   r   s   & r   'test_list_ignores_unrelated_auth_fieldsr   ]  s    !!&&1J$//

:'89KVU`'ab&(>(*@ 	
  0  ==?!$"	
	 	 	 	r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   x  s      F FF	Fr   c                ^   V P                  R R4      pV P                  RR4      p\        VR,          RRR4       \        VR,          RRR	4       V P                  4       ^ ,          pV P                  V4       V P                  P                  R
R7      R8X  g   Q hV P                  R,          pVP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q hVR,          P                  4       '       g   Q hVR,          P                  RR
R7       VP                  R
R7      R8X  g   Q hV P                  V P                  4       ^,          4       VP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q hR# )rY   r   rZ   RoyrX   rU   rS   rW   rR   rT   r   r:   r   z{"rotated": true}N)ry   r?   r^   set_defaultdefault_pathr|   rI   rc   r   rb   r>   )rN   r   
other_homerh   courtesys   &    r   :test_set_default_writes_pointer_and_symlinks_courtesy_authr   x  s}    !!&&1J!!%/JzK');V[QzK'):FJOmmoa G!  **G*<HHH))K7H    *{":!C!C!EEEE$,,....+))*=)Pw/3FFFF+,    *{":!C!C!EEEEr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s      ? t r   c                &   V P                  R R4      p\        VR,          RRR4       V P                  R,          pVP                  4       '       d   Q hV P	                  V P                  4       ^ ,          4       VP                  4       '       g   Q hR# )rY   r   rX   rU   rS   rW   zratelimit-wakeN)ry   r?   rH   rb   r   r^   )rN   r   wakes   &  r   ,test_set_default_touches_ratelimit_wake_filer     ss    !!&&1JzK');V[Q//D{{}}+,;;===r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s      G GG	Gr   c                <   V P                  R R4      p\        VR,          RRR4       V P                  4       ^ ,          pV P                  V4       V P                  R,          pVP                  4       '       g   Q hV P                  R R4      RJ g   Q hV P                  R 4      RJ g   Q hVP                  4       '       d   Q hVP                  4       '       d   Q h\        P                  ! \        4      ;_uu_ 4        V P                  V4       RRR4       V P                  R R4      RJ g   Q hV P                  R 4      RJ g   Q hVP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q hR#   + '       g   i     L; i)	rY   r   rX   rU   rS   rW   TNF)ry   r?   r^   r   rI   rc   
set_locked	is_lockedrb   pytestraisesr   r   )rN   r   rh   	live_auths   &   r   Atest_locking_default_disconnects_live_auth_and_unlock_restores_itr     sg    !!&&1JzK');V[Qmmoa G!**[8I!!!!vt,444f%---!!!!##%%%%	)	*	*W% 
+ vu-555f%...!!!!:#;"D"D"FFFF 
+	*s   <FF	c               $    V ^8  d   QhRRRRRR/# r   rN   r   monkeypatchpytest.MonkeyPatchr   r4   r   )r   s   "r   r   r     s&     & &&#& 
&r   c                ^  a aa S P                  R R4      o\        SR,          RRR4       S P                  S P                  4       ^ ,          4       S P	                  R R4       S P
                  R,          oR VVV 3R llpVP                  S R	V4       \        P                  ! \        R
R7      ;_uu_ 4        S P	                  R R4       RRR4       S P                  R 4      RJ g   Q hSP                  4       '       d   Q hSP                  4       '       d   Q hR#   + '       g   i     LY; i)rY   r   rX   rU   rS   rW   Tc                    V ^8  d   QhRRRR/# )r   r_   
str | Noner   r4   r   )r   s   "r   r   \test_failed_unlock_relocks_and_removes_partially_activated_credentials.<locals>.__annotate__  s     0 0J 04 0r   c                ^   < V R 8X  g   Q hSP                  SR,          S4       \        R4      h)rY   rX   activation failed)_atomic_symlinkRuntimeError)r_   r   r   rN   s   &r   fail_after_activationetest_failed_unlock_relocks_and_removes_partially_activated_credentials.<locals>.fail_after_activation  s0    v~~  k!99E.//r   _sync_active_linksr   matchFN)ry   r?   r   r^   r   rI   setattrr   r   r   r   rb   rc   )rN   r   r   r   r   s   f& @@r   Ftest_failed_unlock_relocks_and_removes_partially_activated_credentialsr     s     !!&&1JzK');V[Q+,%**[8I0 0
 "68MN	|+>	?	?FE* 
@ f%---!!!!##%%%%% 
@	?s   8DD,	c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s      L LL	Lr   c                   V P                  R R4      p\        VR,          RRR4       V P                  V P                  4       ^ ,          4       V P                  R,          pVP                  4        VP                  RRR7       V P                  R R	4       VP                  4       '       d   Q hVR,          P                  RR7      R8X  g   Q h\        P                  ! VR,          P                  4       P                  4      R
8X  g   Q hR# )rY   r   rX   rU   rS   zacct-old{"rotated":true}r   r:   T  N)ry   r?   r   r^   rI   unlinkr>   r   rb   r|   statS_IMODEst_mode)rN   r   r   s   &  r   Dtest_locking_default_moves_vendor_replaced_live_auth_back_to_accountr     s     !!&&1JzK');VZP+,**[8I+g>%!!!!$///AEWWWW<<k1779AABeKKKr   c               $    V ^8  d   QhRRRRRR/# r   rB   r   r   r   r   r4   r   )r   s   "r   r   r     s)     J JJ!3J	Jr   c                  aaa V R ,          R,          oV R,          R,          oSP                   P                  4        SP                   P                  4        SP                  RRR7       SP                  RRR7       \        P                  oR VVV3R llpVP                  \        P                  R	V4       \        P                  ! SS4       SP                  4       '       d   Q hSP                  RR7      R8X  g   Q h\        P                  ! SP                  4       P                  4      R
8X  g   Q h\        SP                   P                  R4      4      . 8X  g   Q hR# )liverX   rh   r   r   r:   z{"old":true}c               $    V ^8  d   QhRRRRRR/# )r   sourcezstr | os.PathLike[str]rM   r   r4   r   )r   s   "r   r   Rtest_locked_credential_cleanup_falls_back_across_filesystems.<locals>.__annotate__  s$     % %/E %Oe %jn %r   c                   < \        V 4      S8X  d+   \        V4      S8X  d   \        \        P                  R 4      hS! W4       R# )zcross-device linkN)r   OSErrorerrnoEXDEV)r   rM   account_copyactivereal_replaces   &&r   replace_with_cross_device_oncedtest_locked_credential_cleanup_falls_back_across_filesystems.<locals>.replace_with_cross_device_once  s4    <6!d6ll&B%++':;;V$r   replacer   z.auth.json.lock-move-*N)r<   r=   r>   rd   r  r   account_registry_moduler   _deactivate_live_pathrb   r|   r   r   r   r^   glob)rB   r   r	  r  r  r  s   && @@@r   <test_locked_credential_cleanup_falls_back_across_filesystemsr    s$    ,Fi'+5L
MM
(7;NW=::L% %
 /22I?]^))&,?}}!!7!37IIII<<))+334===##(()ABCrIIIr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     2 22	2r   c                j   V P                  R R4      p\        VR,          RRR4       V P                  R R4       V P                  R R4      pVR8X  g   Q hV P	                  R 4      R	J g   Q hV P	                  R4      RJ g   Q hV P                  R4       V P                  4       \        4       8X  g   Q hR
# )workWorkrX   zwork@example.comrS   z	acct-workTzNight Accountznight-accountFN)ry   r?   r   renamer   rr   locked_slugs	frozenset)rN   r   renameds   &  r   9test_rename_and_remove_keep_account_lock_state_consistentr    s     !!&&1JzK');V[Q%oofo6Go%%%f%...o.$666OOO$  "ik111r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s$     ! !!,>!	!r   c           
       a a S P                  R 4      p\        V\        4      '       g   Q hVP                  R8X  g   Q hVP                  P
                  R8X  g   Q h\        VP                  R,          RRR4       S P                  oR VV 3R llpVP                  S R	V4       VP                  4       pV\        \        R
R4      R S P                  R,          R,          RRRR7      8X  g   Q hVP                  P                  4       '       g   Q hVP                  P                  4       '       d   Q hS P                  4       V.8X  g   Q h\         P"                  ! \$        RR7      ;_uu_ 4        VP                  4        RRR4       \         P"                  ! \$        RR7      ;_uu_ 4        VP'                  4        RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)z	Rafa Workz	rafa-workr[   rX   rU   rS   rW   c                    V ^8  d   QhRRRR/# )r   r*   zdict[str, list[dict[str, str]]]r   r4   r   )r   s   "r   r   \test_stage_add_commit_registers_account_without_exposing_partial_state.<locals>.__annotate__  s     ) )*I )d )r   c                F   < SP                  4       . 8X  g   Q hS! V 4       R # N)r^   )r*   original_write_registryrN   s   &r   verifying_write_registryhtest_stage_add_commit_registers_account_without_exposing_partial_state.<locals>.verifying_write_registry  s    }}"$$$(r   _write_registryr   r   staged account already closedr   N)r   
isinstancer   r_   r   rL   r?   r"  r   r   r   r   ra   rb   _staged_dirr^   r   r   r   rollback)rN   r   r   r   rh   r  s   f&   @r   Ftest_stage_add_commit_registers_account_without_exposing_partial_stater'    s    ,Ffm,,,,;;+%%%##|333v""[02DfkZ&66) ) "35MNmmoGgw,**[8<G     &&((((!!((****==?wi'''	|+J	K	K 
L	|+J	K	K 
L	K 
L	K	K	K	Ks   .G+GG	G*	c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   /  s     * *o *RV *r   c                x    V P                  R RR7      pVP                  R8X  g   Q hVP                  R 8X  g   Q hR# )zDisplay Namezmy-work)r_   N)r   r_   r   rN   r   s   & r   /test_stage_add_uses_explicit_slug_when_providedr+  /  s;    Y?F;;)###<<>)))r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   5  s      	r   c                :   V P                  R 4      p\        VP                  R,          RRR4       VP                  4        V P	                  4       . 8X  g   Q hVP                  P                  4       '       d   Q h\        P                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       \        P                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)
DisposablerX   ztemp@example.comrS   z	acct-tempr#  r   N)
r   r?   r   r&  r^   rb   r   r   r   r   r*  s   & r   ?test_stage_add_rollback_discards_directory_and_cannot_be_reusedr/  5  s     -Fv""[02DfkZ
OO==?b   ""))++++	|+J	K	K 
L	|+J	K	K 
L	K 
L	K	K	K	Ks   C6D	6D		D	c                    V ^8  d   QhRRRR/# r   rB   r   r   r4   r   )r   s   "r   r   r   E  s     '3 '3 '3RV '3r   c                8  aa V R ,          pV R,          pVP                  4        \         F7  pW,          pRV9   d   VP                  VRR7       K'  VP                  4        K9  	  \        W!R7      p\        W!R7      pVP	                  R4      pVP	                  R4      p\        VP                  R,          RR	R
4       \        VP                  R,          RRR4       \        P                  ! ^4      o. oR VV3R llp	\        P                  ! W3R7      p
\        P                  ! W3R7      pV
P                  4        VP                  4        V
P                  4        VP                  4        S UUu. uF  w  rVR8X  g   K  VNK  	  pppS UUu. uF  w  rVR8X  g   K  VNK  	  ppp\        V4      ^8X  g   Q h\        V4      ^8X  g   Q h\        V^ ,          \        4      '       g   Q hVP                  4       V^ ,          .8X  g   Q hR# u uppi u uppi )rD   rE   rF   r   r:   rG   r   rX   rR   rS   zacct-onerV   zacct-twoc                    V ^8  d   QhRRRR/# )r   r   r   r   r4   r   )r   s   "r   r   Ptest_stage_add_commit_rejects_concurrent_final_destination.<locals>.__annotate__Y  s     ) )} ) )r   c                   <  SP                  ^R7       SP                  RV P                  4       34       R#   \         d   pSP                  RT34        Rp?R# Rp?ii ; i)   )timeoutokr   N)waitappendr   BaseException)r   excbarrierresultss   & r   r   Jtest_stage_add_commit_rejects_concurrent_final_destination.<locals>.commitY  sP    	)LLL#NND&--/23 	)NNE3<((	)s   38 A!AA!)rM   argsr8  r   N)r=   rJ   r>   r   r   r?   r   	threadingBarrierThreadstartjoinlenr$  FileExistsErrorr^   )rB   rD   rK   rL   rM   first_registrysecond_registryfirst_stagedsecond_stagedr   first_threadsecond_threadkindvalue	successesfailuresr=  r>  s   &               @@r   :test_stage_add_commit_rejects_concurrent_final_destinationrR  E  s    FfD
LLN$$;dW5LLN % %dMN%tNO!++E2L#--e4M|((;68I6S]^}))K79JES]^"G(*G) ) ##6HL$$F9IJM*1B';4TT\'IB)0B+$DEMHBy>Qx=Ahqk?3333 Yq\N222 CBs   5HHH#Hc                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   o  s      O OY] Obf Or   c                   ^ RI Hp V R,          pV R,          pVP                  4        \        VV R,          VP                  VR7      pVP                  RR4      pVR,          P                  R	R
R7       VP                  4       ^ ,          pVP                  V4       VP                  VR,          8X  g   Q hVP                  VR,          8X  g   Q hVP                  VR,          8X  g   Q hWSR,          R,          R,          8X  g   Q hVP                  \        RR4      8X  g   Q hVP                  V8X  g   Q hVP                  R8X  g   Q hVR,          pVP!                  4       '       g   Q hVP#                  4       VR,          P#                  4       8X  g   Q hVR,          P                  RR
R7       VP%                  R
R7      R8X  g   Q hR# )    r   clauderE   r   rH   rI   rN  legacy_claude_homerY   r   .credentials.jsonz{"accessToken":"first"}r   r:   claude-accountszclaude_accounts.jsonclaude_default_slugCLAUDE_HOMEzclaude:rafaz{"accessToken":"rotated"}N)account_registryr   r=   r   CLAUDEry   r>   r^   r   ra   r{   r   r   r   r   r   rc   r   r|   )rB   r   rD   rK   rN   claude_homerh   r   s   &       r   Jtest_claude_registry_uses_separate_storage_default_and_credentials_symlinkra  o  s   4 FfD
LLN"W, ''!	H ""662K&&223LW^2_mmoa G!  D+<$<<<<!!T,B%BBBB  D+@$@@@@!22V;mKKKK;;*Xv6666;...},,,++H    +0C"C!L!L!NNNN&&223NY`2aw/3NNNNr   c                  2    ] tR tRtRR R lltR R ltRtR# )	_FakeTokenIdentityi  c                    V ^8  d   QhRRRR/# )r   
owner_uuidr   r   r4   r   )r   s   "r   r   _FakeTokenIdentity.__annotate__  s     & &: &$ &r   c                	    Wn         R # r  _owner_uuid)selfre  s   &&r   __init___FakeTokenIdentity.__init__  s    %r   c                    V ^8  d   QhRRRR/# )r   _credentials_pathr   r   r   r   )r   s   "r   r   rf    s        $  :  r   c                	    V P                   # r  rh  )rj  rn  s   &&r   account_uuid_for#_FakeTokenIdentity.account_uuid_for  s    r   rh  Nshared-uuid)__name__
__module____qualname____firstlineno__rk  rp  __static_attributes__r   r   r   rc  rc    s    &   r   rc  c                    V ^8  d   QhRRRR/# rA   r   )r   s   "r   r   r     s      t  r   c                    V R ,          pVP                  4        \        V R,          V R,          \        P                  VR7      # )rW  rE   r   rX  r=   r   r   r_  )rB   rD   s   & r   _claude_registryr|    s>     F
LLNF""W, ''!	 r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s&     ; ;;#; 
;r   c                *   \        V 4      pVP                  R R4      pVP                  RR4      p\        VR4       \        VR4       VP                  R,          pVP	                  RRR	7       VP                  \        R
R RR7       VP                  4        VR,          P                  RR	7      R8X  g   Q h\        P                  ! VR,          P                  4       P                  4      R8X  g   Q hVR,          P                  4       '       d   Q hR# )zyncZyncotherOtherrs  zsome-other-uuidrZ  r   r   r:   ClaudeTokenIdentityc                     \        R 4      # rr  rc  r   r   r   <lambda>\test_preserve_live_claude_grant_writes_only_to_the_pinned_matching_account.<locals>.<lambda>  
    "=1r   Fraisingr   N)r|  ry   r   rY  r>   r   r  _preserve_live_claude_grantr|   r   r   r   rb   )rB   r   rN   	zync_homer   r   s   &&    r   Jtest_preserve_live_claude_grant_writes_only_to_the_pinned_matching_accountr    s     )H  0I!!'73JY.Z!23&&)<<DOO&O91	   ((*++666HL^^^^<<%88>>@HHIURRR0088:::::r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s&     > >>#> 
>r   c                   \        V 4      pVP                  R R4      pVR,          P                  \        P                  ! RRR//4      RR7       VP
                  R,          pVP                  R	RR7       VP                  \        R
R RR7       VP                  4        VR,          P                  4       '       d   Q hR# )poisonedPoisoned.claude.jsonoauthAccountaccountUuidrs  r   r:   rZ  r   r  c                     \        R 4      # rr  r  r   r   r   r  ktest_preserve_live_claude_grant_skips_an_account_with_a_poisoned_but_unpinned_claude_json.<locals>.<lambda>  r  r   Fr  N)
r|  ry   r>   r%   r&   rY  r   r  r  rb   )rB   r   rN   poisoned_homer   s   &&   r   Ytest_preserve_live_claude_grant_skips_an_account_with_a_poisoned_but_unpinned_claude_jsonr    s      )H$$Z<M^#//

N]M$BCD 0 
 &&)<<DOO&O91	   ((* 33;;=====r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s)     D DD!3D	Dr   c                L  a  VP                  \        P                  R V 3R l4       \        P                  ! \        P                  P
                  R7      pVP                  S R,          8X  g   Q hVP                  S R,          8X  g   Q hVP                  S R,          8X  g   Q hR# )homec                    < S # r  r   )rB   s   r   r  Rtest_claude_registry_resolves_default_home_paths_at_construction.<locals>.<lambda>  s    hr   )rN  z%.local/state/overdeck/systray/runtime.clauder  N)	r   r  r   r   r   r_  rH   rY  active_claude_json)rB   r   rN   s   f& r   @test_claude_registry_resolves_default_home_paths_at_constructionr    s     /44f>NO&66$88??H +R RRRR&&(Y*>>>>&&(^*CCCCr   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s      D DD	Dr   c                    V R ,          p\         P                  ! V R,          \         P                  P                  VR7      pVP                  V R,          8X  g   Q hR# )r  rE   )rH   rN  rY  r  N)r  r   r   r_  r  )rB   r`  rN   s   &  r   Btest_claude_registry_derives_metadata_path_from_custom_claude_homer    sS     Y&K&66F"$88??&H &&(^*CCCCr   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     # #VZ #_c #r   c                   ^ RI Hp V R,          pV R,          pV R,          pVP                  4        VP                  4        VR,          P                  RRR7       V R	,          pVP                  R
RR7       \	        VVVP
                  VVR7      pVP                  4        VP                  4        VP                  4       pV Uu. uF  qP                  NK  	  upR.8X  g   Q hVP                  4       R8X  g   Q hVR,          R,          R,          p	V	R,          P                  RR7      R8X  g   Q hV	R,          P                  RR7      R
8X  g   Q hR# u upi )rU  rV  rW  r   rE   rZ  z{"accessToken":"legacy"}r   r:   r  zX{"oauthAccount":{"emailAddress":"legacy@example.com","organizationRateLimitTier":"max"}}rH   rI   rN  rY  r  rD   r[  r]  claude.jsonN)r^  r   r=   r>   r   r_  r]   r^   r_   r`   r|   )
rB   r   rY  rI   rK   r  rN   rg   rh   r`  s
   &         r   Gtest_claude_migrate_legacy_imports_current_credentials_and_sets_defaultr    se   4!H, 7*fD--99" :  "N2!!b "  + ''--H }}H(01WLL1hZ???  "h...**X5EK--88'8JNhhhh-'22G2Db  	 2s   Ec                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     $= $=$=	$=r   c                   ^ RI Hp V R,          pV R,          pV R,          pV R,          pVP                  4        VP                  4        VR,          P                  RRR	7       VP                  R
RR	7       \	        VVVP
                  VVR7      pVP                  RR4      pVR,          P                  RRR	7       VP                  4        VP                  4        Uu. uF  qP                  NK  	  upR.8X  g   Q hVP                  4       R8X  g   Q hVR,          R,          P                  4       '       d   Q hR# u upi )rU  rV  rW  r   r  rE   rZ  z{"accessToken":"live-other"}r   r:   z5{"oauthAccount":{"emailAddress":"other@example.com"}}r  rq   rw   {"accessToken":"avi"}r[  r  N)r^  r   r=   r>   r   r_  ry   r]   r^   r_   r`   rb   )	rB   r   rY  rI   r  rK   rN   r`  rh   s	   &        r   Gtest_claude_migrate_legacy_does_not_import_phantom_when_registry_existsr    sL    5!H, 7*!N2fD--99& :  !!? "  + ''--H ""5%0K&&22 3 
 (08WLL8UGCCC  "e+++((72::<<<<< 9s    D>c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   B  s     > >T >VZ >r   c                   ^ RI Hp V R,          pV R,          pV R,          pVP                  4        VP                  4        \        VVVP                  VV R,          R7      pVP                  RR4      pVP                  R	R
4      pVR,          P                  RRR7       VR,          P                  RRR7       VP                  4       pV U	u. uF  qP                  NK  	  up	R.8X  g   Q hR# u up	i )rU  rV  rW  r   rE   r  r  r   LivephantomPhantomrZ  z@{"claudeAiOauth":{"accessToken":"live-token","refreshToken":""}}r   r:   6{"claudeAiOauth":{"accessToken":"","refreshToken":""}}N)	r^  r   r=   r   r_  ry   r>   r^   r_   )
rB   r   rY  rI   rK   rN   	live_homephantom_homerg   rh   s
   &         r   >test_claude_list_hides_registry_entries_with_empty_credentialsr  B  s    4!H, 7*fD+ ''-#n4H   0I##Iy9L$$00J 1  ''33@ 4 
 }}H(01WLL1fX===1s   C0c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   a  s      	r   c                   ^ RI Hp V R,          pV R,          pVP                  4        VP                  4        \        V R,          VVP                  VV R,          R7      pVP                  RR4      pVR	,          P                  R
RR7       VR,          P                  RRR7       VP                  4       pV Uu. uF  qwP                  VP                  3NK  	  upR.8X  g   Q hR# u upi )rU  rV  rW  r   rE   r  r  
logged-outz
Logged outrZ  r  r   r:   account_identity.jsonz){"email":"user@example.com","plan":"max"}N)r  zuser@example.com)
r^  r   r=   r   r_  ry   r>   r^   r_   r   )rB   r   rY  rI   rN   r   rg   rh   s   &       r   Btest_claude_list_keeps_identified_account_with_cleared_credentialsr  a  s     5!H, 7*F"+ ''-#n4H ##L,?L''33@ 4  ++773 8 
 }}H9ABg\\7==)B*G   Bs   ; C(c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     . ..	.r   c                    ^ RI Hp V R,          pV R,          pV R,          pVR,          R,          R,          pVP                  4        VP                  4        VP                  RR	7       VR
,          P                  RRR7       VR
,          P	                  VR
,          4       \        VVVP                  VV R,          R7      pVP                  4        VP                  4       . 8X  g   Q hVP                  P                  4       '       d   Q hR# )rU  rV  rW  r   rE   r[  rq   r]  Tr   rZ  r  r   r:   r  r  N)r^  r   r=   r>   
symlink_tor   r_  r]   r^   r   rb   )rB   r   rY  rI   rK   managed_homerN   s   &      r   Btest_claude_migrate_legacy_skips_live_symlink_into_managed_storager    s     5!H, 7*fD++e3mCLt$''334KV]3^--99,I\:\]+ ''-#n4H ==?b   $$++-----r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s      T d r   c                   ^ RI Hp V R,          pV R,          pV R,          pV R,          pVP                  4        VP                  4        \        VVVP                  VVR7      pVP                  RR4      pVR	,          P                  R
RR7       VR,          P                  RRR7       VP                  VP                  4       ^ ,          4       VP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q h\        P                  ! VP                  RR7      4      RRR/RR/8X  g   Q hR# )rU  rV  rW  r   r  rE   r  rq   rw   rZ  r  r   r:   z3{"oauthAccount":{"emailAddress":"avi@example.com"}}r  emailAddressro   hasCompletedOnboardingTNr^  r   r=   r   r_  ry   r>   r   r^   rc   r   r%   rz   r|   rB   r   rY  rI   r  rK   rN   r`  s   &       r   6test_claude_set_default_links_dot_claude_json_metadatar    sI   4!H, 7*!N2fD+ ''--H ""5%0K&&223JU\2]>!--= . 
 +,((****%%'K.,H+Q+Q+SSSS::(22G2DE):; $J   r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     # # #QU #r   c                   ^ RI Hp V R,          pV R,          pV R,          pV R,          pVP                  4        VP                  4        \        VVVP                  VVR7      pVP                  RR4      pVR	,          P                  R
RR7       VR,          P                  RRR7       VR,          P                  RRR7       VP                  VP                  4       ^ ,          4       VP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q h\        P                  ! VP                  RR7      4      RRR/RR/ /RR/8X  g   Q hR# )rU  rV  rW  r   r  rE   r  rq   rw   rZ  r  r   r:   z.{"firstStartTime":"now","migrationVersion":13}r  zK{"oauthAccount":{"emailAddress":"avi@example.com"},"projects":{"/repo":{}}}r  r  ro   projectsz/repor  TNr  r  s   &       r   9test_claude_set_default_ignores_generated_dot_config_stubr    sr   4!H, 7*!N2fD+ ''--H ""5%0K&&223JU\2]>!--8 .  = ,,U - 
 +,((****%%'K-,G+P+P+RRRR::(22G2DE):;WbM $J   r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     0 0PT 0Y] 0r   c                   ^ RI Hp V R,          pV R,          pV R,          pVP                  4        VP                  4        \        VVVP                  VR7      pVP                  RR4      pVR,          P                  \        P                  ! R	R
RRRR/4      RR7       VR,          P                  \        P                  ! RRRRRRR//4      RR7       VP                  4       \        \        RR4      RVR
RRR7      .8X  g   Q hR# )rU  rV  rW  r   rE   rX  rY   r   r  r   zpreferred@example.comorg_idzorg-preferredsubscription_typemaxr   r:   r  r  r  zlegacy@example.comr  zlegacy-accountorganizationRateLimitTierzlegacy-planr   N)r^  r   r=   r   r_  ry   r>   r%   r&   r^   r   r   )rB   r   rY  rI   rK   rN   r`  s   &      r   Atest_claude_list_prefers_account_identity_over_legacy_claude_jsonr    s5   4!H, 7*fD+ ''-	H ""662K**66

0/#U	
  7 	 = ,,

"$8!#3/!	
  -  ==?8V,$)&	
	 	 	 	r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     1 11	1r   c                ,   V P                  R R4      p\        VR,          RRR4       V P                  V P                  4       ^ ,          4       V P	                  R R4      R8X  g   Q hV P                  4       ^ ,          pVP
                  VP                  3R
8X  g   Q hV P                  R,          R,          R,          P                  4       '       g   Q hV P                  R ,          P                  4       '       d   Q hV P                  4       R8X  g   Q hR	# )rZ   r   rX   rR   rS   rT   Roy Workroy-workr[   N)r  r  )ry   r?   r   r^   r  r_   r   ra   is_filerb   r`   )rN   r   rh   s   &  r   7test_rename_moves_the_account_directory_to_the_new_slugr    s     !!%/JzK'):FJO+,??5*-;;;mmoa GLL'--(,DDDD!!J.=KTTVVVV%%-557777  "j000r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   (  s     4 44	4r   c                    V P                  R R4       V P                  R R4      R 8X  g   Q hV P                  R ,          P                  4       '       g   Q hR# )rZ   r   ROYN)ry   r  ra   is_dirrN   s   &r   :test_rename_keeps_the_slug_when_the_label_still_derives_itr  (  sM     UE"??5%(E111!!E)113333r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   1  s     : : :TX :r   c                *   V P                  R R4       V P                  RR4       V P                  P                  \        P                  ! R RR/RRR//4      RR7       V P
                  f   Q hV P
                  P                  \        P                  ! R	R
RR /RRR//RR RRR ./4      RR7       V P                  R R4       \        P                  ! V P                  P                  RR7      4      p\        V4      RR08X  g   Q h\        P                  ! V P
                  P                  RR7      4      pVR	,          R
,          R,          R8X  g   Q hVR	,          R,          R,          R8X  g   Q hVR,          R8X  g   Q hVR,          RR.8X  g   Q hR# )rZ   r   rq   rw   statusr8  r   r:   Nr  r  rh   r  defaultfallback_chainr  r  )
ry   health_cache_pathr>   r%   r&   routing_rules_pathr  rz   r|   set)rN   healthruless   &  r   1test_rename_rekeys_health_cache_and_routing_rulesr  1  s   UE"UE"))

EHd+UXt4DEFQX *  &&222**

Vi%79eBTU5 5%.	
  + 	 OOE:&ZZ22<<g<NOFv;:u----JJx22<<g<NOEV$Y/:===W%i0E999z)))!"uj&9999r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   N  s     P Po P$ Pr   c                   V P                  R R4       V P                  RR4       V P                  f   Q hV P                  P                  \        P                  ! R/ RR RR R^(/RR	^///4      R
R7       V P                  R R4       \        P                  ! V P                  P                  R
R7      4      pVR,          RR^(/RR	^//8X  g   Q hR# )rZ   r   rq   rw   Nr  r  account_caps7d5hr   r:   r  r  )ry   r  r>   r%   r&   r  rz   r|   )rN   r  s   & r   test_rename_rekeys_account_capsr  N  s    UE"UE"&&222**

B5r
ED": F	
  + 	 OOE:&JJx22<<g<NOE Z$UT2J$OOOOr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   c  s     8 8_ 8 8r   c                   V P                  R R4       V P                  RR4      p\        VR,          RRR4       V P                  f   Q hV P                  P                  \        P
                  ! R	/ R
RRR R^(/RR^///4      RR7       V P                  R 4       \        P                  ! V P                  P                  RR7      4      pVR,          RR^//8X  g   Q hR# )rZ   r   rq   rw   rX   ro   rS   rp   Nr  r  r  r  r  r   r:   )	ry   r?   r  r>   r%   r&   rr   rz   r|   )rN   avi_homer  s   &  r   test_remove_drops_account_capsr  c  s    UE"u-Hx+%'8&*M&&222**

B5r
ED": F	
  + 	 OOEJJx22<<g<NOE UT2J$7777r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r   y  s     4 4 4SW 4r   c                   V P                  R R4       V P                  R,          P                  4        \        P                  ! \
        RR7      ;_uu_ 4        V P                  R R4       RRR4       V P                  4       ^ ,          P                  R 8X  g   Q hV P                  R ,          P                  4       '       g   Q hR#   + '       g   i     Lc; i)rZ   r   r  z*account directory already in use: roy-workr   r  N)
ry   ra   r=   r   r   rG  r  r^   r_   r  r  s   &r   0test_rename_rejects_a_slug_already_taken_on_diskr  y  s    UE"Z'..0	.Z	[	[z* 
\ ==?1""e+++!!E)113333	 
\	[s   CC	c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     
* 
*
*	
*r   c                   V P                  R R4       \        P                  ! \        RR7      ;_uu_ 4        V P                  RR4       RRR4       \        P                  ! \        RR7      ;_uu_ 4        V P	                  R4       RRR4       \        P                  ! \
        R	R7      ;_uu_ 4        V P                  R R
4       RRR4       R#   + '       g   i     L; i  + '       g   i     Ld; i  + '       g   i     R# ; i)rZ   Personalz account name already in use: ROYr   r  r  Nz%account name already in use: personalpersonalzreserved account name: DynamicDynamic)ry   r   r   rG  r   
ValueErrorr  r  s   &r   Etest_account_names_are_unique_across_slugs_aliases_and_reserved_namesr    s     UJ'	.P	Q	Q' 
R	.U	V	V:& 
W	z)I	J	Jy) 
K	J	 
R	Q	V	V	J	J	Js#   C6C$4C7C!	$C4	7D	c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     ' ''	'r   c                   V P                  R R4       V P                  RR4       V P                  R R4       \        P                  ! \        RR7      ;_uu_ 4        V P                  R R4       RRR4       R#   + '       g   i     R# ; i)rZ   r  r  Officer  z!account name already in use: workr   N)ry   r  r   r   rG  r  s   &r   <test_rename_rejects_another_account_slug_but_allows_own_slugr     sb     UJ'VX&OOE5!	.Q	R	Rv& 
S	R	R	Rs   A88B		c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     = ==	=r   c                   R F-  pV P                   V,          R,          P                  RR7       K/  	  V P                  RRR RR/RRRR	/./4       V P                  R 4      R 8X  g   Q hV P                  R
4      R 8X  g   Q hV P                  R4      R8X  g   Q hV P                  R4      e   Q hV P                  R4      e   Q hR# )rZ   r  r[   Tr   rg   r_   r   r  r   z
 personal r  dynamicNmissing)rZ   r  )ra   r=   r"  resolve_profile_token)rN   r_   s   & r   Ctest_resolve_profile_token_prefers_exact_slug_then_casefolded_aliasr    s      				%	4;;D;I  4%0	
 ))%0E999)),75@@@))%0F:::)))4<<<)))4<<<r   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     
D 
Do 
DRV 
Dr   c                2   V P                  R R4       V P                  R4      R 8X  g   Q hV P                  R R4       V P                  R4      e   Q hV P                  R 4      e   Q hV P                  R4      R8X  g   Q hV P                  R4      R8X  g   Q hR# )rq   rw   zRoy HomeNzroy-home)ry   r  r  r  s   &r   /test_resolve_follows_the_slug_a_rename_producedr	    s    UE"))%0E999OOE:&))%0888))%0888))*5CCC))*5CCCr   c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     ! !!	!r   c                   V P                  R R4      pV P                  RR4      p\        VR,          RRR4       \        VR,          RR	R
4       V P                  V P                  4       ^ ,          4       V P	                  R 4       V P
                  R,          pV P                  4        Uu. uF  qDP                  NK  	  upR.8X  g   Q hV P                  4       R8X  g   Q hV P                  P                  RR7      R8X  g   Q hVP                  4       '       g   Q hVP                  4       VR,          P                  4       8X  g   Q hV P	                  R4       V P                  4       . 8X  g   Q hV P                  4       e   Q hV P                  P                  4       '       d   Q hVP                  4       '       d   Q hR# u upi )rY   r   rZ   r   rX   rU   rS   rW   rR   rV   rT   r   r:   r   N)ry   r?   r   r^   rr   rI   r_   r`   r   r|   rc   r   rb   )rN   ri   r   r   rh   s   &    r   Ftest_remove_reassigns_default_and_clears_active_links_on_final_removalr    s      0Iu-Hy;&(:FKPx+%'8%L+,OOF))K7H(08WLL8UGCCC  "e+++  **G*<GGG    (["8!A!A!CCCCOOE==?b     "***$$++----      9s   +G c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s)     !R !R!R,>!R	!Rr   c                  a aa S P                  R R4      pS P                  RR4      p\        VR,          RRR4       \        VR,          RR	R
4       S P                  S P                  4       ^ ,          4       \        P
                  P                  oRoR VVV 3R llpVP                  \        P
                  R\        V4      4       \        P                  ! \        RR7      ;_uu_ 4        S P                  R 4       RRR4       S P                  R,          pS P                  4        Uu. uF  qfP                  NK  	  upR R.8X  g   Q hS P                  4       R 8X  g   Q hVP!                  4       '       g   Q hVP#                  4       VR,          P#                  4       8X  g   Q hS P$                  R ,          R,          R,          P'                  4       '       g   Q hR#   + '       g   i     L; iu upi )rY   r   rZ   r   rX   rU   rS   rW   rR   rV   rT   Fc               $    V ^8  d   QhRRRRRR/# )r   r3   r   contentr   r   r4   r   )r   s   "r   r   Utest_remove_restores_quarantined_account_when_state_write_fails.<locals>.__annotate__  s!     " "$ " " "r   c                h   < S! W4       V SP                   8X  d   S'       g   R o\        R4      hR# R# )TboomN)r{   r  )r3   r  failedoriginal_atomic_write_textrN   s   &&r   fail_registry_write\test_remove_restores_quarantined_account_when_state_write_fails.<locals>.fail_registry_write  s2    "418)))&F&/! 39)r   _atomic_write_textr  r   Nr[   )ry   r?   r   r^   r  r   r  r   staticmethodr   r   r  rr   rI   r_   r`   rc   r   ra   rb   )	rN   r   ri   r   r  r   rh   r  r  s	   f&     @@r   ?test_remove_restores_quarantined_account_when_state_write_failsr    s      0Iu-Hy;&(:FKPx+%'8%L+,!8!H!H![![F" " //() 
wf	-	- 
. ))K7H(08WLL8VUOKKK  "f,,,    )k"9!B!B!DDDD!!F*\9KGOOQQQQ 
.	- 9s   -G ,G3 G0	c                    V ^8  d   QhRRRR/# rP   r   )r   s   "r   r   r     s     - -? -t -r   c                    V P                  R R4       \        P                  ! \        4      ;_uu_ 4        V P                  R R4       RRR4       R#   + '       g   i     R# ; i)rZ   r   z	Roy AgainN)ry   r   r   rG  r  s   &r   ,test_add_dir_raises_when_slug_already_existsr    s@    UE"		'	', 
(	'	'	's   AA#	c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s$     !/ !/!/!3!/	!/r   c                  a R RR. R^ /o ! V3R lR4      pVP                  \        RV4       V R,          pV R,          pVP                  4        \        P                  ! WCR	7      pVP                  R
,          R,          pVP                  RR7       VP                  V4       VP                  4        SR ,          W5P                  38X  g   Q hSR,          V.8X  g   Q hSR,          ^8X  g   Q hR# )initNr   r   c                  N   < ] tR tRtR V 3R lltR V 3R lltR V 3R lltRtR	# )
zPtest_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexStatei  c               $    V ^8  d   QhRRRRRR/# )r   rI   r   ra   r   r4   r   )r   s   "r   r   ]test_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexState.__annotate__  s!     	> 	>d 	>$ 	>4 	>r   c                	   < W3SR &   R# )r   Nr   )rj  rI   ra   callss   &&&r   rk  Ytest_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexState.__init__  s    .=E&Mr   c                    V ^8  d   QhRRRR/# )r   r   r   r   r4   r   )r   s   "r   r   r#    s     	< 	<$ 	<4 	<r   c                	8   < SR ,          P                  V4       R# )r   Nr:  )rj  r   r%  s   &&r   r   btest_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexState.sync_shared_links  s    %&--l;r   c                   V ^8  d   QhRR/# )r   r   r4   r   )r   s   "r   r   r#    s     	0 	04 	0r   c                	2   < SR ;;,          ^,          uu&   R# )r   Nr   )rj  r%  s   &r   r   ftest_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexState.sync_all_shared_links  s    )*a/*r   r   N)rt  ru  rv  rw  rk  r   r   rx  )r%  s   r   FakeSharedCodexStatePtest_account_registry_delegates_shared_codex_state.<locals>.FakeSharedCodexState  s!    	> 	>	< 	<	0 	0r   r.  SharedCodexStaterD   rE   rG   rZ   r[   Tr   )r   r  r=   r   ra   r   r   )rB   r   r.  rD   rK   rN   r   r%  s   &&     @r   2test_account_registry_delegates_shared_codex_stater1    s     	R E0 0 /1CEYZ FfD
LLN&66_H((50<?Lt$|,""$=V%:%:;;;;$%,777()Q...r   c                    V ^8  d   QhRRRR/# )r   r   r   r   r4   r   )r   s   "r   r   r   '  s      K K#K	Kr   c                  a \        \        4      p\        P                  P	                  R V4      pVf   Q hVP
                  f   Q h\        P                  P                  V4      pV\        P                  VP                  &   VP
                  P                  V4       / oR V3R llpV P                  VP                  RV4       VP                  4       ^ 8X  g   Q hSR,          RR.8X  g   Q hR# )test_account_registry_shimNc                    V ^8  d   QhRRRR/# )r   r@  z	list[str]r   intr   )r   s   "r   r   Itest_shell_shim_delegates_to_account_registry_suite.<locals>.__annotate__4  s      y S r   c                   < V SR &   ^ # )r@  r   )r@  pytest_calls   &r   fake_pytest_mainMtest_shell_shim_delegates_to_account_registry_suite.<locals>.fake_pytest_main4  s    "Fr   mainr@  tests/test_account_registry.py-v)r   __file__	importlibutilspec_from_file_locationloadermodule_from_specsysmodulesrL   exec_moduler   r   r<  )r   	shim_pathspecmoduler:  r9  s   &    @r   3test_shell_shim_delegates_to_account_registry_suiterK  '  s     XI>>112NPYZD;;"""^^,,T2F#CKK		KKF#%'K  v/?@;;=Av#CT"JJJJr   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   >  s     1 1$ 14 1r   c           	     z   \         P                  P                  R 4      R8X  d   \        P                  ! R4       \        \        4      P                  4       P                  P                  pVR,          R,          p\         P                  P                  4       p\        \        P                  4      P                   \         P                   VP                  RR4       2VR&   \        V 4      VR&   \        P                  ! R\        V4      .VR	R	R
VR7      pVP                   ^ 8X  g   Q VP"                  4       hR# )ACCOUNT_REGISTRY_SHIM_ACTIVE1z@shell shim subprocess test must not recurse under shim executiontestsztest_account_registry.pyPATH TMPDIRshTF)cwdcapture_outputtextcheckenvN)rd   environgetr   skipr   r?  r   r<   copyrE  
executablepathsepr   
subprocessrun
returncodestderr)rB   	repo_rootrH  rY  results   &    r   +test_shell_shim_runs_when_invoked_via_shellrf  >  s    	zz~~45<VWX&&(//66IG#&@@I **//
C#..)001"**cggfb>Q=RSCKMCM^^	s9~F !06==0!r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   V  s     =% =%=%	=%r   c                   ^ RI Hp V R,          pV R,          pV R,          pV R,          pVP                  4        VP                  4        VP                  \        P
                  ! RRR/R	R
RRRRRRRRRRR^/4      RR7       \        VVVP                  VVR7      pVP                  R4      pVP                  R,          P                  RRR7       VP                  R,          P                  \        P
                  ! RRR/RR/4      RR7       VP                  4        \        P                  ! VR,          R,          R,          R,          P                  RR7      4      pVR,          RJ g   Q hVR,          RJ g   Q hVR,          ^8X  g   Q hVR,          RR/8X  g   Q hVR,          R8X  g   Q hR	V9  g   Q hRV9  g   Q hR # )!rU  rV  rW  r   r  rE   r  r  zactive@example.comuserIDzactive-user-id	machineIDzactive-machine-idr  TlastOnboardingVersionz2.1.211'officialMarketplaceAutoInstallAttempted officialMarketplaceAutoInstalledmigrationVersionr   r:   r  r   rZ  z{"accessToken":"rafa"}rU   firstStartTime2026-07-16T00:00:00Zr[  rY   r]  N)r^  r   r=   r>   r%   r&   r   r_  r   r   r   rz   r|   )	rB   r   rY  rI   r  rK   rN   r   seededs	   &        r   Atest_claude_commit_seeds_first_run_flags_without_leaking_identityrr  V  s    5!H, 7*!N2fD!!

1E F*0($'942D"B		
  "  + ''--H 'F..:: 7 ;  >)55

1C D "8	
  6  MMOZZ	!	!F	*]	:^	KVV 	W 	
F
 *+t333;<DDD$%+++.!n6H%IIII"#'====6!!!f$$$r   c                    V ^8  d   QhRRRR/# rA   r   )r   s   "r   r   r     s      t  r   c                    V R ,          pV R,          pVP                  RR7       VP                  RR7       \        V R,          V\        P                  VV R,          R7      # )rW  r   T)r7   rE   r  r  r{  )rB   rY  rI   s   &  r   r|  r|    sf    !H, 7*d+T*F"+ ''-#n4 r   r  r  r  za@example.comr  ro  rp  c               (    V ^8  d   QhRRRRRRRR/# )	r   rB   r   metadata_namer   metadatar/   r   r4   r   )r   s   "r   r   r     s0     4 444  4 
	4r   c                   \        V 4      pVP                  P                  \        P                  ! R R/4      RR7       V R,          pVP                  4        WA,          pVP                  \        P                  ! V4      RR7       VP                  V4       \        P                  ! VP                  RR7      4      R,          RJ g   Q hVR8X  d   RMRpWF,          P                  4       '       d   Q hR# )	rm  Tr   r:   rh   r  r  r  N)
r|  r  r>   r%   r&   r=   _seed_first_run_flagsrz   r|   rb   )rB   rv  rw  rN   r   rM   
other_names   &&&    r   3test_seed_first_run_flags_targets_resolved_metadatar{    s      )H**

6=> +  i'L)F
djj*W=""<0::f&&&89 	   #0>"A~J)1133333r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s      	r   c                t   \        V 4      pVP                  P                  R RR7       V R,          pVP                  4        VR,          pVP                  \        P
                  ! RRRR/4      RR7       VP                  V4       \        P                  ! VP                  RR7      4      RR	RR/8X  g   Q hR
# ){}r   r:   rh   r  r  Fidentity	preservedTN)	r|  r  r>   r=   r%   r&   ry  rz   r|   )rB   rN   r   rM   s   &   r   @test_seed_first_run_flags_forces_false_to_true_with_empty_sourcer    s      )H**4'*Bi'LM)F


,eZMN  
 ""<0::f&&&89 $K>   r   c               $    V ^8  d   QhRRRRRR/# r   r   )r   s   "r   r   r     s&      # 
r   c                T  a \        V 4      pVP                  P                  R RR7       V R,          pVP                  4        VR,          pVP                  \        P
                  ! RR/4      RR7       . oVP                  VRV3R l4       VP                  V4       S. 8X  g   Q hR	# )
r~  r   r:   rh   r  r  Tr  c                (   < SP                  W34      # r  r)  )r3   rW  writess   &&r   r  9test_seed_first_run_flags_is_idempotent.<locals>.<lambda>  s    6==$6r   N)r|  r  r>   r=   r%   r&   r   ry  )rB   r   rN   r   rM   r  s   &&   @r   'test_seed_first_run_flags_is_idempotentr    s      )H**4'*Bi'LM)F


,d34   &(F6 ""<0R<<r   	malformednot-jsonz[]c               $    V ^8  d   QhRRRRRR/# )r   rB   r   r  r   r   r4   r   )r   s   "r   r   r     s&     ; ;;; 
;r   c                   \        V 4      pVP                  P                  R RR7       V R,          pVP                  4        VR,          pVP                  VRR7       VP	                  V4       VP                  RR7      V8X  g   Q hR# )r~  r   r:   rh   r  N)r|  r  r>   r=   ry  r|   )rB   r  rN   r   rM   s   &&   r   =test_seed_first_run_flags_does_not_overwrite_malformed_targetr    s    
  )H**4'*Bi'LM)F
i'2""<0W-:::r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s      d t r   c                ,   \        V 4      pVP                  P                  R RR7       VP                  R4      pVP                  R,          P                  R RR7       VP                  R,          pVP                  R RR7       VP                  4       pVP                  R,          pVP                  \        P                  ! RR/4      RR7       VP                  V4       \        P                  ! VP                  RR7      4      R,          RJ g   Q hR	# )
r~  r   r:   stalerZ  r  r  FTN)r|  r  r>   r   r   r   r%   r&   r   rz   r|   )rB   rN   r   rM   rh   s   &    r   7test_set_default_seeds_preexisting_stale_claude_accountr    s    )H**4'*B(F..::4':R  =0F
dW-mmoG!!M1F


,e45  
 !::f&&&89 	  r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s     < < <QU <r   c                   \        V 4      pVP                  P                  R RR7       VP                  R4      pVP                  R,          P                  R RR7       VP                  R,          P                  R RR7       VP                  4       pVP                  R,          P                  RRR7       VP                  R,          pVP                  R4       VP                  V4       \        VP                  R	,          P                  R
4      4      p\        V4      ^8X  g   Q hV^ ,          P                  4       R8X  g   Q hR# )r~  r   r:   r  rZ  r  r  settings.jsons   {"hooks": ["x"]}
backupssettings.json.*N)r|  r  r>   r   r   r   rY  write_bytesr   r^   r  rF  r\   )rB   rN   r   rh   settingsr  s   &     r   9test_set_default_backs_up_settings_even_when_seed_skippedr    s     )H**4'*B,F..::4':R=(44TG4LmmoGM)55j75S**_<H./!H//);AABSTUGw<11:  "&;;;;r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   ,  s     - -T -d -r   c                l   \        V 4      pVP                  R ,          pRpVP                  V4       VP                  4        \	        VP                  R,          P                  R4      4      p\        V4      ^8X  g   Q hV^ ,          P                  4       V8X  g   Q hVP                  4       V8X  g   Q hR# )r  s   {"hooks": [""]}
 r  r  N)r|  rY  r  _backup_claude_settingsr^   r  rF  r\   )rB   rN   r  originalr  s   &    r   6test_backup_claude_settings_preserves_bytes_and_sourcer  ,  s    )H**_<H+H"$$&H//);AABSTUGw<11:  "h... H,,,r   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   :  s     B Bt B Br   c                    \        V 4      pVP                  4        VP                  R ,          P                  4       '       d   Q hR# )r  N)r|  r  rY  rb   )rB   rN   s   & r   0test_backup_claude_settings_missing_file_is_noopr  :  s;    )H$$&++i7??AAAAAr   c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r   B  s     / /d /t /r   c                   \        V 4      pVP                  R ,          pVP                  R4       VP                  R,          pVP                  4        \	        ^4       F6  pVRV R2,          P                  \        V4      P                  4       4       K8  	  VP                  4        \        VP                  R4      4      p\        V4      ^8X  g   Q hVR,          P                  4       '       d   Q hVP                  4       R8X  g   Q hR# )r  s   currentr  zsettings.json.20260718T00000z.000000Zr  z%settings.json.20260718T000000.000000ZN)r|  rY  r  r=   ranger   r'   r  sortedr  rF  rb   r\   )rB   rN   r  backups_dirindexr  s   &     r   /test_backup_claude_settings_retains_newest_fiver  B  s    )H**_<H$--	9Kq	5eWHE	ERRJ	
 
 $$&[%%&789Gw<1EEMMOOOO J...r   c               $    V ^8  d   QhRRRRRR/# r   rN   r   rB   r   r   r4   r   )r   s   "r   r   r   U  s$      )-	r   c                0   V P                  R R4      p\        VR,          RRR4       \        \        P                  RRRVR	,          P                  4       R
7      pV P                  R V4      pVP                  V8X  g   Q hV P                  4       ^ ,          P                  V8X  g   Q h\        P                  ! V P                  P                  RR7      4      pVR,          ^ ,          R,          VP                  4       8X  g   Q hR\        P                  ! V4      P                  4       9  g   Q hV P                  R R4      pVP                  e   Q hR\        P                  ! V P                  P                  RR7      4      R,          ^ ,          9  g   Q hR# )darkDarkrX   dark@example.comrS   	acct-darkworkstationroute-fixturer   	grant.keymodeauthority_nameroute_idproviderproxy_grant_refr   r:   rg   authority_bindingtokenN)ry   r?   r	   r
   SUBROUTER_DARKr   set_authority_bindingr  r^   r%   rz   r{   r|   as_dictr&   lower)rN   rB   r   bindingbound	persistednatives   &&     r   <test_authority_binding_round_trips_and_native_remains_absentr  U  sm    ##FF3L|k)+=v{S))$ !K/88:G **67;E""g---==?1//7:::

811;;W;MNIZ #$78GOO<MMMM$**Y/557777++FD9F##+++djj(('(:'''   r   c               $    V ^8  d   QhRRRRRR/# r  r   )r   s   "r   r   r   r  s$     < <<)-<	<r   c                    V P                  R R4      p\        VR,          RRR4       VR,          pVP                  RRR	7       \        \        P
                  R
RRVP                  4       R7      pV P                  R V4       V P                  R R4      pV P                  4       ^ ,          P                  V8X  g   Q hV P                  4       ^ ,          P                  V8X  g   Q hV P                  V4       VP                  RR	7      R8X  g   Q hR# )r  r  rX   r  rS   r  r  	syntheticr   r:   r  r  r   r  RenamedN)ry   r?   r>   r	   r
   r  r   r  r  r^   r_   r  rr   r|   )rN   rB   r   grantr  r  s   &&    r   Ftest_authority_binding_survives_rekey_and_removal_does_not_touch_grantr  r  s     ##FF3L|k)+=v{S{"E	[73))$ G ""673oofi0G==?1""g---==?1//7:::OOG??G?,;;;r   r  c               $    V ^8  d   QhRRRRRR/# )r   r  r   rB   r   r   r4   r   )r   s   "r   r   r     s$     

 



!

	

r   c           
         \         P                  ! \        R R7      ;_uu_ 4        \        \        P
                  RV RVR,          P                  4       R7       RRR4       R#   + '       g   i     R# ; i)zroute identifierr   r  r   r  r  N)r   r   r  r	   r
   r  r   )r  rB   s   &&r   2test_authority_binding_rejects_ambiguous_route_idsr    sP     
z);	<	<--(%3<<>	
 
=	<	<	<s   4A##A4	c               $    V ^8  d   QhRRRRRR/# r  r   )r   s   "r   r   r     s$     : ::)-:	:r   c                6   V P                  R R4       \        \        P                  RRRVR,          P	                  4       R7      p\
        P                  ! \        RR7      ;_uu_ 4        V P                  R V4       R	R	R	4       R	#   + '       g   i     R	# ; i)
r  Nativer  r  r   r  r  z	must omitr   N)	ry   r	   r
   NATIVEr   r   r   r  r  )rN   rB   r  s   && r   +test_registry_rejects_inline_native_bindingr    ss     Xx(!!$ !K/88:G 
z	5	5&&x9 
6	5	5	5s   *BB	c                    V ^8  d   QhRRRR/# r1  r   )r   s   "r   r   r     s      	r   c                   R RRRRV R,          P                  4       /p\        RR\        P                  RR/VB \        RR\        P                  RR	/VB 3 FQ  p\
        P                  ! \        4      ;_uu_ 4        \        \        RR
4      RV R,          RRRVR7       RRR4       KS  	  R#   + '       g   i     Kh  ; i)r  r  r  r  r  r  r  r  r   rW  fixtureFixturer[   N)r   r   r   r   r   r   r  r   )
r   r	   r
   r  r  r   r   r  r   r   )rB   rK   r  s   &  r   Btest_account_construction_rejects_native_or_cross_provider_bindingr    s     	-OH{2;;=D 	Mm22MWMMVm::VXVQUV ]]:&&w	2%4") '&	 '&&s   =$B//C c               $    V ^8  d   QhRRRRRR/# r  r   )r   s   "r   r   r     s$      )-	r   c                   V P                  R R4       RRRRRRRR	R
\        VR,          P                  4       4      /pV P                  P	                  \
        P                  ! RRR RRRV/./4      RR7       \        P                  ! \        RR7      ;_uu_ 4        V P                  4        RRR4       RVR&   RVR&   V P                  P	                  \
        P                  ! RRR RRRV/./4      RR7       \        P                  ! \        RR7      ;_uu_ 4        V P                  4        RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r  r  zsubrouter-darkr  r  r  r  r  rW  r  r  rg   r_   r   r  r   r:   r   Nr   r  refresh_tokenzunknown or missing)ry   r   r   r{   r>   r%   r&   r   r   r  r^   )rN   rB   r*   s   && r   Ctest_authority_binding_rejects_inline_secrets_and_provider_mismatchr    s9    VV$ -OH3; 6??ABG %%

J&&'6CVX_!` abc & 
 
z	4	4 
5 "GJ*GO%%

J&&'6CVX_!` abc & 
 
z)=	>	> 
?	> 
5	4 
?	>	>s   D7E
7E	
E	c                   V ^8  d   QhRR/# )r   r   r6  r   )r   s   "r   r   r     s     A Ac Ar   c                 2    \         P                  ! R R.4      # )r=  r>  )r   r<  r   r   r   r<  r<    s    ;;8$?@@r   __main__c               $    V ^8  d   QhRRRRRR/# r  r   )r   s   "r   r   r     s$     0 00)-0	0r   c                "   V P                  R R4       RRRRRRRR	R
\        VR,          P                  4       4      /pV P                  P	                  \
        P                  ! RRR RRRV/.R. /4      RR7       V P                  4       ^ ,          pVP                  f   Q hVP                  P                  RJ g   Q h\        \        P                  RRR	VR,          P                  4       RR7      pV P                  R V4       \
        P                  ! V P                  P                  RR7      4      pVR,          ^ ,          R,          R,          RJ g   Q h\!        VR,          ^ ,          R,          4      pRVR&   WeR,          ^ ,          R&   V P                  P	                  \
        P                  ! V4      RR7       \"        P$                  ! \&        RR7      ;_uu_ 4        V P                  4        RRR4       R#   + '       g   i     R# ; i)zfixture-quiescezFixture Quiescer  	subrouterr  r  r  r  r  r   r  r  rg   r_   r   r  rx   r   r:   NFT)r  r  r  r  r  quiescedr  yesr   )ry   r   r   r{   r>   r%   r&   r^   r  r  r	   r
   	SUBROUTERr  rz   r|   dictr   r   r  )rN   rB   rD   rh   r  r  bads   &&     r   Mtest_authority_binding_quiesced_is_additive_and_legacy_payload_defaults_falser    s    &(9:-OG3; 6??ABF %%

 1!2+V '		
  &   mmoa G$$000$$--666$$$ !K/88:H ""#4h?

811;;W;MNIZ #$78DLLL
y$Q'(;<
=CC
O47j!01%%djj&;g%N	z	4	4 
5	4	4	4s   "G==H	c               (    V ^8  d   QhRRRRRRRR/# )	r   rN   r   rB   r   r   r   r   r4   r   )r   s   "r   r   r     s,     1 11)-1<N1	1r   c                   V P                  R R4       VR,          P                  4       p\        \        P                  RRRVR7      pV P                  R V4       VP                  V RR 4       V P                  R 4      V8X  g   Q h\        P                  ! \        4      ;_uu_ 4        V P                  R	4       R
R
R
4       R
#   + '       g   i     R
# ; i)zfixture-binding-onlyzFixture Binding Onlyr  r  routefixture1234567890r   r  _read_account_metadatac                 .    \         P                  ! R 4      # )z+binding lookup read native account metadata)r   fail)_args_kwargss   *,r   r  Ytest_authority_binding_for_is_metadata_only_and_never_reads_native_auth.<locals>.<lambda>)  s    &++.["\r   absentN)ry   r   r	   r
   r  r  r   authority_binding_forr   r   KeyError)rN   rB   r   r  r  s   &&&  r   Gtest_authority_binding_for_is_metadata_only_and_never_reads_native_authr    s     +-CD#,,.E$$$)G ""#97C \ ))*@AWLLL	x	 	 &&x0 
!	 	 	 s   (CC	)zconfig.tomlskillscommands)rv  rw  )rF   z..z../adminz
route/namezroute%2fname)t__doc__
__future__r   importlib.utilr@  r#   r  r%   rd   pathlibr   r`  r   rE  rA  r   r3   insertr   r?  r   r6   r^  r  account_lockr   r   r   r   r   r	   r
   r   claude_credentialsr   rJ   r,   r1   r?   r  rN   rk   rt   r~   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r'  r+  r/  rR  ra  rc  r|  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r	  r  r  r  r1  rK  rf  rr  markparametrizer{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r<  rt  
SystemExitr  r  r   r   r   <module>r     s   #     	    
   3tH~--/77:; < 2 +   0 = 
))" 
D 
D7.',/$/(<F~!H>&M.D6F2G2&2L"J42$!H* '3TOD   ;6>4DD#L$=N>>B.8B#L0f1 4::P*8,4
*'=*
D!4!RH-!/HK.10=%@ !	.>?*KLM	)+ABC440*2 z4&89; :; *<*-B/&:<0 %Z[

 \

: 0<A z
TV
0f1r   