Respect root bun.lock during frontend installs#6289
Respect root bun.lock during frontend installs#6289GautamBytes wants to merge 2 commits intoreflex-dev:mainfrom
Conversation
Greptile SummaryThis PR adds bun lockfile persistence for Reflex apps by treating the project-root
Confidence Score: 4/5Safe to merge; all remaining findings are P2 style and documentation concerns that do not affect correctness. Logic is sound and tests are comprehensive with no P0/P1 issues. Score is 4 rather than 5 because the private-API imports (_read_cached_procedure_file/_write_cached_procedure_file) create a coupling to reflex_base internals that could silently break on an internal refactor. reflex/utils/js_runtimes.py (private imports) and reflex/utils/frontend_skeleton.py (undocumented CWD assumption in get_root_bun_lock_path) Important Files Changed
Sequence DiagramsequenceDiagram
participant C as Caller
participant IR as install_frontend_packages
participant FS as frontend_skeleton
participant PM as PackageManager (bun/npm)
participant Cache as CacheFile
C->>IR: install_frontend_packages(packages, config)
IR->>IR: compute cache_payload (incl. bun lock SHA-256)
IR->>FS: sync_root_bun_lock_to_web()
FS-->>IR: root bun.lock mirrored to .web/ (or .web/bun.lock removed if no root)
IR->>Cache: _read_cached_procedure_file()
Cache-->>IR: (cached_payload, _)
alt cache hit (payload matches)
IR-->>C: return early
else cache miss
IR->>PM: remove stale packages (if any)
IR->>PM: bun install --legacy-peer-deps
opt development deps exist
IR->>PM: bun add -d dev-deps
end
opt custom packages exist
IR->>PM: bun add custom-packages
end
IR->>FS: sync_web_bun_lock_to_root()
FS-->>IR: .web/bun.lock persisted back to project root
IR->>Cache: _write_cached_procedure_file(new_payload)
IR-->>C: done
end
Reviews (1): Last reviewed commit: "Persist and respect root bun.lock" | Re-trigger Greptile |
All Submissions:
Type of change
Changes To Core Features:
Description
This PR fixes Bun lockfile persistence for Reflex apps by treating the project root
bun.lockas the canonical lockfile and mirroring it into.webbefore frontend package manager commands run.Without this change,
.web/reinitialization and frontend package installs could overwrite or ignore the effective Bun lockfile state, which meant users could not reliably commit and reuse Bun’s resolved dependency graph. That made it difficult to pin direct and transitive frontend dependencies.This change:
bun.lockbetween the app root and.web.web/bun.lockfrom the root lock during.webinitialization.web/bun.lockback to the root after successful Bun package operations.web/package.jsonwhen they are no longer desiredbun.lockshould live at the project root and be committed to version controlcloses #6268