migrate all time env vars to timedelta - #7138
benedikt-bartscher wants to merge 11 commits into
Conversation
|
Merging this PR will not alter performance
Comparing Footnotes
|
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
There was a problem hiding this comment.
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
- 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
| if filename == "<string>" or filename.startswith("<frozen "): | ||
| return True |
There was a problem hiding this comment.
This skips only
<string> and <frozen ...>. A generated frame such as <attrs generated init reflex.Thing> reaches Path.resolve(), so _get_first_non_framework_frame stops there and reports a fake file. Keep interactive names as user frames, but skip other generated bracketed names. Apply the same fix in log.py.
There was a problem hiding this comment.
1 issue found across 10 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/reflex-base/src/reflex_base/utils/console.py">
<violation number="1" location="packages/reflex-base/src/reflex_base/utils/console.py:363">
P2: Skip generated bracketed filenames such as `<attrs generated init reflex.Thing>` before calling `Path.resolve()`, and apply the same predicate in `log.py`. Otherwise deprecation lookup reports the generated pseudo-frame as a fake user file.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| # would depend on where the app was started from. Other bracketed names are | ||
| # left alone on purpose: `<stdin>` and an `<ipython-input-N-...>` cell are | ||
| # exactly where an interactive user would look for their own call. | ||
| if filename == "<string>" or filename.startswith("<frozen "): |
There was a problem hiding this comment.
P2: Skip generated bracketed filenames such as <attrs generated init reflex.Thing> before calling Path.resolve(), and apply the same predicate in log.py. Otherwise deprecation lookup reports the generated pseudo-frame as a fake user file.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/reflex-base/src/reflex_base/utils/console.py, line 363:
<comment>Skip generated bracketed filenames such as `<attrs generated init reflex.Thing>` before calling `Path.resolve()`, and apply the same predicate in `log.py`. Otherwise deprecation lookup reports the generated pseudo-frame as a fake user file.</comment>
<file context>
@@ -353,6 +353,15 @@ def _is_framework_filename(filename: str) -> bool:
+ # would depend on where the app was started from. Other bracketed names are
+ # left alone on purpose: `<stdin>` and an `<ipython-input-N-...>` cell are
+ # exactly where an interactive user would look for their own call.
+ if filename == "<string>" or filename.startswith("<frozen "):
+ return True
frame_path = Path(filename).resolve()
</file context>
follow-up of #7131