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 configuration loading to preserve the process import path during
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/config.py | Reworks config import-path handling and dependency recording while resolving the previously reported cleanup and meta-path lifecycle failures. |
| tests/units/test_config.py | Adds focused regression coverage for concurrent configuration loading and import-system mutations. |
| packages/reflex-base/news/6933.bugfix.md | Documents the corrected config-loading and concurrent-import behavior. |
Reviews (10): Last reviewed commit: "Keep the rxconfig import recorder instal..." | 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.
|
Thanks for digging into this @benedikt-bartscher — the Where I'm less sure is And what it buys us seems fairly small? Worst case with the plain My inclination would be to land the Couple of smaller things while I'm looking:
Generated by Claude Code |
|
@masenf good push — you're right that "make it permanent" is a bad trade, but I think there's a third option I missed. The hazard is in-place mutation, not removal. So the recorder is now created per load and installed/removed by a pair of rebinds — nothing is left in On what it buys: I'd gently push back on "redundant re-import". Eviction is filtered to project-local modules, so what gets misattributed is an app module, and re-importing one of those isn't free: (the shadowing check in Other two are fixed: dep eviction moved above the |
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
|
Valid, and it invalidates what I said in my last comment — @masenf, flagging so you don't act on the wrong version. I claimed rebinding A permanent ModuleNotFoundError for every Worth noting the cost is the same shape as something already shipped: Also took @masenf's third point while I was in there — Regression test pins the invariant directly ( |
Uh oh!
There was an error while loading. Please reload this page.