Repository navigation
ENG-9148: feat(compiler): incremental compile cache & warm hot-reload daemon (REFLEX_COMPILE_CACHE) #6688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FarhanAliRaza
wants to merge
63
commits into
reflex-dev:main
Choose a base branch
from
FarhanAliRaza:reflex-hmr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+13,805
−359
Open
ENG-9148: feat(compiler): incremental compile cache & warm hot-reload daemon (REFLEX_COMPILE_CACHE) #6688
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
a453ccb
feat(compiler): add incremental compile cache (REFLEX_COMPILE_CACHE)
FarhanAliRaza 8360450
feat(compiler): warm fork-per-compile hot-reload daemon
FarhanAliRaza 7078d9e
perf(docs): build component prop-docs lazily at page eval
FarhanAliRaza 5ba6614
perf(compiler): trim compile-daemon hot reload
FarhanAliRaza fe06056
perf(compiler): shrink compile-cache manifest, drop in-process cache
FarhanAliRaza 9f1b1c2
refactor(compiler): drop unused page_cache helpers
FarhanAliRaza 43d5351
fix(compiler): track app-level config and memo imports in compile cache
FarhanAliRaza 19b2df4
test(compiler): skip model-metadata daemon test without sqlmodel
FarhanAliRaza aac67b2
docs(changelog): add news fragments for the incremental compile cache
FarhanAliRaza 519f885
feat(compiler): track runtime module imports in compile cache
FarhanAliRaza f79b9db
refactor(compiler): simplify page_cache module-file recording
FarhanAliRaza 451be1e
fix(compiler): guard read-tracker recursion on pathlib lazy imports
FarhanAliRaza 724cd3d
feat(compiler): track dynamic app-import reads for the compile cache
FarhanAliRaza 21e7d3e
fix(compiler): close staleness gaps in the incremental compile cache
FarhanAliRaza 14e5a3c
fix(compiler): make compile output deterministic so dev HMR stays gra…
FarhanAliRaza bf6a8bf
fix(compiler): keep contexts file and HMR intact across hot reloads
FarhanAliRaza 5cb52c5
perf(compiler): cut redundant work in the incremental compile path
FarhanAliRaza 6dbface
test(compiler): scope contexts snapshot to the test file's states
FarhanAliRaza 516d9fe
Merge remote-tracking branch 'upstream/main' into reflex-hmr
FarhanAliRaza 17a31ac
Merge remote-tracking branch 'origin/main' into reflex-hmr
masenf e765921
Merge remote-tracking branch 'upstream/main' into reflex-hmr
FarhanAliRaza 4cbe7b6
fix(compiler): emit user memo files for modules new to the compile cache
FarhanAliRaza 510f138
compile cache: make the warm fork real, watch with watchfiles, valida…
claude 7e38b65
compile cache: seed generated names per page so partial recompiles st…
claude e7242f5
compile cache: fix the daemon end to end on a real `reflex run`
claude 612118f
compile cache: probe lock/marker holder liveness without os.kill on W…
claude 8c11a8e
compile cache: gate on import-time state modules and surface cache fa…
FarhanAliRaza 085e816
Merge main and address incremental compile cache review findings
FarhanAliRaza 717aae2
compile cache: fix Windows unit-test failures
FarhanAliRaza 3888659
Merge branch 'main' of https://github.com/reflex-dev/reflex into refl…
FarhanAliRaza 83dedd1
compile cache: persist the import set after a memo-only rewrite
FarhanAliRaza f2bd03e
compile cache: key the manifest on compile mode and adopt evaluated p…
FarhanAliRaza 81c6235
Merge remote-tracking branch 'upstream/main' into pr-6688
FarhanAliRaza 2b45a6a
Fix cached state slices
FarhanAliRaza 470d72a
Merge upstream/main into reflex-hmr
FarhanAliRaza e4c64bf
fix(compiler): address compile cache review findings
FarhanAliRaza 52f16d8
fix(compile-daemon): own the daemon in the run scope and log through …
FarhanAliRaza bd16ff1
fix(compile-daemon): mark daemon ownership with OS locks, not pid files
FarhanAliRaza 9f52380
perf(compiler): predict dynamic state names, verify, retry exactly on…
FarhanAliRaza 6c5457e
test: wait for OS lock cleanup after killed holders exit
masenf 93b2ce7
fix(compiler): let a page gain or lose states without a full compile
FarhanAliRaza 7f62b86
perf(compiler): rebuild the app root from recorded inputs, not a full…
FarhanAliRaza 994ce69
perf(compiler): fail a name prediction only on families other pages s…
FarhanAliRaza 966280e
perf(compiler): add, remove and re-register pages without a full compile
FarhanAliRaza 53b16f9
perf(compiler): rebuild the contexts for module-level state edits, no…
FarhanAliRaza 5ba0f85
perf(compiler): predict ComponentState instance numbers per page
FarhanAliRaza 2ce8c71
perf(compile-daemon): clear only the model registries the parent loaded
FarhanAliRaza 564c32c
perf(compiler): track a page's own module by the code its function reads
FarhanAliRaza 90fa2e8
perf(compiler): predict dynamic state names in cold compiles too
FarhanAliRaza a51e8b2
fix(compiler): address compile cache review findings
FarhanAliRaza 1354854
test(compiler): advance timestamps for slice digest edits
masenf 98e0259
Retry compile-input record replacement blocked by Windows readers
masenf 0d40332
fix(compiler): address second round of compile cache review findings
FarhanAliRaza a8f05fb
fix(compiler): keep the compile manifest consistent with uncached output
FarhanAliRaza 3565bb6
fix(compiler): watch every recorded input; stop aborting a released b…
FarhanAliRaza 1a465cb
fix(compiler): attribute reads to modules, mark racy edits, track mor…
claude b88452e
refactor(compiler): content-addressed auto memos; app root and page s…
claude 8894621
fix(compiler): deterministic generated names across import, pages, st…
claude 0d144dc
fix(compile-daemon): keep library-created dynamic states, private byt…
claude 495a0ef
fix(compile-daemon): load the manifest once per reset; a restarted da…
claude faed563
fix(compile-cache): address Greptile's four P1 findings
FarhanAliRaza 396f418
fix(compile-cache): address cubic's review of the recent commits
FarhanAliRaza 9752de1
test(memo): let React Compiler compile the derived-count memo
FarhanAliRaza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """Regression coverage for stable property-control identities.""" | ||
|
|
||
|
|
||
| def test_prop_ids_do_not_depend_on_evaluation_order(): | ||
| """Partial page compiles must reuse the same state variable names.""" | ||
| from reflex_docs.pages.docs.component import get_id | ||
|
|
||
| first = get_id("module.Button.size") | ||
| other = get_id("module.Text.size") | ||
| expanded = get_id("module.Button.size.expanded") | ||
| assert get_id("module.Button.size") == first | ||
| assert len({first, other, expanded}) == 3 | ||
|
|
||
|
|
||
| def test_repeated_prop_controls_reuse_their_state_variable(): | ||
| """The same component documented twice can share its stable control ID.""" | ||
| from typing import Literal | ||
|
|
||
| import reflex as rx | ||
| from reflex_components_radix.themes.components.button import Button | ||
| from reflex_docgen import PropDocumentation | ||
|
|
||
| from reflex_docs.pages.docs.component import prop_docs, render_select | ||
|
|
||
| prop = PropDocumentation( | ||
| name="size", | ||
| type=rx.Var[Literal["1", "2", "3"]], | ||
| description="Long description " * 20, | ||
| default_value="1", | ||
| ) | ||
| first = {} | ||
| second = {} | ||
| render_select(prop, Button, first) | ||
| render_select(prop, Button, second) | ||
| assert str(first["size"]) == str(second["size"]) | ||
| assert prop_docs(prop, Button)[2] == prop_docs(prop, Button)[2] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Avoid Windows hot-reload failures when a backend worker briefly holds the compile-input record open. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Compiler-generated memo components (the auto-memoized stateful subtrees) now compile to one file each under `.web/utils/components/`, named by their content, instead of one file per source module under `.web/app_components/`; identical subtrees anywhere in the app share one file. `@rx.memo` components keep mirroring their source modules. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added an experimental incremental compile cache, enabled with `REFLEX_COMPILE_CACHE=1`. A compile reuses the previous build in `.web` and recompiles only the pages whose inputs changed, and `reflex run` keeps a warm compile daemon so a hot reload rebuilds only what the edit touched. Off by default. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added an optional per-page source-read recorder hook (`page_source_recorder` in the compiler plugin) used by the incremental compile cache to track the exact files each page reads during evaluation. Auto-generated unique ref names are now reproducible: each page draws them from a sequence seeded by its route, a state's default values from one seeded by the state's name, and whatever compiles after the pages from a sequence that never repeats a name drawn at import. Sets are sorted in compiled literals only; a state delta serializes a set as a plain list again. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.