Skip to content

fix(bulk_update): exclude header row from progress bar entity count#62

Open
gkorland wants to merge 2 commits into
masterfrom
fix/bulk-update-count-header-offbyone
Open

fix(bulk_update): exclude header row from progress bar entity count#62
gkorland wants to merge 2 commits into
masterfrom
fix/bulk-update-count-header-offbyone

Conversation

@gkorland

Copy link
Copy Markdown

Summary

count_entities returns the total number of lines in the CSV. With the default --no-header=False, one line is skipped during processing for the header row, so the progress bar always showed "1 remaining" at the end.

Changes

  • falkordb_bulk_loader/bulk_update.py: in process_update_csv, subtract 1 from entity_count when a header row is expected (clamped at 0 for safety).

Testing

Lint clean. The progress bar will now reach 100% on completion.

Memory / Performance Impact

N/A.

Related Issues

From the comprehensive code-review report (BUG-13).

`count_entities` counts every line in the CSV file, including the header
row. When `--no-header` is not set (the default) one line is then skipped
during processing, so the progress bar always reported one extra entity
remaining at completion.

Subtract one from the count at the call site when a header is expected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gkorland has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 19 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 19 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 016a5ccc-a026-48ca-8b19-dc4dc4324a25

📥 Commits

Reviewing files that changed from the base of the PR and between 3602af1 and d80d028.

📒 Files selected for processing (1)
  • falkordb_bulk_loader/bulk_update.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bulk-update-count-header-offbyone

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.55%. Comparing base (3602af1) to head (d80d028).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
+ Coverage   89.52%   89.55%   +0.03%     
==========================================
  Files           9        9              
  Lines         611      613       +2     
==========================================
+ Hits          547      549       +2     
  Misses         64       64              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gkorland
gkorland marked this pull request as ready for review April 26, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes the bulk_update CLI progress bar length so it matches the number of CSV data rows processed when a header row is present (default behavior).

Changes:

  • Adjust entity_count in process_update_csv to subtract the header row when --no-header is not set (clamped to 0).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gkorland

Copy link
Copy Markdown
Author

Copilot Code Review

No significant issues found.

@gkorland

Copy link
Copy Markdown
Author

Agent Review Summary

PR: fix(bulk_update): exclude header row from progress bar entity count

Status: ✅ LGTM — all checks pass, no issues found.


What was reviewed

  • File changed: falkordb_bulk_loader/bulk_update.py (+3 lines)
  • Fix: In process_update_csv, subtract 1 from entity_count when no_header is False (header row is present). Clamped to 0 via max(..., 0) to handle edge cases (empty or header-only files).

Analysis

Area Result
Correctness count_entities counts all lines incl. header; subtracting 1 correctly aligns the progress bar with actual data rows
Safety max(entity_count - 1, 0) prevents negative counts for empty/header-only files
Style ✅ Consistent with existing if self.no_header is False: pattern in the same method
Tests ✅ Existing integration tests cover the with-header and no-header paths; Codecov shows +0.03% coverage
CI ✅ All 9 checks pass (linting, Python 3.10, Python 3.11, CodeQL, CodeRabbit, Codecov)
Branch ✅ Up-to-date with master (merge commit d80d028)

No changes required

The fix is minimal, correct, and follows project conventions. No open review threads. PR is ready to merge.

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