Compare commits
No commits in common. "a966928dead4cbf369ad244834ce9dbe988ac8ca" and "f70cfd62a6276380d6a01543e9257141b8364a23" have entirely different histories.
a966928dea
...
f70cfd62a6
|
|
@ -1 +0,0 @@
|
||||||
{"version": 1, "backend": "legacy"}
|
|
||||||
|
|
@ -432,9 +432,3 @@ docs/conversations/
|
||||||
# BEGIN ai.skillz: direct:symlink:opencode:command:yt-url-lookup
|
# BEGIN ai.skillz: direct:symlink:opencode:command:yt-url-lookup
|
||||||
/.opencode/commands/yt-url-lookup.md
|
/.opencode/commands/yt-url-lookup.md
|
||||||
# END ai.skillz: direct:symlink:opencode:command:yt-url-lookup
|
# END ai.skillz: direct:symlink:opencode:command:yt-url-lookup
|
||||||
|
|
||||||
# BEGIN ai.skillz: workflow-state
|
|
||||||
/.ai/state/
|
|
||||||
/.ai/commit-msg/conf.toml
|
|
||||||
/.ai/pr-msg/conf.toml
|
|
||||||
# END ai.skillz: workflow-state
|
|
||||||
|
|
|
||||||
|
|
@ -157,64 +157,3 @@ def test_registrar_stores_canonical_addresses(
|
||||||
assert registrar._registry == {
|
assert registrar._registry == {
|
||||||
new_uid: [canonical],
|
new_uid: [canonical],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('container', [tuple, list])
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
'declaration',
|
|
||||||
[
|
|
||||||
pytest.param(('127.0.0.1', 1616), id='legacy-tcp'),
|
|
||||||
pytest.param(
|
|
||||||
('tcp', '127.0.0.1', 1616),
|
|
||||||
id='tagged-tcp',
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
('/tmp/tractor', 'registry.sock'),
|
|
||||||
id='legacy-uds',
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
('unix', '/tmp/tractor/registry.sock'),
|
|
||||||
id='tagged-unix',
|
|
||||||
),
|
|
||||||
pytest.param(
|
|
||||||
('uds', '/tmp/tractor/registry.sock'),
|
|
||||||
id='uds-alias',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_registrar_deletes_equivalent_address_forms(
|
|
||||||
declaration: tuple,
|
|
||||||
container: type,
|
|
||||||
):
|
|
||||||
'''
|
|
||||||
Delete a canonical registration using any accepted spelling.
|
|
||||||
|
|
||||||
``Registrar.register_actor()`` stores canonical tagged addresses,
|
|
||||||
but ``Registrar.delete_addr()`` previously compared the supplied
|
|
||||||
tuple unchanged. A legacy declaration or ``uds`` alias therefore
|
|
||||||
left a stale entry in ``Registrar._registry``. Register each
|
|
||||||
declaration, verify its stored canonical form, then delete with
|
|
||||||
the original spelling as a tuple or msgpack-style list. Returning
|
|
||||||
the registered uid and leaving no entry proves normalization at
|
|
||||||
the deletion boundary without requiring a mixed-version tree.
|
|
||||||
|
|
||||||
'''
|
|
||||||
registrar = SimpleNamespace(
|
|
||||||
_registry={},
|
|
||||||
_waiters={},
|
|
||||||
)
|
|
||||||
uid = ('service', 'service-uid')
|
|
||||||
canonical = wrap_address(declaration).unwrap()
|
|
||||||
|
|
||||||
async def register_then_delete():
|
|
||||||
await Registrar.register_actor(registrar, uid, declaration)
|
|
||||||
assert registrar._registry == {uid: [canonical]}
|
|
||||||
|
|
||||||
deleted_uid = await Registrar.delete_addr(
|
|
||||||
registrar,
|
|
||||||
container(declaration),
|
|
||||||
)
|
|
||||||
assert deleted_uid == uid
|
|
||||||
assert registrar._registry == {}
|
|
||||||
|
|
||||||
trio.run(register_then_delete)
|
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,9 @@ class Registrar(Actor):
|
||||||
addr: tuple[str, int|str]|list[str|int],
|
addr: tuple[str, int|str]|list[str|int],
|
||||||
) -> tuple[str, str]|None:
|
) -> tuple[str, str]|None:
|
||||||
# NOTE: `addr` arrives as a `list` over IPC
|
# NOTE: `addr` arrives as a `list` over IPC
|
||||||
# (msgpack deserializes tuples -> lists). Normalize legacy
|
# (msgpack deserializes tuples -> lists) so
|
||||||
# and tagged forms to match `Registrar._registry` entries.
|
# coerce to `tuple` for the linear scan.
|
||||||
addr = wrap_address(addr).unwrap()
|
addr = tuple(addr)
|
||||||
uid: tuple[str, str]|None = None
|
uid: tuple[str, str]|None = None
|
||||||
|
|
||||||
for _uid, addrs in self._registry.items():
|
for _uid, addrs in self._registry.items():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue