fix(config): load rxconfig with cwd prepended - #6933
Conversation
… sys.path, racing concurrent first-time imports
_load_config cleared sys.path down to the cwd for the duration of the
rxconfig import, so any concurrent first-time import in another thread
failed with ModuleNotFoundError (e.g. the lazy granian import when the
backend starts while another thread loads the config). Prepending the cwd
keeps the same resolution priority without blinding other threads.
Dropping the clear also removes the except-retry fallback, which had been
papering over a second bug: find_spec("rxconfig") answers from sys.modules,
so a leftover module from another project directory faked the existence
probe. Evict rxconfig from sys.modules before probing instead.
Greptile SummaryThe PR changes config loading to prepend the current project directory without replacing the process-wide import path and introduces thread-scoped dependency recording.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/config.py | Reworks config import-path handling and dependency recording; the previously reported path-removal and meta-path-cleanup defects are fixed at the current head. |
| tests/units/test_config.py | Adds focused regression coverage for the config-loader concurrency and cleanup behavior. |
| packages/reflex-base/news/6933.bugfix.md | Documents the concurrent import-path failure and stale-config behavior addressed by the implementation. |
Reviews (7): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…y the inserted cwd entry
abulvenz
left a comment
There was a problem hiding this comment.
Thanks, nice finding. I would improve on the in-code-comment as annotated. In the tests those comments can help to understand why that test is needed.
Uh oh!
There was an error while loading. Please reload this page.