Skip to content

fix(cli): don't let CLI defaults override REDIS_ENTRAID_* env config - #208

Merged
vchomakov merged 1 commit into
redis:mainfrom
pcbeingused333:fix/entraid-cli-defaults-207
Nov 27, 2026
Merged

vchomakov merged 1 commit into
redis:mainfrom
pcbeingused333:fix/entraid-cli-defaults-207

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #207

Cause

In src/main.py, --entraid-identity-type, --entraid-scopes, --entraid-resource, --entraid-token-refresh-ratio, --entraid-retry-max-attempts and --entraid-retry-delay-ms declared Click defaults. They always had a value, so cli() always forwarded them to set_entraid_config_from_cli, which overwrote what ENTRAID_CFG had read from REDIS_ENTRAID_*. For example, REDIS_ENTRAID_IDENTITY_TYPE=user_assigned was silently reset to system_assigned.

Fix

Same approach as #206: remove the six Click defaults, so an option is only forwarded when it is actually given (the existing checks in cli() already skip None). Help text now mentions the env var and the effective default. The defaults themselves stay in ENTRAID_CFG in src/common/config.py.

Tests

Two new tests in tests/test_main.py: no unset --entraid-* option reaches set_entraid_config_from_cli, and env-derived ENTRAID_CFG values survive an invocation without flags. Both fail before the change and pass after. The full test suite passes (378 tests), and ruff check / ruff format --check are clean.

Disclosure

This change was prepared with the assistance of an AI tool (Claude Code).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.61%. Comparing base (faeb09f) to head (07eb7db).
⚠️ Report is 57 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #208      +/-   ##
==========================================
- Coverage   88.20%   87.61%   -0.60%     
==========================================
  Files          19       19              
  Lines        1060     1122      +62     
==========================================
+ Hits          935      983      +48     
- Misses        125      139      +14     
Flag Coverage Δ
unittests 87.61% <ø> (-0.60%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.

@vchomakov

Copy link
Copy Markdown
Member

Thanks for following up on #207. Verified locally: with the REDIS_ENTRAID_* variables set and no flags, all six values are now kept, and explicit flags still override them, including --entraid-retry-max-attempts 0. The two new tests fail on main and pass here. LGTM.

@vchomakov
vchomakov merged commit 2ef4732 into redis:main Nov 27, 2026
19 checks passed
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.

--entraid-* CLI defaults silently override REDIS_ENTRAID_* env vars

3 participants