Skip to content

fix: replace human_bytes with human_repr::HumanCount#6691

Open
hanabi1224 wants to merge 2 commits intomainfrom
hm/no-human-bytes
Open

fix: replace human_bytes with human_repr::HumanCount#6691
hanabi1224 wants to merge 2 commits intomainfrom
hm/no-human-bytes

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Mar 4, 2026

Summary of changes

human_bytes::human_bytes does not accept u64 which might cause overflow error

pub fn human_bytes<T: Into<f64>>(bytes: T) -> String

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Chores
    • Replaced the byte-size formatting library with an alternative implementation across the codebase.
    • Removed an unused transitive dependency, reducing the overall dependency footprint.
    • All output formatting and user-facing behavior remain unchanged.

@hanabi1224 hanabi1224 marked this pull request as ready for review March 4, 2026 17:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8b1ee2d4-12a3-42aa-b820-9a388b474881

📥 Commits

Reviewing files that changed from the base of the PR and between 57978f8 and b8ab1bf.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Cargo.toml
  • src/db/gc/snapshot.rs
  • src/dev/subcommands/state_cmd.rs
  • src/tool/subcommands/archive_cmd.rs
  • src/utils/io/progress_log.rs
  • src/utils/net/download_file.rs
💤 Files with no reviewable changes (1)
  • Cargo.toml

Walkthrough

This PR replaces the human_bytes crate dependency with the human_repr crate's HumanCount trait across the codebase. All byte-size formatting has been migrated from function calls to trait methods without altering business logic or public APIs.

Changes

Cohort / File(s) Summary
Dependency Removal
Cargo.toml
Removed human_bytes = "0.4" transitive dependency from workspace.
Byte Formatting Migration
src/db/gc/snapshot.rs, src/dev/subcommands/state_cmd.rs, src/tool/subcommands/archive_cmd.rs, src/utils/io/progress_log.rs, src/utils/net/download_file.rs
Added human_repr::HumanCount trait imports and replaced all human_bytes() function calls with .human_count_bytes() trait method calls on integer values. Maintains identical output formatting behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • LesnyRumcajs
  • sudo-shashank
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing human_bytes with human_repr::HumanCount across multiple files to fix overflow issues with large u64 values.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/no-human-bytes

Comment @coderabbitai help to get the list of available commands and usage tips.

@hanabi1224 hanabi1224 requested a review from a team as a code owner March 4, 2026 17:44
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and sudo-shashank and removed request for a team March 4, 2026 17:44
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.

1 participant