Skip to content

migrate all time env vars to timedelta - #7138

Open
benedikt-bartscher wants to merge 13 commits into
reflex-dev:mainfrom
benedikt-bartscher:migrate-envvar-timedelta
Open

benedikt-bartscher wants to merge 13 commits into
reflex-dev:mainfrom
benedikt-bartscher:migrate-envvar-timedelta

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

follow-up of #7131

Review in cubic

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge. No new actionable issue remains after the prior review.

What we checked:

  • SDK logs still reach Reflex: No. bootstrap puts every listed package logger under reflex, and the test checks that records keep flowing upward.
  • Test code cannot inject commands: No. The test runs one fixed string written in the source. It does not include user, file, network, or environment data.

Summary

Reflex now reads time-based environment variables as timedelta values, so settings can use units like 2m while bare numbers keep their old seconds meaning. Older names still work with one-time migration warnings, and deprecation messages now skip generated and frozen code locations.

  • Converts database, backend, websocket, reload, disk, and Redis timing settings to duration values.
  • Keeps old unit-named variables working while directing users to their replacements.
  • Makes deprecation locations skip generated interpreter frames.

Reviews (9) · Last reviewed commit: "Merge branch 'main' into migrate-envvar-..."

Comment thread reflex/istate/manager/redis.py Outdated
Comment thread reflex/app.py
@codspeed

codspeed Bot commented Sep 14, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.05%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 52 untouched benchmarks
⏩ 9 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
test_var_access[mutable_dict] 45.6 ms 47 ms -3.05%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing benedikt-bartscher:migrate-envvar-timedelta (f513515) with main (bc651dc)

Open in CodSpeed

Footnotes

  1. 9 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.

Comment thread reflex/istate/manager/redis.py Outdated
@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review September 14, 2026 18:45
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner September 14, 2026 18:45

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

No issues found across 13 files

Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/environment.py Outdated
masenf
masenf previously approved these changes Sep 14, 2026
masenf and others added 2 commits September 14, 2026 15:17
Review follow-ups for the timedelta migration of the duration env vars:

- Treat a blank value as unset, matching EnvVar semantics, so a templated
  `REFLEX_STATE_MANAGER_DISK_DEBOUNCE=` no longer shadows the old name and a
  blank old name no longer warns.
- Name the exact replacement in the deprecation message
  (`REFLEX_AUTO_RELOAD_COOLDOWN=5000ms`), since renaming the variable without
  its unit would silently read the value as seconds.
- Warn once per process rather than once per call site, and read the
  auto-reload cooldown during app setup so its deprecation shows at startup
  instead of on the first matching frontend error.
- Reject a negative opportunistic lock hold time instead of clamping it to
  one millisecond.
- Skip bracketed pseudo-filenames when locating the user frame for a
  deprecation. A code object with no source file carries `<string>` (exec, a
  generated dataclass `__init__`) or `<frozen importlib._bootstrap>` rather
  than a path, and both were reported as the deprecation's location.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gg8XKw3GThDkGC2L4y5ZSH

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

All reported issues were addressed across 10 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/environment.py Outdated
Comment thread packages/reflex-base/src/reflex_base/utils/log.py Outdated
- Build the suggested replacement from the parsed value rather than the raw
  text. A bare int or float accepts forms the duration parser rejects, so
  `REFLEX_STATE_MANAGER_DISK_DEBOUNCE_SECONDS=.5` suggested `.5s`, which fails
  to parse. `1_000` and `1e3` had the same problem.
- Skip only `<string>` and `<frozen ...>` when locating the user frame for a
  deprecation, instead of every bracketed name. `<stdin>` and an
  `<ipython-input-N-...>` cell are real user call sites, and swallowing them
  pushed the reported location up into the interpreter's own frames.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gg8XKw3GThDkGC2L4y5ZSH
Comment thread packages/reflex-base/src/reflex_base/utils/console.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

All reported issues were addressed across 10 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread packages/reflex-base/src/reflex_base/utils/console.py Outdated
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.

3 participants