[HOTFIX] Bool-parse ENABLE_HIGHLIGHT_API_DEPLOYMENT env var (v0.161.4)#1939
Conversation
[FIX] Bool-parse ENABLE_HIGHLIGHT_API_DEPLOYMENT env var os.environ.get returns the raw string when the variable is set, so ENABLE_HIGHLIGHT_API_DEPLOYMENT="False" was truthy in Python (any non-empty string is truthy). Wrap in CommonUtils.str_to_bool so "False" / "false" / "0" actually evaluate to False. The setting is consumed by the cloud configuration plugin's spec default (ConfigSpec.default in plugins/configuration/cloud_config.py) on cloud and on-prem builds. With this fix, an admin who explicitly sets the env var to a falsy string sees highlight data stripped as expected. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
|
| Filename | Overview |
|---|---|
| backend/backend/settings/base.py | Wraps ENABLE_HIGHLIGHT_API_DEPLOYMENT env var read in CommonUtils.str_to_bool so string values like "False"/"false"/"0" evaluate as falsy; consistent with other boolean env vars in the file. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["os.environ.get(ENABLE_HIGHLIGHT_API_DEPLOYMENT, 'False')"] --> B["CommonUtils.str_to_bool()"]
B --> C{"string.lower() == 'true'?"}
C -- Yes --> D["True"]
C -- No --> E["False"]
D --> F["ENABLE_HIGHLIGHT_API_DEPLOYMENT = True"]
E --> G["ENABLE_HIGHLIGHT_API_DEPLOYMENT = False"]
Reviews (1): Last reviewed commit: "[HOTFIX] Bool-parse ENABLE_HIGHLIGHT_API..." | Re-trigger Greptile
|
* Change csp to report only * [HOTFIX] Bool-parse ENABLE_HIGHLIGHT_API_DEPLOYMENT env var (v0.161.4) (#1939) [HOTFIX] Bool-parse ENABLE_HIGHLIGHT_API_DEPLOYMENT env var (#1937) [FIX] Bool-parse ENABLE_HIGHLIGHT_API_DEPLOYMENT env var os.environ.get returns the raw string when the variable is set, so ENABLE_HIGHLIGHT_API_DEPLOYMENT="False" was truthy in Python (any non-empty string is truthy). Wrap in CommonUtils.str_to_bool so "False" / "false" / "0" actually evaluate to False. The setting is consumed by the cloud configuration plugin's spec default (ConfigSpec.default in plugins/configuration/cloud_config.py) on cloud and on-prem builds. With this fix, an admin who explicitly sets the env var to a falsy string sees highlight data stripped as expected. Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Deepak K <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>



Summary
v0.161.4-hotfixbase branch (originally rebased onv0.161.7by mistake).ENABLE_HIGHLIGHT_API_DEPLOYMENTenv var read inCommonUtils.str_to_boolso values like"False"/"false"/"0"are correctly evaluated as falsy.Why a new hotfix branch
The fix landed on
v0.161.7-hotfix(PR #1937) but was supposed to be cut fromv0.161.4. This PR re-targets the same change ontov0.161.4-hotfixfor the correct release line.Original commit
Test plan
ENABLE_HIGHLIGHT_API_DEPLOYMENT="False"evaluates toFalseinbackend/backend/settings/base.pyConfigSpec.defaulthonors the falsy valuev0.161.4-hotfixbase🤖 Generated with Claude Code