[PR #478] Fix 5 Rust correctness bugs found in code review #499

Closed
opened 2026-03-02 04:13:48 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/478

State: closed
Merged: Yes


Summary

  • Fix unwrap panic in fetch_remote_from_args — replace remote.unwrap() with proper error handling when no remote can be determined
  • Fix broken Ord implementation for PromptRecord|| chains violated total ordering; replaced with lexicographic .then_with() comparison
  • Fix integer overflow in LineRange::shift(u32 as i32 + offset) as u32 wraps negative results; use safe i64 arithmetic
  • Fix nested block_on deadlock in virtual attribution — smol::block_on inside async context risks deadlock; made function async
  • Clear INITIAL file on resetreset_working_log() left stale INITIAL attributions; now properly cleaned up

Test plan

  • Verify cargo build succeeds
  • Verify cargo test passes
  • Review each commit individually for correctness
  • Test sync/fetch operations with missing remote configuration
  • Test sorting behavior of PromptRecord collections
  • Test LineRange::shift with negative offsets that would produce negative results

🤖 Generated with Claude Code


Open with Devin
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/478 **State:** closed **Merged:** Yes --- ## Summary - **Fix unwrap panic** in `fetch_remote_from_args` — replace `remote.unwrap()` with proper error handling when no remote can be determined - **Fix broken Ord implementation** for `PromptRecord` — `||` chains violated total ordering; replaced with lexicographic `.then_with()` comparison - **Fix integer overflow** in `LineRange::shift` — `(u32 as i32 + offset) as u32` wraps negative results; use safe i64 arithmetic - **Fix nested block_on deadlock** in virtual attribution — `smol::block_on` inside async context risks deadlock; made function async - **Clear INITIAL file on reset** — `reset_working_log()` left stale INITIAL attributions; now properly cleaned up ## Test plan - [ ] Verify `cargo build` succeeds - [ ] Verify `cargo test` passes - [ ] Review each commit individually for correctness - [ ] Test sync/fetch operations with missing remote configuration - [ ] Test sorting behavior of `PromptRecord` collections - [ ] Test `LineRange::shift` with negative offsets that would produce negative results 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/git-ai-project/git-ai/pull/478" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
kerem 2026-03-02 04:13:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#499
No description provided.