fix(ohno): address some correctness and usability findings#278
fix(ohno): address some correctness and usability findings#278
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses performance, correctness, and usability issues in the ohno error handling library. The changes improve macro efficiency, fix a field naming bug, add compile-time safety, ensure proper call-site tracking, and make error enrichment iteration order consistent with display order.
Changes:
- Performance: Removed unnecessary
format!()allocation for plain string literals inapp_err!macro - Correctness: Fixed field name generation bug and added compile error for enums, plus
#[track_caller]forOption<T>methods - Usability: Made enrichment iterators return in chronological order (oldest-first), matching the display format
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/ohno_macros/src/utils.rs | Fixed generate_unique_field_name to avoid compounding names; added test for multiple collision scenario |
| crates/ohno_macros/src/error_type_attr.rs | Changed to return error when #[ohno::error] is applied to enums; updated tests accordingly |
| crates/ohno/tests/enrich_err.rs | Updated test expectations to reflect chronological ordering of enrichments |
| crates/ohno/tests/core.rs | Updated test expectations to reflect chronological ordering of enrichments |
| crates/ohno/src/core.rs | Removed .rev() from enrichment iterators to return chronological order; updated documentation |
| crates/ohno/src/app/macros.rs | Performance optimization: removed format!() for plain string literals |
| crates/ohno/src/app/into_app_err.rs | Added #[track_caller] to Option<T> implementations for correct location tracking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aef6d2b to
73dfe6d
Compare
Correctness: - Fix compounding name bug in generate_unique_field_name (ohno_core_1_2 instead of ohno_core_2 on repeated collision) - Emit clear compile error when #[ohno::error] is applied to enums - Add #[track_caller] to Option<T> IntoAppError implementations Usability: - Make enrichments()/enrichment_messages() iterate in chronological order (oldest-first), consistent with format_error display order
73dfe6d to
6f8cf37
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #278 +/- ##
========================================
- Coverage 100.0% 99.9% -0.1%
========================================
Files 141 141
Lines 8640 8653 +13
========================================
+ Hits 8640 8652 +12
- Misses 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Correctness:
Usability: