fix: compare sponsor_info as bool instead of string#446
Open
fix: compare sponsor_info as bool instead of string#446
Conversation
Relates to github-community-projects/cleanowners#373 ## What Changed the sponsor_info gate in contributors.py from a string comparison (`== "true"`) to a truthy check, and updated the test mock to return a bool to match what get_bool_env_var actually returns. ## Why get_bool_env_var returns a Python bool, but the comparison checked for the string "true". Since `True == "true"` is always False, sponsor information was never fetched regardless of the SPONSOR_INFO env var setting. ## Notes - markdown.py already has `_is_truthy()` that handles both types, so the rendering side was not affected — only the data fetch was skipped. - json_writer.py passes sponsor_info through without comparison, so it's also unaffected. Signed-off-by: jmeridth <jmeridth@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Proposed Changes
Relates to github-community-projects/cleanowners#373
What
Changed the
sponsor_infogate incontributors.pyfrom a string comparison (== "true") to a truthy check, and updated the test mock to return a bool to match whatget_bool_env_varactually returns.Why
get_bool_env_varreturns a Pythonbool, but the comparison checked for the string"true". SinceTrue == "true"is alwaysFalsein Python, sponsor information was never fetched regardless of theSPONSOR_INFOenv var setting. This caused all contributors to show as "not sponsorable" in generated reports.Notes
markdown.pyalready has_is_truthy()that handles both types, so the rendering side was not affected — only the data fetch was skipped.json_writer.pypassessponsor_infothrough without comparison, so it's also unaffected.Testing
make test— all 64 tests pass, 99% coveragetest_main_fetches_sponsor_info_when_enabledto mocksponsor_infoasTrue(bool) instead of"true"(string), matching realget_bool_env_varreturn typehasSponsorsListingreturnstruefor an affected user (jmeridth) — confirming the issue is in the comparison, not the APIReadiness Checklist
Author/Contributor
make lintand fix any issues that you have introducedmake testand ensure you have test coverage for the lines you are introducing