Skip to content

fix: verbbuilder.py - #566

Merged
JeremyTubongbanua merged 3 commits into
trunkfrom
jt/delete-fix
Sep 22, 2026
Merged

JeremyTubongbanua merged 3 commits into
trunkfrom
jt/delete-fix

Conversation

@JeremyTubongbanua

@JeremyTubongbanua JeremyTubongbanua commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

What I did

  • Include namespace as part of keyName (verbbuilder.py)
  • Updated namespace tests to match Dart behaviour (no more leading . in python tests)
    • In trunk, five verb builders omit the namespace entirely, producing $key. NotifyVerbBuilder concatenates $key$namespace without adding the separator. This PR consistently produces $key.$namespace, matching Dart

Why

Someone found this bug:

Taking your point about the latest version, I tested the newest Python release available today, 0.2.77, alongside the 0.2.63 we had pinned. Identical behaviour on both.

Environment: atsdk 0.2.63 and 0.2.77, Python 3.14.4, Windows 11.

What happens: a SharedKey created with a namespace cannot be deleted through the same key object. put and delete build their commands by two different routes, and they disagree on the key's name:

put     AtClient._put_shared_key   f"update{key.metadata}:{key} {cipher_text}"

                                   str(key) -> AtKey.get_fully_qualified_key_name()

                                   -> "mykey.d2wagentid@alice"     namespace included

 

delete  AtClient.delete            DeleteVerbBuilder().with_at_key(key).build()

                                   never reads at_key.namespace

                                   -> "delete:@bob:mykey@alice"    namespace omitted

So the delete names a key that was never created. The atServer accepts a delete for a non-existent key, so delete() returns success and removes nothing — the caller has no way to tell, short of reading the key back.

Reproducer — no network, no atSign, no keys; pure command construction:

from at_client.common import AtSign

from at_client.common.keys import SharedKey

from at_client.util.verbbuilder import DeleteVerbBuilder

 

key = SharedKey("mykey", AtSign("@alice"), AtSign("@bob"))

key.namespace = "mynamespace"

 

print(f"update{key.metadata}:{key} <cipher>")                 # namespace present

print(DeleteVerbBuilder().with_at_key(key).build())           # namespace absent

One further observation that may be the more useful fix: there are three conventions for this in the same client. _put_shared_key uses str(key); _get_shared_by_other_with_me appends the namespace by hand (command += "." + shared_key.get_namespace()); DeleteVerbBuilder ignores it. Centralising all three on AtKey.get_fully_qualified_key_name() would fix delete and remove the chance of the next path drifting again.

This shouldn't be a breaking change — it only affects keys that carry a namespace, and those can't be deleted at all today.

Our workaround, for anyone who hits it: put the namespace into the key name and leave namespace unset, then verify by scanning the keystore rather than trusting the return value.

@JeremyTubongbanua JeremyTubongbanua self-assigned this Sep 21, 2026
@JeremyTubongbanua
JeremyTubongbanua merged commit 737a76d into trunk Sep 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants