WebOfTrust / keria

KERI Agent in the cloud
https://keria.readthedocs.io/en/latest/
Apache License 2.0
20 stars 30 forks source link

Contact attributes disappears after re-resolving OOBI and querying key state #291

Open lenkan opened 1 month ago

lenkan commented 1 month ago

Steps to reproduce

  1. Resolve oobi for AID X with an alias
  2. Update contact for AID X with an attribute, e.g group: "foobar"
  3. List the contacts, verify group: "foobar" is there
  4. Resolve oobi for AID X with the same alias as step 1
  5. List the contacts, verify group: "foobar" is there
  6. Query the key state of AID x
  7. List the contacts

Expected result

group:"foobar" is still on the contact

Actual result

group:"foobar" is no longer on the contact

Automatic reproduction

See reproduction https://github.com/nordlei/vlei-sandbox/blob/main/src/issues/contact-attributes-disappears-after-query.test.ts

git clone git@github.com:nordlei/vlei-sandbox.git
cd vlei-sandbox
docker compose run --rm --build test npm start src/issues/contact-attributes-disappears-after-query.test.ts

It seems like the contact attributes are removed from the contact.

Output:

 RUN  v2.0.5 /app

 ❯ src/oobi.test.ts (4) 6962ms
   ✓ Resolve OOBIs
   ✓ Update contact details
   ✓ Refresh oobi
   × Query key state 889ms

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/oobi.test.ts > Query key state
AssertionError: expected { alias: 'alias2', …(2) } to match object { …(3) }
(1 matching property omitted from actual)

- Expected
+ Received

  Object {
    "alias": "alias2",
-   "group": "abc",
    "id": "EO5VdAGz365Cf33Oz1HQ8JOLCjg8Df4uQWH901rJkc_u",
  }

 ❯ src/oobi.test.ts:50:74
     48|   await wallet1.queryKeyState(wallet2.identifier.prefix);
     49|
     50|   expect(await wallet1.client.contacts().get(wallet2.identifier.prefix)).toMatchObjec…
       |                                                                          ^
     51|     id: wallet2.identifier.prefix,
     52|     alias: wallet2.identifier.name,

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed (1)
      Tests  1 failed | 3 passed (4)
   Start at  12:59:14
   Duration  8.13s (transform 53ms, setup 0ms, collect 926ms, tests 6.96s, environment 0ms, prepare 87ms)
rodolfomiranda commented 1 month ago

Seems that after processing the oobi all contact data is replaced in kere: https://github.com/WebOfTrust/keripy/blob/9d9a481994e01aaa5a1c7bc637f758a3a2927078/src/keri/app/oobiing.py#L507-L508