Skip to content

fix(credentials): align EnvVarStorage exists with load semantics#5680

Open
harshit110927 wants to merge 2 commits intoaden-hive:mainfrom
harshit110927:fix-credential-storage-clean
Open

fix(credentials): align EnvVarStorage exists with load semantics#5680
harshit110927 wants to merge 2 commits intoaden-hive:mainfrom
harshit110927:fix-credential-storage-clean

Conversation

@harshit110927
Copy link

Description

Fixes an inconsistency in EnvVarStorage where exists() and load() used different truthiness semantics for env values.
Now exists() treats empty values as absent, matching load() behavior.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Related Issues

Fixes #5388

Changes Made

  • Updated EnvVarStorage.exists() to return bool(self._read_env_value(env_var)).
  • Kept load() semantics unchanged (if not value: return None).
  • Added regression test test_exists_matches_load_for_empty_value to ensure consistency.

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (cd core && pytest tests/)
  • Lint passes (cd core && ruff check .)
  • Manual testing performed

Manual verification:

  • Confirmed load() returns None for empty values.
  • Confirmed exists() returns False for empty values.
  • Confirmed non-empty values remain available.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

N/A (no UI changes).

Add test to verify exists() and load() consistency for empty values in EnvVarStorage.
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.

[Bug]: EnvVarStorage.exists() can disagree with load() for empty env/.env values

1 participant