-
Notifications
You must be signed in to change notification settings - Fork 55
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
Update agent_persist_mock to patch _exists method #868
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #868 +/- ##
==========================================
+ Coverage 62.52% 62.54% +0.02%
==========================================
Files 342 342
Lines 14545 14553 +8
==========================================
+ Hits 9094 9102 +8
Misses 5451 5451 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review Summary
Total Issues Found: 1
Critical Issues: 1
Suggestions: 1
Key Findings:
The code review identified a critical issue in src/ostorlab/testing/agent.py related to inconsistent data encoding in the storage mechanism. Specifically, line 102 bypasses the encoding applied in line 100, potentially leading to inconsistencies when storing bytes values. It was suggested to either remove line 102 or explicitly encode bytes values before assignment. Also, it was suggested to add a comment explaining why the encoding is necessary. Overall code quality is impacted due to this inconsistency.
c771887
to
c710b37
Compare
This PR updates
persist_agent_mock
to patch the_exists
method that was added to theagent_persist_mixin
.This PR also updates the patch function
_add
to only encode thevalue
argument if it is not of typebytes
.If
value
is of typebytes
then we havestr(value).encode() != value
.