Repository navigation
Conversation
481364f to
e574841
Compare
1139d7b to
1c99e18
Compare
e574841 to
34a9189
Compare
1c99e18 to
f47f7f2
Compare
34a9189 to
abf34ad
Compare
cd6a25a to
cf3c8c3
Compare
abf34ad to
892bda9
Compare
cf3c8c3 to
47069c8
Compare
bd21790 to
2352fe9
Compare
47069c8 to
7c4b7c7
Compare
e7d5434 to
1fa97d9
Compare
7c4b7c7 to
2f3af66
Compare
e44fe4a to
141d960
Compare
2f3af66 to
10e3990
Compare
141d960 to
04671dd
Compare
10e3990 to
6941e61
Compare
04671dd to
696d422
Compare
6941e61 to
7c83f70
Compare
a64a6ad to
31ea49f
Compare
94528a9 to
4f06e53
Compare
31ea49f to
ea71187
Compare
4f06e53 to
6d4a47e
Compare
ea71187 to
e59b683
Compare
6d4a47e to
79afef1
Compare
e59b683 to
c499254
Compare
79afef1 to
c721652
Compare
c499254 to
06018e9
Compare
c721652 to
d867e12
Compare
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 9e703c8 | Docs | View more details | Give us feedback! |
7509268 to
eb7a6fb
Compare
d867e12 to
102e6e7
Compare
eb7a6fb to
92afaf2
Compare
102e6e7 to
cd32453
Compare
92afaf2 to
b71e121
Compare
cd32453 to
a779bfd
Compare
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
Optional-chain deletes incorrectly emit environment-read warnings instead of being excluded like plain deletes.
1 open issue
What changed in this PR
Adds warning-only checks for backend process.env reads, extending the apps plugin’s Node runtime checks to flag values unavailable in production.
Changes:
- Detects direct reads, destructuring, supported imports, and first-level
constaliases, with per-file warning deduplication. - Integrates warnings into shared backend static checks.
- Documents supported forms and adds unit and module-graph coverage.
| File | Description |
|---|---|
packages/plugins/apps/src/vite/dev-server-module-graph.test.ts |
Tests local-run warnings, deduplication, and dependency skips. |
packages/plugins/apps/src/backend/ast-parsing/warn-env-reads.ts |
Implements environment-read detection and warning reporting. |
packages/plugins/apps/src/backend/ast-parsing/warn-env-reads.test.ts |
Tests detection, exclusions, deduplication, and failure handling. |
packages/plugins/apps/src/backend/ast-parsing/run-backend-static-checks.ts |
Invokes the new warning check. |
packages/plugins/apps/src/backend/ast-parsing/run-backend-static-checks.test.ts |
Tests shared-check warning integration. |
packages/plugins/apps/src/backend/ast-parsing/ambient-global-access.ts |
Exports helpers reused by the detector. |
packages/plugins/apps/README.md |
Documents warnings, supported forms, and module exclusions. |
Review effort: Balanced
| }, | ||
| UnaryExpression(node) { | ||
| if (node.operator === 'delete') { | ||
| writtenMembers.add(node.argument); |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The Node backend runtime doesn't pass the developer's environment variables or Custom Credentials to backend functions, so a process.env.X read finds nothing in production, and nothing flagged it before upload. The static checks now warn, never fail, on direct process.env reads in app-local backend modules, once per file and use, naming the variable when the key is static: process.env.X and process.env[key], destructures of process.env, env or default process imports from process or node:process, and a const bound to process.env or to an env destructured from process. Writes, including destructuring and for...in/of targets, and deletes don't warn. Modules a backend file imports from node_modules or from outside the Vite root are skipped, so an SDK's own env reads don't warn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a779bfd to
9e703c8
Compare

Motivation
process.env.Xfinds nothing in production, and nothing flags the gap before upload. (APPS-2945, design)Architecture
flowchart TD T[".backend.* transform"] --> R["runBackendStaticChecks (app-local modules only)"] L["local run (module-graph walk)"] --> R V["vite build (nested backend build)"] --> R R --> M["rejectGlobalsMissingFromNode"] R --> W["warnAboutEnvReads"] W -->|"process.env.X, a destructure, an env import, a const alias"| K["warn: process.env.X"] W -->|"process.env[key], a rest destructure"| A["warn: process.env"] W -->|"writes, deletes, indirect forms"| N["no warning"]Changes
5 changes across warn-env-reads.ts, ambient-global-access.ts, run-backend-static-checks.ts, README.md and tests
warnAboutEnvReads, which warns on directprocess.envreads, naming static keys.warn-env-reads.tsambient-global-access.tsrun-backend-static-checks.tsREADME.mdwarn-env-reads.test.ts,dev-server-module-graph.test.tsQA Instructions
9e703c8ahttps://github.com/DataDog/build-plugins/actions/runs/40027770084Fixtures and staging runs
src/useEnv.backend.ts:src/useRestEnv.backend.ts:Blast Radius
process.envdirectly (NODE_ENVincluded) get newwarn-level log lines in builds and the dev server.Out of Scope / Follow-ups
1 item deferred
let/varor second-level aliases, nestedenvdestructures, namespace,default asand dynamic imports, re-exports, literal wrappers,.thencallbacks,Object.assign/Reflect,globalThis.process, for-of bindings, spreads,Object.keys,in.NODE_ENVand keys the file assigns itself still warn; warnings show once per file per dev-server processNODE_ENVif the runtime sets itDocumentation
🤖 Generated with Claude Code