Repository navigation
Point to repr() for printed backend vars; skip the storage factory check at runtime - #7818
Conversation
Since #7651, `str()` of a class-level backend var such as `State._secret` raises `BackendVarFormatError`, so `print()`, `%` formatting and logging of it in server code raise too, with a message that only talks about the UI. The error now ends with how to inspect the field there, and the unreleased #7651 changelog entry says that print and logging are affected. Found in the reflex 0.11.0a1 pre-release testing (FINDING-037). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi
The compile calls a str-compatible `default_factory` to reject one that produces browser storage. `_shared_storage_groups` reran the same compile step in every backend worker's first event, calling each such factory once more per worker. The runtime path now skips the factory call; the compile still checks. Found in the reflex 0.11.0a1 pre-release testing (FINDING-038). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi
[Medium impact] This PR appears safe to merge; no actionable issues were found. SummaryThis PR adds clearer advice for printing fields and avoids extra factory calls during backend events.
No actionable issues were found. Tests were inspected but not run during this review. Reviews (2) · Last reviewed commit: "Skip the storage default_factory check o..." · Reviewed by Greptile |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Merging this PR will degrade performance by 5.05%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi
|
On the CodSpeed report: Generated by Claude Code |
…eck at runtime (#7818) * Point to repr() when a backend var field is printed in server code Since #7651, `str()` of a class-level backend var such as `State._secret` raises `BackendVarFormatError`, so `print()`, `%` formatting and logging of it in server code raise too, with a message that only talks about the UI. The error now ends with how to inspect the field there, and the unreleased Found in the reflex 0.11.0a1 pre-release testing (FINDING-037). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi * Skip the storage default_factory check on the runtime path The compile calls a str-compatible `default_factory` to reject one that produces browser storage. `_shared_storage_groups` reran the same compile step in every backend worker's first event, calling each such factory once more per worker. The runtime path now skips the factory call; the compile still checks. Found in the reflex 0.11.0a1 pre-release testing (FINDING-038). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi --------- Co-authored-by: Claude <[email protected]> (cherry picked from commit 10dd495)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi
* Materialize changelogs for [email protected] (new-prerelease-minor) * Materialize changelogs for [email protected], [email protected], [email protected] (new-prerelease-minor) * Materialize changelogs for [email protected], [email protected], [email protected], [email protected] (new-prerelease-patch) * Materialize changelogs for [email protected] (new-prerelease-minor) * Carry the train's changelog edits for fragments changed after 0.11.0a1 #7818, #7816, #7800, #7806 and #7799 edited news fragments that the 0.11.0a1 materialization had already consumed. On the release train (r/pre-2026.11.11) those edits were folded into the matching 0.11.0a1 CHANGELOG.md entries when the fixes were cherry-picked; this carries the same edits to main, where the fragments are consumed by the materialization commits above. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi * Tidy the 0.11.0a1 changelog sections Dedupe entries that appeared in both reflex and reflex-base (SetVar, @rx.event, rx.client_state, awaitable handlers, foreach hooks, lazy libraries, blocking detection) and in reflex-components-core (foreach over set vars), keeping one entry in the reflex changelog. Merge entries for the same change: deploy_url default with the CORS change, React Compiler with auto_memoize, the reflex run shutdown and --json entries, the backend-var errors, the db page-evaluation fixes, and the Redis cancelled-handler fixes. Drop entries that fix features new in this alpha (blocking-monitor report, array ref names, middleware on awaited handlers, folded into the feature) or describe internals (stable ref names, AdminDashRemovedError), trim implementation narrative, and order each category by user impact. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ESN8DhETqtSLLtGDUeGGwV * Tidy the pending news fragments for the next 0.11 alpha Drop fragments that fix behavior new in 0.11.0a1 (awaitable handler returns and hints, @rx.event stacking, the storage factory check, the alembic env.py and page-evaluation regressions, the refs import, the same-origin proxy check, the auto_memoize warning) and fold what users need from them into the matching 0.11.0a1 changelog entries. Remove the reflex-base copies of fragments duplicated in reflex, the base half of the upload error fix (kept in components-core), the dependency-floor and docstring fragments, and merge the two DeclarativeBase detection fragments. Recast the reflex.model import fix as a performance entry and trim implementation detail from the rest. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ESN8DhETqtSLLtGDUeGGwV * Materialize changelogs for [email protected], [email protected], [email protected] (continued-prerelease) * Materialize the #7855 fragment under reflex-base 0.11.0a2 #7855 (Don't wait in Thread.join(timeout) when draining supervised output) merged to main after 0.11.0a2 was cut. It ships in 0.11.0, so its entry goes into the 0.11.0a2 section, which release-from-prerelease collapses into the final 0.11.0 section, and the fragment is consumed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi * Add the #7855 entry to the reflex-base 0.11.0a2 section The previous commit consumed the fragment but left the changelog edit unstaged; this adds the entry it was meant to carry. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi * Keep main's sibling floors instead of the train's alpha floors The alpha materializations raised the root and reflex-components-core floors to the train's alphas (reflex-components-core >= 0.11.0a1, ...). Those tags live on r/pre-2026.11.11 and are not reachable from main, so main's commits build the siblings as 0.10.2.devN / 1.1.2.devN, which check-min-deps rejects. Keep main's .dev0 floors; release-from-prerelease lifts each to the earliest published final once that sibling is tagged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dxjadq3qkhKnqZR2b9WBFi --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude <[email protected]>
Found in the reflex 0.11.0a1 pre-release testing (FINDING-037, FINDING-038).
These are two small client-vars fix-ups, one commit each. They touch separate files and can be split into two PRs if you prefer.
All Submissions:
Type of change
Changes To Core Features:
Description
FINDING-037: printing a class-level backend var in server code. Since #7651,
Field.__str__raisesBackendVarFormatError. Soprint(State._secret),str(),"%s" %and logging of a class-level backend var or mixin field in server code raise too, and the message only talks about the UI. This change keeps the behaviour (it is intentional) and makes two additions:Field._no_frontend_var_errornow ends every variant of the message with "To print or log the field itself in server code, use repr()."packages/reflex-base/news/+backend-var-literal-var.bugfix.md) now says thatprint()and logging in server code are affected and to userepr()there.FINDING-038: extra
default_factorycalls. The compile calls a str-compatibledefault_factoryto reject one that produces browser storage (#7582)._shared_storage_groupsreruns_compile_client_storage_recursivein each backend worker's first event (hydrate_and_load→_sync_shared_storage), so every such factory ran once more per worker._compile_client_storage_fieldand_compile_client_storage_recursivenow take a keywordcheck_factory/check_factories(default True), and the runtime path passes False. The compile still runs the check, so the one extra call per compile stays, as agreed.Tests
tests/units/reflex_base/vars/test_base.py::test_field_format_error_suggests_repr(backend, mixin, state-var field and unbound field):str(field)raises a message that ends with therepr()hint, andrepr(field)still works. It fails before the change.tests/units/test_state.py::test_shared_storage_groups_do_not_call_default_factories: a counting factory onstrandstr | Nonevars is not called by_shared_storage_groups, and the shared-name groups are unchanged. Before the change, the factory was called twice.uv run pytest tests/units --covpasses (81.4% coverage;tests/units/reflex_bench/drivers/test_browser.pywas skipped because Chromium is not installed here).ruff check,ruff formatandpyright reflex testsare clean.Generated by Claude Code