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_378
Gud Boi 2026-08-31 11:42:52 -04:00
parent 69a0e504cc
commit 80e1ec6461
5 changed files with 107 additions and 8 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

@ -18,6 +18,7 @@ from tractor.discovery import (
)
from tractor.ipc import (
_tcp,
_tipc,
_uds,
)
@ -147,13 +148,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,7 +76,6 @@ 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
@ -88,7 +88,12 @@ 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.runtime._runtime import Actor
else:
Multiaddr = Any
log = get_logger()

View File

@ -518,7 +518,7 @@ wheels = [
[[package]]
name = "multiaddr"
version = "0.2.0"
source = { registry = "https://pypi.org/simple" }
source = { git = "https://github.com/multiformats/py-multiaddr.git?rev=f86519daaa21699023d0037c58cdff600313dd09#f86519daaa21699023d0037c58cdff600313dd09" }
dependencies = [
{ name = "base58" },
{ name = "dnspython" },
@ -533,10 +533,6 @@ dependencies = [
{ name = "trio-typing" },
{ name = "varint" },
]
sdist = { url = "https://files.pythonhosted.org/packages/c7/10/4e26a8577cfce1c0febc8d83087e1373e93c695c6e73ad010546fb67e229/multiaddr-0.2.0.tar.gz", hash = "sha256:acb6b25c332ec1b2f1f8fef8d03a8c63385d34a87d690df0f4bba43cdf6efe8d", size = 58356, upload-time = "2026-03-17T21:51:00.274Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/b5/13/56e503d01218d1ca27ea9fda862045a4b400cae5e756f47315f5aaba0eee/multiaddr-0.2.0-py3-none-any.whl", hash = "sha256:bcff7bf3d7de3d6da0b865b25423bcb411de1d20d70cc6abfacf75170d17866c", size = 40424, upload-time = "2026-03-17T21:50:58.833Z" },
]
[[package]]
name = "mypy-extensions"
@ -1193,7 +1189,7 @@ requires-dist = [
{ name = "bidict", specifier = ">=0.23.1" },
{ name = "colorlog", specifier = ">=6.8.2,<7" },
{ name = "msgspec", specifier = ">=0.20.0" },
{ name = "multiaddr", specifier = ">=0.2.0" },
{ name = "multiaddr", git = "https://github.com/multiformats/py-multiaddr.git?rev=f86519daaa21699023d0037c58cdff600313dd09" },
{ name = "pdbp", specifier = ">=1.8.2,<2" },
{ name = "platformdirs", specifier = ">=4.4.0" },
{ name = "setproctitle", specifier = ">=1.3,<2" },