Skip to content

helm: fix dbStatementTimeout/dbPoolRecycle/dbPoolMaxOverflow silently dropped when set to 0#33865

Closed
vincere-mori wants to merge 2 commits into
dagster-io:masterfrom
vincere-mori:fix-helm-dbstatementtimeout-zero
Closed

helm: fix dbStatementTimeout/dbPoolRecycle/dbPoolMaxOverflow silently dropped when set to 0#33865
vincere-mori wants to merge 2 commits into
dagster-io:masterfrom
vincere-mori:fix-helm-dbstatementtimeout-zero

Conversation

@vincere-mori

Copy link
Copy Markdown

Problem

Setting dagsterWebserver.dbStatementTimeout: 0 in Helm values has no effect — the --db-statement-timeout 0 flag never appears in the rendered webserver container args.

Root cause: the template uses {{- with value }} blocks, and Go's text/template treats the integer 0 as falsy. So with 0 skips the block entirely.

0 is a meaningful value for PostgreSQL's statement_timeout — it disables the timeout. Without this fix there is no way to pass --db-statement-timeout 0 through the chart.

The same bug affects dbPoolRecycle and dbPoolMaxOverflow.

A secondary issue: large integers like 2147483647 (max int32) are rendered as 2.147483647e+09 because Helm parses YAML integers as float64 and the default formatter switches to scientific notation at large values.

Reproduce

# values.yaml
dagsterWebserver:
  dbStatementTimeout: 0
helm template dagster dagster/dagster -f values.yaml | grep db-statement-timeout
# expected: --db-statement-timeout 0
# actual:   (no output — flag is absent)

Fix

Replace {{- with value }} with {{- if not (kindIs "invalid" value) }}. The kindIs "invalid" predicate returns true only for nil/null values, correctly distinguishing between "not set" (null/omitted) and "set to zero". Piping through int64 ensures decimal formatting for all integer magnitudes.

Applied to all three flags: dbStatementTimeout, dbPoolRecycle, dbPoolMaxOverflow.

Fixes #33821

… 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-apps

greptile-apps Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a silent flag-suppression bug in the Dagster Helm chart where dbStatementTimeout, dbPoolRecycle, and dbPoolMaxOverflow were dropped from the rendered webserver command when set to 0, because Go's text/template treats integer 0 as falsy inside a with block. It also prevents large integers (e.g. max int32) from being rendered in scientific notation.

  • Template fix (_helpers.tpl): Replaces {{- with value }} with {{- if not (kindIs \"invalid\" value) }} for all three DB flags, and pipes each value through | int64 to guarantee decimal output.
  • Tests (test_dagit.py): Adds test_webserver_db_flags_zero_values and test_webserver_db_flags_large_values to cover the two previously broken cases across all three flags.

Confidence Score: 5/5

Targeted, 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.

Important Files Changed

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>
@vincere-mori vincere-mori closed this by deleting the head repository Jun 10, 2026
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.

Helm: dagsterWebserver.dbStatementTimeout: 0 is silently dropped due to with in template

1 participant