[INFRA-465] chore: add IS_SELF_MANAGED and AI usage env vars to plane-enterprise - #272
[INFRA-465] chore: add IS_SELF_MANAGED and AI usage env vars to plane-enterprise#272akshat5302 wants to merge 3 commits into
Conversation
- IS_SELF_MANAGED hardcoded to "0" in app-vars and pi-api-vars ConfigMaps - AI_USAGE_AGENT_MAX_TOKENS_BUDGET added to api and pi containers (default: empty) - AI_USAGE_ENFORCEMENT_ENABLED added to pi containers only (default: 1) - Bump chart version 3.0.0 → 3.0.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe Plane Enterprise Helm chart is bumped to version 3.0.1 and gains configurable AI usage settings. These values are exposed through chart questions and defaults, then rendered into application and PI API ConfigMaps. ChangesAI usage configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
Linked to Plane Work Item(s) References This comment was auto-generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml`:
- Line 162: Update the AI_USAGE_ENFORCEMENT_ENABLED template expression to
distinguish an explicitly configured false value from an unset value. Use hasKey
to select the configured env.pi_envs.ai_usage_enforcement_enabled value, and
apply the chart default only when that key is absent, while preserving the
existing ternary conversion and quoting.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 38bc90cc-90e5-4cb0-be3c-e4c4639369de
📒 Files selected for processing (5)
charts/plane-enterprise/Chart.yamlcharts/plane-enterprise/questions.ymlcharts/plane-enterprise/templates/config-secrets/app-env.yamlcharts/plane-enterprise/templates/config-secrets/pi-api-env.yamlcharts/plane-enterprise/values.yaml
|
|
||
| IS_SELF_MANAGED: "0" | ||
| AI_USAGE_AGENT_MAX_TOKENS_BUDGET: {{ .Values.env.pi_envs.ai_usage_agent_max_tokens_budget | default "" | quote }} | ||
| AI_USAGE_ENFORCEMENT_ENABLED: {{ .Values.env.pi_envs.ai_usage_enforcement_enabled | default true | ternary "1" "0" | quote }} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
helm template test charts/plane-enterprise \
--set services.pi.enabled=true \
--set env.pi_envs.ai_usage_enforcement_enabled=false |
rg 'AI_USAGE_ENFORCEMENT_ENABLED'
# Expected: AI_USAGE_ENFORCEMENT_ENABLED: "0"Repository: makeplane/helm-charts
Length of output: 197
🏁 Script executed:
#!/bin/bash
set -eu
printf 'Files matching config-secrets/pi-api-env.yaml:\n'
fd -a 'pi-api-env.yaml' . || true
printf '\nRelevant lines in file:\n'
if [ -f charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml ]; then
nl -ba charts/plane-enterprise/templates/config-secrets/pi-api-api-env.yaml 2>/dev/null || true
nl -ba charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml | sed -n '150,170p'
fi
printf '\nSearch for ai_usage_enforcement_enabled in repo:\n'
rg -n "ai_usage_enforcement_enabled|AI_USAGE_ENFORCEMENT_ENABLED" .Repository: makeplane/helm-charts
Length of output: 781
🌐 Web query:
Helm func default treats false as nil documentation
💡 Result:
The Helm default function, which is provided by the Sprig library, treats the boolean value false as "empty" [1][2]. Consequently, if you use default with a boolean value, it will replace an explicit false with the provided default value [3][4]. According to the official documentation, the definition of "empty" for the default function depends on the data type [1][5]: - Numeric: 0 - String: "" - Lists: [] - Dicts: {} - Boolean: false - Nil (null) Because false is classified as empty, {{ default true .Values.enabled }} will return true even if .Values.enabled is explicitly set to false [3][4]. To work around this behavior when you need to distinguish between a missing value and an explicit false, you can use one of the following approaches [6][4]: 1. Use the hasKey function to check if the value was explicitly provided in the values file [6][4]: {{- if hasKey.Values "enabled" }} enabled: {{.Values.enabled }} {{- else }} enabled: true {{- end }} 2. Use the kindIs function to check the type of the value [6]: {{- if kindIs "bool".Values.enabled }} enabled: {{.Values.enabled }} {{- else }} enabled: true {{- end }} 3. Use the ternary function in combination with hasKey [4]: enabled: {{ hasKey.Values "enabled" | ternary.Values.enabled true }}
Citations:
- 1: https://helm.sh/docs/chart_template_guide/function_list
- 2: http://masterminds.github.io/sprig/defaults.html
- 3: Default function evaluating the default value when the value provided is not omitted helm/helm#12781
- 4: https://stackoverflow.com/questions/74257084/how-to-pass-false-value-to-helm-default
- 5: https://helm.sh/docs/chart_template_guide/function_list/
- 6: default function treats boolean false as not defined, and applies default helm/helm#12080
🏁 Script executed:
#!/bin/bash
set -eu
echo "Relevant rendering line:"
awk 'NR>=150 && NR<=170 { printf "%6d%s\n", NR, $0 }' charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml
echo
echo "Values default:"
awk 'NR>=676 && NR<=684 { printf "%6d%s\n", NR, $0 }' charts/plane-enterprise/values.yamlRepository: makeplane/helm-charts
Length of output: 2229
🌐 Web query:
Helm sprig default false bool is empty ternary default true ternary
💡 Result:
The ternary function in Helm (provided by the Sprig library) is used to select between two values based on a boolean condition [1][2]. Its syntax is ternary "value_if_true" "value_if_false" condition [3][4]. Regarding your specific scenario where you want to default a boolean to true but correctly handle an explicit false value, the default function is often unsuitable because it treats false as "empty" (falsy) and will incorrectly replace it with your default value [5][6][7]. To handle this, you can use a combination of hasKey and ternary to check if the value was explicitly set [8][7]. Recommended pattern: {{ hasKey.Values "yourKey" | ternary.Values.yourKey true }} In this example: 1. hasKey .Values "yourKey" checks if the key exists in your values (even if it is false) [8][7]. 2. If it exists, ternary returns the actual value (.Values.yourKey, which may be true or false) [7]. 3. If it does not exist, ternary returns the second argument, which is your desired default (true) [7]. This approach avoids the "falsy" trap of the default function, which interprets false as a missing value [6][7].
Citations:
- 1: https://blog.petehouston.com/use-ternary-condition-in-helm/
- 2: https://helm.sh/docs/chart_template_guide/function_list
- 3: https://github.com/helm/helm-www/blob/main/versioned_docs/version-3/chart_template_guide/function_list.md
- 4: http://masterminds.github.io/sprig/defaults.html
- 5: Default function evaluating the default value when the value provided is not omitted helm/helm#12781
- 6: https://broersma.dev/til-helm-boolean-functions-and-falsy-ness/
- 7: https://stackoverflow.com/questions/74257084/how-to-pass-false-value-to-helm-default
- 8: default function treats boolean false as not defined, and applies default helm/helm#3308
Preserve -f for this boolean flag.
default treats false as empty, so --set env.pi_envs.ai_usage_enforcement_enabled=false renders AI_USAGE_ENFORCEMENT_ENABLED: "1". Use a hasKey + ternary fallback so chart defaults apply only when the value is unset.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@charts/plane-enterprise/templates/config-secrets/pi-api-env.yaml` at line
162, Update the AI_USAGE_ENFORCEMENT_ENABLED template expression to distinguish
an explicitly configured false value from an unset value. Use hasKey to select
the configured env.pi_envs.ai_usage_enforcement_enabled value, and apply the
chart default only when that key is absent, while preserving the existing
ternary conversion and quoting.
… in pi-api-env.yaml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Add new environment variables to the
plane-enterpriseHelm chart to align with the commercial deployment configs:IS_SELF_MANAGED— hardcoded to"0"in bothapp-vars(api) andpi-api-vars(pi-*) ConfigMaps. Cloud deployment is always0; novalues.yamlorquestions.ymlentry needed.AI_USAGE_AGENT_MAX_TOKENS_BUDGET— added toapp-vars(api) andpi-api-vars(pi-*); configurable viaenv.pi_envs.ai_usage_agent_max_tokens_budget, default: empty.AI_USAGE_ENFORCEMENT_ENABLED— added topi-api-vars(pi-* only); configurable viaenv.pi_envs.ai_usage_enforcement_enabled, default:true(renders as"1").3.0.0→3.0.1.Type of Change
Screenshots and Media (if applicable)
Test Scenarios
IS_SELF_MANAGED=0is present in theapipod environment (kubectl exec <api-pod> -- env | grep IS_SELF_MANAGED)AI_USAGE_AGENT_MAX_TOKENS_BUDGETis present in bothapiandpi-apipod environmentsAI_USAGE_ENFORCEMENT_ENABLED=1is present inpi-apipod but not inapipodenv.pi_envs.ai_usage_enforcement_enabled: falsein values and confirm the env renders as"0"helm lint— should pass with 0 failuresReferences
Generated with Claude Code
Summary by CodeRabbit
New Features
Chores