fix(settings): validate CLICKHOUSE_MAX_MEMORY_USAGE instead of silently ignoring invalid values - #5135
Merged
Conversation
…ly ignoring invalid values
pedrofrxncx
enabled auto-merge (squash)
July 23, 2026 20:39
decocms Bot
pushed a commit
that referenced
this pull request
Jul 23, 2026
PR: #5135 fix(settings): validate CLICKHOUSE_MAX_MEMORY_USAGE instead of silently ignoring invalid values Bump type: patch - decocms (apps/mesh/package.json): 4.113.3 -> 4.113.4 Deploy-Scope: server
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.
Follows #5129 (PORT validation) and the same pattern applied to DUCKDB_THREADS in #5130 —
resolve-config.tshas more than one env var that silently swallows a bad value instead of failing loudly.clickhouseMaxMemoryUsagewas computed asNumber(envVars.CLICKHOUSE_MAX_MEMORY_USAGE) || undefined. Any non-numeric or invalid value ("abc","-1","1.5") silently producesNaNwhich then falls through|| undefined, so a typo in this env var quietly disables the ClickHouse memory-limit engine option in production instead of failing startup — the same failure mode PORT and DUCKDB_THREADS just got fixed for.Fix: added a
toPositiveIntegerOrUndefinedhelper (same shape as the existingtoPositiveIntegerOrDefaultused for PORT/DATABASE_POOL_MAX) and use it forCLICKHOUSE_MAX_MEMORY_USAGE. Unset/empty still resolves toundefined(unchanged default behavior —context-factory.ts'ssettings.clickhouseMaxMemoryUsage ? {...} : ...check is unaffected), but an invalid value now throws"CLICKHOUSE_MAX_MEMORY_USAGE must be a positive integer"at startup instead of being silently dropped.To verify:
bun test apps/mesh/src/settings/resolve-config.test.tsLocally ran:
bun run fmt,bunx tsc --noEmit(apps/mesh workspace), and the targeted test file above — all green. Full CI validates the rest.Summary by cubic
Validate
CLICKHOUSE_MAX_MEMORY_USAGEas a positive integer and fail fast on invalid values. This prevents silently disabling the ClickHouse memory limit.toPositiveIntegerOrUndefinedand used it forCLICKHOUSE_MAX_MEMORY_USAGE.undefined; invalid values now throw "CLICKHOUSE_MAX_MEMORY_USAGE must be a positive integer" at startup.resolve-config.test.ts.Written for commit 0205042. Summary will update on new commits.