Repository navigation
Conversation
rx.asset(shared=True) links the asset into assets/external/ with a symlink. On Windows without the symlink privilege, or on a filesystem without symlink support, creating it raises OSError and the app cannot compile. Fall back to copying the asset through the same staged replace, and leave an up to date copy alone so file watchers see no change. Fixes reflex-dev#5997
Contributor
[Medium impact] The PR appears safe to merge; the previous SummaryShared assets fall back to copies when symlinks are unavailable.
No new actionable issues were found. Reviews (4) · Last reviewed commit: "Stage copy records outside the records d..." · Reviewed by Greptile |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Compare a fallback copy with its source byte by byte instead of with filecmp, whose cache misses a rewrite that keeps size and mtime. - When a replace is denied, accept the asset in place as either a link or a copy, so a concurrent compile that had to copy does not fail one that can link. - Record the source of each fallback copy under the web directory and remove copies whose source is gone, as broken symlinks already are.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
- Treat a record replace that Windows denies as done when the record already names the same source, and log rather than raise otherwise, since the record only enables cleanup. - Skip records still being staged under a temporary name, and tolerate records that disappear while cleanup runs. - Re-read a stale record just before deleting its copy, so a copy that a concurrent compile made from a new source is kept.
Skipping every record named *.tmp also skipped records of real shared assets with that suffix, so their copies were never cleaned up. Stage records in a sibling directory instead, which cleanup never scans.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Type of change
Changes To Core Features:
Description
rx.asset(..., shared=True)links the asset intoassets/external/with a symlink. Where a symlink cannot be created (Windows without Developer Mode / the symlink privilege, or a filesystem without symlink support),symlink_toraisesOSErrorand the app fails to compile, so any library using shared assets blocksreflex run._link_shared_assetnow 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 onmainand pass with the change; the whole file passes (32 tests). ruff and pyright are clean. Changelog fragment added undernews/.Closes #5997