From 727aee0f843f034cf2f7348d38f9c14a2f22ac90 Mon Sep 17 00:00:00 2001 From: goodboy Date: Thu, 25 Jun 2026 17:37:29 -0400 Subject: [PATCH] Use `.aid` fields over deprecated `.uid` in core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `tractor`'s own `Channel.uid`/`Actor.uid` now warn + redirect to the `.aid: msg.Aid` struct, yet the runtime kept calling the deprecated tuple property internally — tripping its own `DeprecationWarning` across many tests. Swap each internal `.uid` for the behavior-preserving `(x.aid.name, x.aid.uuid)` (and `.uid[0]` -> `.aid.name`) so the emitted value / log output stays byte-identical, just sourced from the non-deprecated struct. Touches `msg._ops`, `_streaming`, `_exceptions`, `devx.debug._sync`, `experimental._pubsub`. (this patch was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- tractor/_exceptions.py | 2 +- tractor/_streaming.py | 6 +++--- tractor/devx/debug/_sync.py | 4 ++-- tractor/experimental/_pubsub.py | 2 +- tractor/msg/_ops.py | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tractor/_exceptions.py b/tractor/_exceptions.py index 3b087184..a4007bff 100644 --- a/tractor/_exceptions.py +++ b/tractor/_exceptions.py @@ -1223,7 +1223,7 @@ def pack_error( str, str | tuple[str, str] ] = {} - our_uid: tuple = current_actor().uid + our_uid: tuple = (current_actor().aid.name, current_actor().aid.uuid) if ( isinstance(exc, RemoteActorError) diff --git a/tractor/_streaming.py b/tractor/_streaming.py index 421ca6c2..01db098f 100644 --- a/tractor/_streaming.py +++ b/tractor/_streaming.py @@ -418,7 +418,7 @@ class MsgStream(trio.abc.Channel): # it can't traverse the transport. log.warning( f'Stream was already destroyed?\n' - f'actor: {ctx.chan.uid}\n' + f'actor: {(ctx.chan.aid.name, ctx.chan.aid.uuid)}\n' f'ctx id: {ctx.cid}' ) drained.append(re) @@ -700,7 +700,7 @@ async def open_stream_from_ctx( task: str = trio.lowlevel.current_task().name raise RuntimeError( 'Stream opened after `Context.cancel()` called..?\n' - f'task: {actor.uid[0]}:{task}\n' + f'task: {actor.aid.name}:{task}\n' f'{ctx}' ) @@ -823,7 +823,7 @@ async def open_stream_from_ctx( except KeyError: log.warning( f'Stream was already destroyed?\n' - f'actor: {ctx.chan.uid}\n' + f'actor: {(ctx.chan.aid.name, ctx.chan.aid.uuid)}\n' f'ctx id: {ctx.cid}' ) diff --git a/tractor/devx/debug/_sync.py b/tractor/devx/debug/_sync.py index 21850076..7847495d 100644 --- a/tractor/devx/debug/_sync.py +++ b/tractor/devx/debug/_sync.py @@ -92,11 +92,11 @@ async def maybe_wait_for_debugger( # tearing down. ctx_in_debug: Context|None = Lock.ctx_in_debug in_debug: tuple[str, str]|None = ( - ctx_in_debug.chan.uid + (ctx_in_debug.chan.aid.name, ctx_in_debug.chan.aid.uuid) if ctx_in_debug else None ) - if in_debug == current_actor().uid: + if in_debug == (current_actor().aid.name, current_actor().aid.uuid): log.debug( msg + diff --git a/tractor/experimental/_pubsub.py b/tractor/experimental/_pubsub.py index 97e16e24..50a9906c 100644 --- a/tractor/experimental/_pubsub.py +++ b/tractor/experimental/_pubsub.py @@ -117,7 +117,7 @@ def modify_subs( Effectively a symbol subscription api. """ - log.info(f"{ctx.chan.uid} changed subscription to {topics}") + log.info(f"{(ctx.chan.aid.name, ctx.chan.aid.uuid)} changed subscription to {topics}") # update map from each symbol to requesting client's chan for topic in topics: diff --git a/tractor/msg/_ops.py b/tractor/msg/_ops.py index 3b4eaa84..c341f092 100644 --- a/tractor/msg/_ops.py +++ b/tractor/msg/_ops.py @@ -345,9 +345,9 @@ class PldRx(Struct): exc=mte, cid=msg.cid, src_uid=( - ipc.chan.uid + (ipc.chan.aid.name, ipc.chan.aid.uuid) if not is_started_send_side - else ipc._actor.uid + else (ipc._actor.aid.name, ipc._actor.aid.uuid) ), ) mte._ipc_msg = err_msg @@ -711,7 +711,7 @@ async def drain_to_final_msg( 'Cancelling `MsgStream` drain since ' f'{reason}\n' f'\n' - f'<= {ctx.chan.uid}\n' + f'<= {(ctx.chan.aid.name, ctx.chan.aid.uuid)}\n' f' |_{ctx._nsf}()\n' f'\n' f'=> {ctx._task}\n' @@ -726,7 +726,7 @@ async def drain_to_final_msg( else: report: str = ( 'Ignoring "yield" msg during `ctx.result()` drain..\n' - f'<= {ctx.chan.uid}\n' + f'<= {(ctx.chan.aid.name, ctx.chan.aid.uuid)}\n' f' |_{ctx._nsf}()\n\n' f'=> {ctx._task}\n' f' |_{ctx._stream}\n\n'