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 SummaryThis PR changes configuration 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. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/config.py | Reworks rxconfig loading and dependency recording while resolving the previously reported sys.path and meta-path cleanup failures. |
| tests/units/test_config.py | Adds regression coverage for concurrent imports, caller-owned path entries, dependency recording, and meta-path replacement. |
| packages/reflex-base/news/6933.bugfix.md | Documents the corrected concurrent-import and stale-rxconfig behavior. |
Reviews (5): Last reviewed commit: "more reviews" | 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.