Skip to content

Process persisted package json before web sync#6792

Open
harsh21234i wants to merge 2 commits into
reflex-dev:mainfrom
harsh21234i:fix/process-persisted-package-json-6765
Open

Process persisted package json before web sync#6792
harsh21234i wants to merge 2 commits into
reflex-dev:mainfrom
harsh21234i:fix/process-persisted-package-json-6765

Conversation

@harsh21234i

Copy link
Copy Markdown
Contributor

Summary

Fixes #6765.

This updates the root lockfile sync path so package.json is processed before being mirrored into .web/.

Previously, a stale or corrupted reflex.lock/package.json could be copied directly into .web/package.json, which
could drop Reflex-managed scripts like dev and export.

Changes

  • Add a dedicated package.json sync helper instead of treating it like a raw lockfile.
  • Re-render persisted package.json content through Reflex’s package JSON compiler.
  • Preserve the existing .web/package.json when no root persisted package.json exists.
  • Add regression coverage for both direct sync and frontend install repair behavior.

@harsh21234i
harsh21234i requested a review from a team as a code owner July 17, 2026 15:24
@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing harsh21234i:fix/process-persisted-package-json-6765 (3b29939) with main (2edaf12)

Open in CodSpeed

Footnotes

  1. 8 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.

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a bug where a stale or corrupted reflex.lock/package.json could be byte-copied directly into .web/package.json, potentially dropping Reflex-managed dev and export scripts. The fix re-routes the package.json sync through _compile_package_json(), which re-renders the file with guaranteed framework scripts rather than blindly mirroring it.

  • Adds sync_root_package_json_to_web() that renders the persisted root package.json through Reflex's template before writing it to .web/, replacing the former byte-copy path.
  • When no root persisted package.json exists, falls back to the previous no-op behaviour (web file preserved as-is).
  • Adds two regression tests: one for direct sync and one covering the frontend install repair path.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to the package.json sync path and the fallback for a missing root file preserves the existing no-op behaviour.

The new helper re-renders the persisted package.json through the same compiler used by initialize_package_json, so the framework-owned scripts are always guaranteed to be present. The fallback when the root file is absent is identical to the previous behaviour. Two regression tests cover both the direct sync case and the install-repair path. No unrelated code is touched.

No files require special attention.

Important Files Changed

Filename Overview
reflex/utils/frontend_skeleton.py Adds sync_root_package_json_to_web() that re-renders the persisted package.json via _compile_package_json() instead of byte-copying; sync_root_lockfiles_to_web updated to call it.
tests/units/test_prerequisites.py Adds two focused regression tests covering the direct sync and install-repair scenarios introduced by the fix.
news/6765.bugfix.md Changelog entry for the bugfix.

Reviews (2): Last reviewed commit: "Update reflex/utils/frontend_skeleton.py" | Re-trigger Greptile

Comment thread reflex/utils/frontend_skeleton.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

package.json is copied from reflex.lock/ to .web/ without processing

1 participant