Add startup validation for required LFTP config fields (#310)#313
Add startup validation for required LFTP config fields (#310)#313nitrobass24 merged 3 commits intodevelopfrom
Conversation
Add _validate_config() to Controller that checks all required config fields are non-None at startup and raises ControllerError listing all missing fields. Also add backward-compat guard in _build_pair_contexts for when no path pairs are configured and remote_path/local_path are missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded startup validation to Controller: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/python/controller/controller.py`:
- Around line 348-352: The error message raised now uses a generic message even
when only one of Lftp.remote_path or Lftp.local_path is missing; update the
check in the controller (where it currently tests `remote_path is None or
local_path is None`) to compute which specific field(s) are missing (e.g., build
a missing_fields list for "remote_path" and "local_path") and raise
ControllerError with a message that names the exact missing field(s) (e.g.,
"Missing configuration: remote_path" or "Missing configuration: remote_path,
local_path") so users see the precise fallback(s) that are absent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4a7667bc-17a5-4487-a2ec-5749e079b771
📒 Files selected for processing (2)
src/python/controller/controller.pysrc/python/tests/unittests/test_controller/test_validate_config.py
Instead of a generic message when remote_path/local_path are unset, now names exactly which field(s) are missing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7aa9378 to
3c83762
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/python/controller/controller.py (1)
355-357:⚠️ Potential issue | 🟡 MinorFallback error text still implies both fields are missing.
At Line 356, the message says to set
remote_path and local_patheven when only one field is missing (the missing list at Lines 349-353 is already precise). Consider making the guidance field-agnostic.💡 Suggested wording adjustment
raise ControllerError( "No path pairs configured and {} not set. " - "Configure at least one path pair in Settings, or set remote_path and local_path.".format( + "Configure at least one path pair in Settings, or set the missing field(s).".format( ", ".join(missing) ) )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/python/controller/controller.py` around lines 355 - 357, The error string that uses ", ".join(missing) still instructs users to "set remote_path and local_path" even when only one field is missing; update the message construction around the join(missing) usage so the guidance is field-agnostic (e.g., reference the joined missing fields directly or say "set the missing field(s): {missing_fields}") and ensure the code path that builds this message (the variable/format call where missing is joined) emits the accurate, pluralized instruction rather than always naming both remote_path and local_path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/python/controller/controller.py`:
- Around line 355-357: The error string that uses ", ".join(missing) still
instructs users to "set remote_path and local_path" even when only one field is
missing; update the message construction around the join(missing) usage so the
guidance is field-agnostic (e.g., reference the joined missing fields directly
or say "set the missing field(s): {missing_fields}") and ensure the code path
that builds this message (the variable/format call where missing is joined)
emits the accurate, pluralized instruction rather than always naming both
remote_path and local_path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 833959b6-ccd5-4622-b12d-99159bf342bc
📒 Files selected for processing (1)
src/python/controller/controller.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
_validate_config()toControllerthat checks all required config fields (Lftp, Controller, General, AutoQueue, Args) are non-None at startup, raising a singleControllerErrorlisting all missing fields_build_pair_contextsfor when no path pairs are configured andremote_path/local_pathare unset, with a clear error messagetype: ignore[arg-type]comments on backward-compat path now that None is explicitly checkedCloses #310
Test plan
test_validate_config.pycovering:🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests