Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes MissingDelegableApprovalError logging bug #789

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/keri/core/eventing.py
Original file line number Diff line number Diff line change
Expand Up @@ -5806,7 +5806,7 @@ def processEscrowDelegables(self):
self.processEvent(serder=eserder, sigers=sigers, wigers=wigers, delseqner=seqner,
delsaider=saider, local=esr.local)
else:
raise MissingDelegableApprovalError()
raise MissingDelegableApprovalError("No delegation seal found for event.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be good to include the event digest?

MissingDelegableApprovalError("Missing Delegable Approval for evt at dig = {}.""".format(bytes(edig)))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that would be better


except MissingDelegableApprovalError as ex:
# still waiting on missing delegation approval
Expand Down
2 changes: 2 additions & 0 deletions tests/core/test_delegating.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ def test_delegables_escrow():
parsing.Parser().parse(ims=bytearray(gateIcp), kvy=torKvy, local=True)
assert gateHab.pre not in torKvy.kevers
assert len(torHab.db.delegables.get(keys=snKey(gateHab.kever.serder.preb, gateHab.kever.serder.sn))) == 1
# Exercise the MissingDelegableApprovalError case
torKvy.processEscrowDelegables()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there expected to be additional assertions here to catch MissingDelegableApprovalError?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or should there be additional assertions to verify there wasn't a missing delegable approval error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems odd to add the processing line but no assertions in the test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there expected to be additional assertions here to catch MissingDelegableApprovalError?

No, the error is part of the escrow processing (the exception doesn't make it out of the processing).

Copy link
Collaborator Author

@2byrds 2byrds May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or should there be additional assertions to verify there wasn't a missing delegable approval error?

The test was valid originally, but it never exercised the MissingDelegableApprovalError so it didn't discover the logging error. This small addition does a better job of simulating that processEscrowDelegables is being called multiple times during the flow (becuase it is part of asynchronous escrow processing)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems odd to add the processing line but no assertions in the test

The constantly running escrow processors are difficult to capture in a small test. this is the shortest path to exercising the case when the processor runs before the user managed flow is complete.


# Now create delegating interaction event
seal = eventing.SealEvent(i=gateHab.pre,
Expand Down
Loading