Skip to content

fix(bulk_update): mark --query and --csv as required CLI options#64

Open
gkorland wants to merge 2 commits into
masterfrom
fix/bulk-update-required-options
Open

fix(bulk_update): mark --query and --csv as required CLI options#64
gkorland wants to merge 2 commits into
masterfrom
fix/bulk-update-required-options

Conversation

@gkorland

Copy link
Copy Markdown

Summary

--query and --csv were declared without required=True. If either was omitted, Click silently passed None into BulkUpdate.__init__, where it eventually caused a cryptic TypeError (e.g. when utf8len(None) or open(None, ...) was called) instead of a clear usage error.

Changes

  • falkordb_bulk_loader/bulk_update.py: add required=True to the --query and --csv Click options.

Testing

uv run flake8 falkordb_bulk_loader clean.

Memory / Performance Impact

N/A.

Related Issues

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

@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 46 minutes and 39 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ 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: b7aa43b1-70d9-48c2-a8a6-28f4ace63e9d

📥 Commits

Reviewing files that changed from the base of the PR and between 3954856 and 051edee.

📒 Files selected for processing (2)
  • falkordb_bulk_loader/bulk_update.py
  • test/test_bulk_update.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bulk-update-required-options

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
Review rate limit: 0/1 reviews remaining, refill in 46 minutes and 39 seconds.

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.50%. Comparing base (3954856) to head (051edee).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #64   +/-   ##
=======================================
  Coverage   89.50%   89.50%           
=======================================
  Files           9        9           
  Lines         610      610           
=======================================
  Hits          546      546           
  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:57
@gkorland

Copy link
Copy Markdown
Author

Copilot Code Review

No significant issues found.

gkorland and others added 2 commits April 29, 2026 09:32
Without `required=True`, omitting either option caused a cryptic
`TypeError` deep inside `BulkUpdate.__init__` when `None` was passed
to `utf8len` or `open`. Click should reject the invocation with a
clear usage error instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verify that omitting either required option produces a clear Click
usage error (exit 2 + 'Missing option' message) rather than a cryptic
TypeError. Also guard teardown_class against FileNotFoundError when
the CSV temp file was never created.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gkorland
gkorland force-pushed the fix/bulk-update-required-options branch from d51372d to 051edee Compare April 29, 2026 06:34
@gkorland
gkorland requested a review from Copilot April 29, 2026 06:35
Comment thread test/test_bulk_update.py
os.unlink("/tmp/csv.tmp")
try:
os.unlink("/tmp/csv.tmp")
except FileNotFoundError:
@gkorland

Copy link
Copy Markdown
Author

Agent Review Summary

Phase 1 — PR Understanding

Change: 2-line fix adding required=True to --query and --csv Click options in bulk_update.py. Before this fix, omitting either option caused a cryptic TypeError deep inside the code instead of a clean usage error.

Phase 2 — Review Comments

No inline review comments to address. All previous CI checks were green.

Phase 3 — Rebase

Branch was 5 commits behind master. Rebased cleanly onto origin/master (now at 3954856) and force-pushed with --force-with-lease.

Phase 4 — Test Coverage

Added two new tests to test/test_bulk_update.py:

  • test_missing_query_gives_usage_error — asserts exit code 2 + "Missing option" + "--query" in output
  • test_missing_csv_gives_usage_error — asserts exit code 2 + "Missing option" + "--csv" in output

Also fixed a pre-existing teardown_class bug (unconditional os.unlink raised FileNotFoundError when running these new tests in isolation).

Phase 5 — CI

All 9 checks passed ✅ (CI linting, Python 3.10, Python 3.11, CodeQL ×2, codecov/patch, codecov/project, CodeRabbit).

Verdict

The fix is correct, minimal, and well-scoped. Tests now cover the failure mode that motivated the change.

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

This PR improves the bulk_update CLI UX by enforcing --query and --csv as required Click options, preventing None from reaching BulkUpdate.__init__ and causing hard-to-understand runtime errors.

Changes:

  • Mark --query and --csv as required=True in the bulk_update Click command.
  • Add/extend CLI tests to assert that omitting either option produces a Click usage error (exit code 2).
  • Make test teardown resilient when the temporary CSV file is missing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
falkordb_bulk_loader/bulk_update.py Enforces --query and --csv as required CLI options to fail fast with a usage error.
test/test_bulk_update.py Adds regression tests for missing required options and hardens teardown cleanup.

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

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