Skip to content

Add env var uppercase validation - #6815

Open
benedikt-bartscher wants to merge 2 commits into
reflex-dev:mainfrom
benedikt-bartscher:add-env-var-uppercase-validation
Open

Add env var uppercase validation#6815
benedikt-bartscher wants to merge 2 commits into
reflex-dev:mainfrom
benedikt-bartscher:add-env-var-uppercase-validation

Conversation

@benedikt-bartscher

Copy link
Copy Markdown
Contributor

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds strict uppercase-name validation to EnvVar.

  • Raises ValueError when an environment-variable name is not uppercase.
  • Adds unit coverage for accepted uppercase and rejected mixed/lowercase names.

Confidence Score: 4/5

The PR should not merge until the new validation provides a compatibility or deprecation path for existing users of non-uppercase EnvVar names.

The constructor is reachable through importable Reflex modules and now turns previously valid inputs into immediate ValueError failures, while the tests explicitly establish this hard rejection as the intended behavior.

Files Needing Attention: packages/reflex-base/src/reflex_base/environment.py

Important Files Changed

Filename Overview
packages/reflex-base/src/reflex_base/environment.py Adds unconditional uppercase validation, introducing a compatibility break for previously accepted constructor inputs.
tests/units/test_environment.py Adds focused parameterized tests covering the newly accepted and rejected name formats.

Reviews (1): Last reviewed commit: "format" | Re-trigger Greptile

Comment on lines +412 to +414
if not name.isupper():
msg = f"Environment variable name must be uppercase: {name!r}"
raise ValueError(msg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Hard break for existing names

When downstream code constructs EnvVar through reflex.config.EnvVar or reflex_base.environment.EnvVar with an existing lowercase or mixed-case name, this unconditional check raises ValueError, causing application initialization or startup to fail without the required deprecation and fallback period.

Context Used: CLAUDE.md (source)

Knowledge Base Used: Config and Environment System

@codspeed-hq

codspeed-hq Bot commented Jul 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing benedikt-bartscher:add-env-var-uppercase-validation (5844415) with main (416eb34)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review July 28, 2026 17:47
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner July 28, 2026 17:47
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

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.

1 participant