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

Update agent_persist_mock to patch _exists method #868

Merged
merged 5 commits into from
Feb 24, 2025

Conversation

nassermohamedit0
Copy link
Contributor

@nassermohamedit0 nassermohamedit0 commented Feb 23, 2025

This PR updates persist_agent_mock to patch the _exists method that was added to the agent_persist_mixin.

This PR also updates the patch function _add to only encode the value argument if it is not of type bytes.
If value is of type bytes then we have str(value).encode() != value.

@nassermohamedit0 nassermohamedit0 requested a review from a team as a code owner February 23, 2025 15:06
Copy link

codecov bot commented Feb 23, 2025

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 62.54%. Comparing base (2a0f88e) to head (6819446).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/ostorlab/testing/agent.py 75.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link

@ostorlab-ai-pr-review ostorlab-ai-pr-review bot left a 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.

@nassermohamedit0 nassermohamedit0 force-pushed the fix/patch-exists-method-in-persist-agent-mock branch from c771887 to c710b37 Compare February 23, 2025 15:26
@nassermohamedit0 nassermohamedit0 added bug Something isn't working readability labels Feb 23, 2025
elyousfi5
elyousfi5 previously approved these changes Feb 24, 2025
@3asm 3asm merged commit d829a04 into main Feb 24, 2025
12 checks passed
@3asm 3asm deleted the fix/patch-exists-method-in-persist-agent-mock branch February 24, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working readability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants