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

Conversation

2byrds
Copy link
Collaborator

@2byrds 2byrds commented May 29, 2024

Adds a message to the MissingDelegableApprovalError so the logging doesn't fail.
Updated test to exercise the exception and logging.

Signed-off-by: 2byrds <2byrds@gmail.com>
@2byrds 2byrds linked an issue May 29, 2024 that may be closed by this pull request
@2byrds 2byrds requested a review from m00sey May 29, 2024 18:18
@2byrds 2byrds merged commit 1c09b39 into WebOfTrust:main May 29, 2024
6 checks passed
@@ -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.

@@ -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

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.

MissingDelegableApprovalError logging bug
2 participants