Skip to content

Log why npm is used when only package-lock.json is persisted - #7305

Merged
masenf merged 3 commits into
reflex-dev:mainfrom
flcrom:fix/npm-lockfile-selection-log
Sep 30, 2026
Merged

masenf merged 3 commits into
reflex-dev:mainfrom
flcrom:fix/npm-lockfile-selection-log

Conversation

@flcrom

@flcrom flcrom commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7093

After a successful run with REFLEX_USE_NPM=1, reflex.lock/ holds package-lock.json and no bun.lock, so later runs keep picking npm even with the env var unset. That's intended (committing only package-lock.json opts a project into npm), but nothing says it's happening.

This logs a single info line when npm is picked only because of the persisted lockfile, pointing at REFLEX_USE_NPM=0 to switch back. An explicit REFLEX_USE_NPM stays silent. Selection logic is unchanged; the switch-back itself already works since #7129 drops the stale npm lock when bun runs.

Tested with the unit suite (tests/units), ruff, codespell and pyright on the changed files.

Review in cubic

AI help: used for parts of this change.

@flcrom
flcrom requested a review from a team as a code owner September 24, 2026 10:12
@flcrom
flcrom force-pushed the fix/npm-lockfile-selection-log branch from a8330da to dd0f1c6 Compare September 24, 2026 10:12

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread reflex/utils/js_runtimes.py Resolved
@greptile-apps

greptile-apps Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Adds a diagnostic log message for package manager selection.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR adds a once-per-lock-directory explanation when a persisted npm lockfile causes Reflex to prefer npm. It also adds coverage for implicit and explicit selection and a changelog fragment. No actionable new issue was identified.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into fix/npm-lockfil..."

@codspeed

codspeed Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 5.19%

⚡ 1 improved benchmark
✅ 146 untouched benchmarks
⏩ 17 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_state_access[read_cached_computed] 248.1 ms 235.9 ms +5.19%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing flcrom:fix/npm-lockfile-selection-log (f2be5d9) with main (47187ef)

Open in CodSpeed

Footnotes

  1. 17 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. ↩

@masenf masenf added the on deck PRs lined up to review / merge next label Sep 30, 2026

@masenf masenf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing

@masenf
masenf enabled auto-merge (squash) September 30, 2026 20:13
@masenf
masenf merged commit 5d969cc into reflex-dev:main Sep 30, 2026
145 of 146 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

on deck PRs lined up to review / merge next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REFLEX_USE_NPM=1 silently persists the npm choice after the environment variable is removed

2 participants