Skip to content

Conversation

@henba1
Copy link
Collaborator

@henba1 henba1 commented Nov 20, 2025

Auto-verify is providing obtained_labels as a string, not a numpy array or list, but we called .flatten() (a numpy array method).

The to_dict() method assumes obtained_labels is always a numpy array, but it's actually receiving different types.

Proposed fix: Update the to_dict() method in epsilon_status.py to handle multiple types robustly:

Auto-verify is providing obtained_labels as a string, not a numpy array or list, but we called .flatten() (a numpy array method).

The to_dict() method assumes obtained_labels is always a numpy array, but it's actually receiving different types.

Proposed fix: Update the to_dict() method in epsilon_status.py to handle multiple types robustly:
@henba1 henba1 requested review from AWbosman and Aaron99B November 20, 2025 12:21
@henba1 henba1 self-assigned this Nov 20, 2025
… the counter example and populate obtained_labels in the CompleteVerificationData
@henba1 henba1 changed the title Refactor to_dict method in EpsilonStatus class to Refactor to_dict method in EpsilonStatus class Nov 20, 2025
@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…sult in auto_verify_module verify() with tests
Copy link
Collaborator

@Aaron99B Aaron99B left a comment

Choose a reason for hiding this comment

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

I wouldn't include short inline comments if not absolutely necessary. The code should be self-explanatory. If we include many of these comments, we will have to update even more things if we make any changes.

"""Convert the EpsilonStatus to a dictionary."""
obtained_labels_value = None
if self.obtained_labels is not None:
if hasattr(self.obtained_labels, "flatten"): # numpy array
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's just check for a numpy array here. Then we can also remove the comment that it is a numpy array

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

obtained_labels_value = self.obtained_labels.flatten().tolist()
elif isinstance(self.obtained_labels, list):
obtained_labels_value = self.obtained_labels
else: # string or other type
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would not include comments like this. The code itself should be readable enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

obtained_labels_value = self.obtained_labels.flatten().tolist()
elif isinstance(self.obtained_labels, list):
obtained_labels_value = self.obtained_labels
else: # string or other type
Copy link
Collaborator

Choose a reason for hiding this comment

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

How could we reach this else case? Right now it could just be numpy array or list, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

obtained_labels is expected to be either a numpy array or a list, but we can keep the else branch as a safe fallback to handle scalar values (e.g. a single string), which is covered by the unit test test_epsilon_status l. 98-109

This would enable obained_labels also to be str - it just extends and does not break anything.

self.timeout = timeout
self.config = config
self.name = f"AutoVerifyModule ({verifier.name})"
self.name = f"AutoVerifyModule ({verifier.name})"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What was changed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No functional changes, the formatting of the verify_property call was changed (arguments on one line vs multiple lines)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you mean only this line, then its likely some artefact - ie blank space removed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed - only formatting changes


assert isinstance(result, CompleteVerificationData)
assert result.result == "SAT"
# obtained_labels should not be set if parsing fails
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't you assert it then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

# obtained_labels should not be set if parsing fails


def test_auto_verify_module_verify_error_result(auto_verify_module, verification_context):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What funtionality is tested here? Is this test really necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

error handling path when the verifier returns an Err result

I think we should keep it as we want explicit coverage of the error path

@henba1 henba1 added bug Something isn't working enhancement New feature or request labels Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants