Skip to content

fix: enforce name length limit #77

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

Merged
merged 5 commits into from
May 5, 2025
Merged

fix: enforce name length limit #77

merged 5 commits into from
May 5, 2025

Conversation

joseph-sentry
Copy link
Contributor

we want to limit the length of individual testrun fields (except for
failure messages). This is done for DB index limit reasons, but also
because if the testrun fields exceed this length, something is
probably wrong with the user's setup.

@joseph-sentry joseph-sentry requested a review from Swatinem May 1, 2025 00:02
Copy link

codecov bot commented May 1, 2025

Codecov Report

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

Project coverage is 96.89%. Comparing base (45a671a) to head (da61d26).
Report is 8 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/validated_string.rs 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
- Coverage   96.95%   96.89%   -0.06%     
==========================================
  Files          15       16       +1     
  Lines        1902     1931      +29     
==========================================
+ Hits         1844     1871      +27     
- Misses         58       60       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented May 1, 2025

Codecov Report

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

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/validated_string.rs 87.50% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

codspeed-hq bot commented May 1, 2025

CodSpeed Performance Report

Merging #77 will not alter performance

Comparing joseph/improvement (da61d26) with main (45a671a)

Summary

✅ 6 untouched benchmarks

Copy link
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

This looks very reasonable, I do have a couple of suggestions:

  • Creating a fn new to create empty strings makes sense and will clean up a bunch of code
  • Similarly, switching over string literals in tests to "literal".into() might simplify a ton of that test code.
  • You have a bunch of unwraps still scattered around a few places where they might be hit in production. These should be fixed and rather just propagate the error.

we want to limit the length of individual testrun fields (except for
failure messages). This is done for DB index limit reasons, but also
because if the testrun fields exceed this length, something is
probably wrong with the user's setup.
- implement tryfrom and tryinto for validated_string
- replace left over unwrap calls
- use pyo3 transparent to derive intopyobject and frompyobject
Copy link
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

All these "".try_into().unwrap() still read really weird. A new()/Default for an empty string would be nice.
As well as a simpler constructor for literals.

avoid doing a bunch of "".try_into().unwrap() and just use the default
@joseph-sentry joseph-sentry merged commit 14fe3d7 into main May 5, 2025
12 checks passed
@joseph-sentry joseph-sentry deleted the joseph/improvement branch May 5, 2025 17:34
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.

2 participants