Skip to content

Fix Redis CLI default parsing in NEF#45

Open
Asesino-K wants to merge 2 commits intodbpedia:mainfrom
Asesino-K:fix-redis-cli-defaults
Open

Fix Redis CLI default parsing in NEF#45
Asesino-K wants to merge 2 commits intodbpedia:mainfrom
Asesino-K:fix-redis-cli-defaults

Conversation

@Asesino-K
Copy link

@Asesino-K Asesino-K commented Mar 16, 2026

This PR fixes a small CLI/runtime issue in GSoC25/NEF/NEF.py.

Previously, the Redis port argument default could fail during parsing when NEF_REDIS_PORT was unset or empty. This caused the CLI to raise a ValueError before the pipeline could run, even in cases where Redis parameters were intended to be provided explicitly.

This patch makes the Redis CLI defaults safer by using a proper fallback value instead of directly parsing an empty environment variable.

I encountered this issue while testing the current NEF pipeline locally.

Summary by CodeRabbit

  • Bug Fixes
    • Redis connection defaults now read from the environment with sensible fallbacks for host, port, and password, improving reliability when configuration is incomplete.
    • Added a parsing guard for the port value so invalid inputs fall back to the standard Redis port.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d594514d-843f-4486-a40c-6ebbe9cca081

📥 Commits

Reviewing files that changed from the base of the PR and between 9d60ab1 and ccaac7e.

📒 Files selected for processing (1)
  • GSoC25/NEF/NEF.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • GSoC25/NEF/NEF.py

📝 Walkthrough

Walkthrough

Redis CLI argument defaults now read from environment variables NEF_REDIS_HOST, NEF_REDIS_PORT, and NEF_REDIS_PASSWORD with fallbacks ("127.0.0.1", 6379, "") and include a parsing guard that falls back to 6379 if NEF_REDIS_PORT is present but not a valid integer.

Changes

Cohort / File(s) Summary
Redis CLI Configuration Defaults
GSoC25/NEF/NEF.py
Updated redis-host, redis-port, and redis-password CLI argument defaults to source NEF_REDIS_HOST, NEF_REDIS_PORT, and NEF_REDIS_PASSWORD with explicit fallbacks; added guard to parse NEF_REDIS_PORT as int and revert to 6379 if invalid.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 summarizes the main change: fixing Redis CLI default parsing in the NEF module by handling environment variables with proper fallbacks.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can validate your CodeRabbit configuration file in your editor.

If your editor has YAML language server, you can enable auto-completion and validation by adding # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json at the top of your CodeRabbit configuration file.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 `@GSoC25/NEF/NEF.py`:
- Around line 711-716: The parser currently calls int(redis_port_env) during
construction which raises ValueError for non-numeric env values; change the
logic that computes the default for --redis-port (the redis_port_env variable
and the p.add_argument("--redis-port", ...)) to safely parse the environment
value with a try/except (or a small helper like parse_int_env) and fall back to
6379 on any parsing error or empty/whitespace string so the CLI flag can still
override it; reference symbols: redis_port_env and the add_argument call for
"--redis-port".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 03021eab-4e0b-40a1-95a0-5dda8a7e9c08

📥 Commits

Reviewing files that changed from the base of the PR and between 3d07047 and 9d60ab1.

📒 Files selected for processing (1)
  • GSoC25/NEF/NEF.py

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