Skip to content

Allow overriding files with Plugins, just warn about it#6471

Open
riebecj wants to merge 5 commits intoreflex-dev:mainfrom
riebecj:main
Open

Allow overriding files with Plugins, just warn about it#6471
riebecj wants to merge 5 commits intoreflex-dev:mainfrom
riebecj:main

Conversation

@riebecj
Copy link
Copy Markdown
Contributor

@riebecj riebecj commented May 7, 2026

This fixes a bug where any Plugin would not be able to override any compile-time files.

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

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 successfully ran tests with your changes locally?

@riebecj riebecj requested a review from a team as a code owner May 7, 2026 22:22
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

This PR changes how duplicate output paths are resolved during compilation: instead of keeping the first result and silently discarding later ones, it now always uses the last result and emits a warning. The intent is to let plugins override compile-time files.

  • compile_results loop now uses last-one-wins semantics with a warning, enabling plugins that contribute to compile_results to override earlier entries.
  • The get_static_assets() loop (lines 1253–1263) is unchanged — it still ignores the plugin file entirely when a conflict is detected, so plugins using the static-assets path still cannot override existing files.
  • pyi_hashes.json drops 119 package-level .pyi hash entries, retaining only 3 top-level reflex/ hashes (appears to be an unrelated restructuring side-effect).

Confidence Score: 3/5

The core compile_results change is straightforward, but the plugin override goal is only partially met — the static-assets code path still drops plugin files on conflict.

The fix achieves last-one-wins for the compile_results loop, but leaves the get_static_assets() loop unchanged. Plugins that attempt to override via static assets will still have their files silently ignored, which contradicts the stated fix. Merging as-is would leave users confused about why plugin overrides via static assets still do not work.

reflex/compiler/compiler.py — specifically the get_static_assets() loop at lines 1253–1263 that still prevents plugin overrides.

Important Files Changed

Filename Overview
reflex/compiler/compiler.py Changed duplicate-path handling in compile_results from "first wins" to "last wins" with a warning, but the parallel get_static_assets() loop still blocks plugin overrides entirely, leaving the stated goal only half-addressed.
pyi_hashes.json Removes 119 package-level .pyi hash entries (all packages/* paths), keeping only 3 top-level reflex hashes; likely a side-effect of restructuring packages out of the monorepo.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[compile_results loop] --> B{path in output_mapping?}
    B -- Yes --> C[warn: last one will be used]
    C --> D[output_mapping updated - last wins]
    B -- No --> D

    E[plugin get_static_assets loop] --> F{path in output_mapping?}
    F -- Yes --> G[warn: plugin file ignored - BUG NOT FIXED]
    F -- No --> H[output_mapping updated with plugin content]

    I[plugin modify_files_tasks loop] --> J[output_mapping updated via modify fn]

    D --> K[Write all files to Disk]
    H --> K
    G -.->|file dropped| K
    J --> K
Loading

Comments Outside Diff (1)

  1. reflex/compiler/compiler.py, line 1253-1263 (link)

    P1 Plugin static assets still can't override existing files

    The PR title says "Allow overriding files with Plugins, just warn about it," but get_static_assets() still silently ignores the plugin file when a conflict is detected (the else branch means the plugin never wins). The first loop now uses "last-one-wins" semantics after a warning, but this second loop keeps the old "first-one-wins/plugin-ignored" behavior, making plugin override via static assets still impossible.

Reviews (1): Last reviewed commit: "Allow overriding files with Plugins, jus..." | Re-trigger Greptile

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 7, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing riebecj:main (9d56e64) with main (1eed933)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants