Repository navigation
fix: load .env files for the Build Output's mode when --mode is omitted - #775
Conversation
commit: |
|
LGTM! |
|
| mean | stddev | min | max | |
|---|---|---|---|---|
| PR | 296.9 ms | 7.0 ms | 287.7 ms | 321.7 ms |
| base | 285.6 ms | 4.8 ms | 276.1 ms | 294.0 ms |
Δ (PR vs base): ↑ +11.3 ms (+4.0%)
Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.
There was a problem hiding this comment.
Superseded by the review of
503deb5f.
This review, of 165ea7cc
✅ Approved — No correctness, security or performance issues found. --local and --mode are still enforced at every call site, and each affected command has regression tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
The patch changeset matches the repository's convention for fixes. Release risk is moderate: deploys of builds made without --mode will now also load .env.production, which the changeset documents.
🔒 Security: ✅ LGTM
No security issues found.
📖 AGENTS.md: ✅ LGTM
The AGENTS.md addition is consistent with the code.
📋 Code Quality: ✅ LGTM
--local is still rejected by every caller. validateBuildOutputMode still runs, and the delegated build still runs before dotenv is applied. Each of the four commands has regression tests.
⚡ Performance: ✅ LGTM
No performance issues found.
📝 Documentation: ✅ LGTM
The changeset and the AGENTS.md note describe the new behavior accurately.
Reviewed commit: 165ea7cc
|
OK, scratch that. I misunderstood. |
We load the same files as the build (
I'm working on the follow up that makes a |
165ea7c to
503deb5
Compare
|
LGTM! |
There was a problem hiding this comment.
✅ Approved — No correctness, security or performance issues. --local and the --mode match are still enforced at every call site, and each affected command has regression tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🚀 Release: ✅ LGTM
Release risk is moderate. Deploys can now pick up mode-specific account and API-token values, which can change where a deploy goes. The changeset documents this, and regression tests cover all four commands.
🔒 Security: ✅ LGTM
The mode recorded in the Build Output is passed to the .env loader without being checked as a file name. That data comes from the project's own build. Anyone who can write it can already write the project's .env files and the deployed code, so no trust boundary is crossed.
📖 AGENTS.md: ✅ LGTM
The AGENTS.md note matches the code.
📋 Code Quality: ✅ LGTM
--local is still rejected by every caller, and validateBuildOutputMode still enforces the --mode match. The delegated build runs before dotenv values are applied. process.env is restored afterwards. The regression tests cover all four commands, including the merge with the base .env.
⚡ Performance: ✅ LGTM
No performance issues found.
📝 Documentation: ✅ LGTM
The changeset and the doc comment describe the new behavior accurately, including the --local wording.
Reviewed commit: 503deb5f
Load
.envfiles for the Build Output's mode when--modeis omittedcf deploy,cf workers versions create,cf workers triggers deploy, andcf previews deploynow load.env.<mode>and.env.<mode>.localfor the mode recorded in the Build Output when--modeis not passed. Previously they read only.envand.env.local, so deploying a staging build without repeating--mode stagingcould use the account and API token from.envinstead of.env.staging.Vite records its default
productionmode when a build runs without--mode, so these commands now also load.env.productionfor such builds, matching the files the build itself used. An explicit--modemust still match the recorded mode.