helm: fix dbStatementTimeout/dbPoolRecycle/dbPoolMaxOverflow silently dropped when set to 0#33865
Conversation
… dropped when set to 0
The webserver command template used `{{- with value }}` to include
--db-statement-timeout and related flags. Go's text/template treats the
integer 0 as falsy, so `with 0` is skipped entirely — preventing users
from disabling PostgreSQL's statement_timeout (which requires value 0).
Also, large integers such as 2147483647 were rendered in scientific
notation (2.147483647e+09) because Helm parses YAML integers as float64
and the default formatter switches to scientific notation past a
threshold.
Replace `with` with `if not (kindIs "invalid" ...)` to distinguish
between an unset (null) value and an explicitly provided zero. Pipe
the value through `int64` to guarantee decimal formatting for all
integer sizes.
Same fix applied to dbPoolRecycle and dbPoolMaxOverflow which have the
same pattern.
Fixes #33821
Greptile SummaryThis PR fixes a silent flag-suppression bug in the Dagster Helm chart where
Confidence Score: 5/5Targeted, well-understood fix with new tests that cover the exact failure modes; no regressions expected. The change is narrow: three lines in one template helper and two new test cases. The kindIs invalid idiom is the standard Helm/Sprig pattern for nil-vs-zero discrimination, and the int64 pipe cleanly handles float64-to-integer formatting. Existing passing tests exercise positive values; the new tests cover 0 and max-int32. No surrounding logic is altered. No files require special attention.
|
| Filename | Overview |
|---|---|
| helm/dagster/templates/helpers/_helpers.tpl | Replaces with (falsy-skips zero) with kindIs "invalid" guard and int64 pipe for three DB flag helpers — correctly emits 0 and formats large integers in decimal. |
| helm/dagster/schema/schema_tests/test_dagit.py | Adds two new parameterized tests covering zero-value flags and max-int32 large-value flags; coverage is correct and symmetric across all three DB flags. |
Reviews (2): Last reviewed commit: "test(helm): add zero-value and large-int..." | Re-trigger Greptile
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Problem
Setting
dagsterWebserver.dbStatementTimeout: 0in Helm values has no effect — the--db-statement-timeout 0flag never appears in the rendered webserver container args.Root cause: the template uses
{{- with value }}blocks, and Go'stext/templatetreats the integer0as falsy. Sowith 0skips the block entirely.0is a meaningful value for PostgreSQL'sstatement_timeout— it disables the timeout. Without this fix there is no way to pass--db-statement-timeout 0through the chart.The same bug affects
dbPoolRecycleanddbPoolMaxOverflow.A secondary issue: large integers like
2147483647(max int32) are rendered as2.147483647e+09because Helm parses YAML integers asfloat64and the default formatter switches to scientific notation at large values.Reproduce
Fix
Replace
{{- with value }}with{{- if not (kindIs "invalid" value) }}. ThekindIs "invalid"predicate returns true only for nil/null values, correctly distinguishing between "not set" (null/omitted) and "set to zero". Piping throughint64ensures decimal formatting for all integer magnitudes.Applied to all three flags:
dbStatementTimeout,dbPoolRecycle,dbPoolMaxOverflow.Fixes #33821