Fix TIPC integration after the `main` rebase

Carry the WG-aware py-multiaddr rev into the refreshed lock while
retaining `main`'s current dependency set.

Keep TIPC's `Multiaddr` annotation off the eager import path, and
extend lazy annotation checks for TIPC's interim `Multiaddr|str`
shape.

Prompt-IO: ai/prompt-io/opencode/20260830T045303Z_69a0e504_prompt_io.md

(this patch was generated in some part by `opencode` using
`gpt-5.6-sol` (`openai`))
wkt/tipc_backend_wg_stack
Gud Boi 2026-08-31 11:42:52 -04:00
parent d9d7cc491a
commit 1e9a110194
4 changed files with 107 additions and 3 deletions

View File

@ -0,0 +1,40 @@
---
model: openai/gpt-5.6-sol
service: opencode
session: a998acff-af66-4969-a65e-f77cbf5ef8dd
timestamp: 2026-08-30T04:53:03Z
git_ref: wkt/tipc_backend_378
scope: code
substantive: true
raw_file: 20260830T045303Z_69a0e504_prompt_io.raw.md
---
## Prompt
Inspect the TIPC backend rebase onto current `main`, repair and verify any
integration problems before force-push, and prepare the result through the
proper `/commit-plan` workflow.
## Response summary
Repaired the stale lock produced by replaying the historical py-multiaddr
source-pin commit over current `main`. Adapted TIPC to the newer lazy-import
contract and extended runtime annotation tests for the interim `/tipc`
multiaddr representation. Verified both the full default and TIPC transport
test matrices.
## Files changed
- `uv.lock` - select the pinned WG-capable py-multiaddr revision while
retaining current `main` dependencies.
- `tractor/ipc/_tipc.py` - make the `Multiaddr` annotation import lazy.
- `tests/test_lazy_imports.py` - cover TIPC annotation resolution and the
interim `Multiaddr|str` return shape.
## Human edits
The human restarted and advanced the rebase one conflict at a time, required
the agent to provide exact continuation commands after each resolution,
authorized lock repair and verification, and retained ownership of the
force-push. The human then rejected the ad hoc staging suggestion and required
the complete `/commit-plan` workflow before committing.

View File

@ -0,0 +1,54 @@
---
model: openai/gpt-5.6-sol
service: opencode
timestamp: 2026-08-30T04:53:03Z
git_ref: wkt/tipc_backend_378
diff_cmd: git diff HEAD~1..HEAD
---
## Prompt
After rebasing the TIPC backend branch onto current `main`, inspect the
result before the human force-pushes it. Repair and verify any integration
problems, then provide a proper `/commit-plan` rather than an ad hoc staging
and commit suggestion.
## Response
The range-diff showed that the two omitted pformat commits were already
present on `main`, while the conflict resolutions correctly retained current
platform-aware transport behavior. It also exposed a lost `uv.lock` update:
`pyproject.toml` retained the unreleased WG-capable `multiaddr` source pin,
but the lock still selected the PyPI release.
> `git diff HEAD~1..HEAD -- uv.lock`
Regenerated the lock against current `main`, preserving its newly landed
dependencies while selecting py-multiaddr revision `f86519da`.
The full test suite then found that eagerly importing `Multiaddr` from the
new TIPC module violated `main`'s cold-import contract.
> `git diff HEAD~1..HEAD -- tractor/ipc/_tipc.py`
Moved `Multiaddr` under `TYPE_CHECKING` and supplied the runtime `Any` alias
used by the sibling TCP and UDS backends, retaining lazy multiaddr loading
and runtime annotation resolution.
> `git diff HEAD~1..HEAD -- tests/test_lazy_imports.py`
Extended lazy annotation checks to the TIPC stream and updated
`mk_maddr()`'s expected runtime return type for the branch's interim
`Multiaddr|str` TIPC grammar.
Validation completed:
- `uv lock --check` passed.
- Focused lazy-import, TIPC, and multiaddr checks: 60 passed.
- Full default transport suite: 548 passed, 9 skipped, 7 xfailed,
3 xpassed.
- Full `--tpt-proto=tipc` suite: 548 passed, 9 skipped, 8 xfailed,
2 xpassed.
The human corrected the initial ad hoc commit suggestion and required the
repository's complete `/commit-plan` workflow.

View File

@ -19,6 +19,7 @@ from tractor.discovery import (
)
from tractor.ipc import (
_tcp,
_tipc,
_uds,
)
@ -271,13 +272,16 @@ def test_lazy_annotation_names_resolve():
introspection.
'''
assert get_type_hints(_multiaddr.mk_maddr)['return'] is Any
assert get_type_hints(_multiaddr.mk_maddr)['return'] == Any|str
assert get_type_hints(_tcp.MsgpackTCPStream.maddr.fget)[
'return'
] is Any
assert get_type_hints(_uds.MsgpackUDSStream.maddr.fget)[
'return'
] == Any|str
assert get_type_hints(_tipc.MsgpackTIPCStream.maddr.fget)[
'return'
] == Any|str
assert get_type_hints(_addr.Address.get_random)[
'current_actor'
] is Any

View File

@ -59,6 +59,7 @@ from socket import (
import struct
import sys
from typing import (
Any,
AsyncGenerator,
Callable,
ClassVar,
@ -75,10 +76,8 @@ from trio import (
SocketListener,
)
from multiaddr import Multiaddr
from tractor.msg import MsgCodec
from tractor.log import get_logger
from tractor.discovery._multiaddr import mk_maddr
from tractor.ipc._transport import (
MsgpackTransport,
)
@ -88,8 +87,13 @@ from tractor.runtime._state import (
)
if TYPE_CHECKING:
# ONLY type-annots, the eager import costs
# `import tractor` wall-time (gh #470).
from multiaddr import Multiaddr
from tractor.discovery._addr import TaggedTIPCAddress
from tractor.runtime._runtime import Actor
else:
Multiaddr = Any
log = get_logger()
@ -640,6 +644,8 @@ class MsgpackTIPCStream(MsgpackTransport):
@property
def maddr(self) -> Multiaddr|str:
from tractor.net import mk_maddr
if not self.raddr:
return '<unknown-peer>'