Copy shared assets when a symlink cannot be created
All Submissions:
- Have you followed the guidelines stated in CONTRIBUTING.md?
- Have you checked to ensure there aren't any other open Pull Requests for the desired changed?
Type of change
- Bug fix (non-breaking change which fixes an issue)
Changes To Core Features:
- Have you added an explanation of what your changes do and why you'd like us to include them?
- Have you written new tests for your core changes, as applicable?
- Have you successfully ran tests with your changes locally?
Description
rx.asset(..., shared=True) links the asset into assets/external/ with a symlink. Where a symlink cannot be created (Windows without Developer Mode / the symlink privilege, or a filesystem without symlink support), symlink_to raises OSError and the app fails to compile, so any library using shared assets blocks reflex run.
_link_shared_asset now falls back to copying the asset when the symlink cannot be created. The copy goes through the same staged temp file and atomic replace as the link, so concurrent compiles stay safe, and the Windows replace-denied concession accepts an identical copy just as it accepts the same link. An existing copy with identical contents is left untouched, so file watchers see no change on recompile; a copy is rewritten when the source changes.
Tests: three new unit tests in tests/units/assets/test_assets.py (copy when symlinks are denied, up to date copy left alone, stale copy refreshed). They fail on main and pass with the change; the whole file passes (32 tests). ruff and pyright are clean. Changelog fragment added under news/.
Closes #5997