Skip to content

[eas-build-job] Allow undefined env values#3900

Open
sjchmiela wants to merge 3 commits into
mainfrom
stanley/env-allows-undefined
Open

[eas-build-job] Allow undefined env values#3900
sjchmiela wants to merge 3 commits into
mainfrom
stanley/env-allows-undefined

Conversation

@sjchmiela

@sjchmiela sjchmiela commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Widens the shared build Env type to allow undefined values, matching Node/process env semantics where undefined entries can represent absent values.

Details

  • Changes Env to Record<string, string | undefined> in @expo/eas-build-job.
  • Allows ctx.reportError extras to contain undefined values for diagnostic metadata.
  • Updates strict string boundaries to explicitly require values where needed, such as GraphQL IDs and static context API URLs.
  • Filters undefined values out of displayRuntimeInfo string-only display maps.

Validation

CI should pass.

@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch 2 times, most recently from 3e474f6 to b14056d Compare June 25, 2026 13:29
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from b14056d to 36eb14c Compare June 25, 2026 13:37
@sjchmiela sjchmiela added the no changelog PR that doesn't require a changelog entry label Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.00000% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.04%. Comparing base (99fba8c) to head (1fcaa05).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ools/src/steps/functions/createSubmissionEntity.ts 11.12% 8 Missing ⚠️
...uild-tools/src/steps/functions/downloadArtifact.ts 16.67% 5 Missing ⚠️
...es/build-tools/src/steps/functions/restoreCache.ts 0.00% 1 Missing ⚠️
...kages/build-tools/src/steps/functions/saveCache.ts 0.00% 1 Missing ⚠️
packages/eas-cli/src/build/local.ts 50.00% 1 Missing ⚠️
packages/eas-cli/src/fingerprint/utils.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3900      +/-   ##
==========================================
+ Coverage   59.03%   59.04%   +0.01%     
==========================================
  Files         935      935              
  Lines       40931    40974      +43     
  Branches     8622     8632      +10     
==========================================
+ Hits        24158    24187      +29     
- Misses      16677    16691      +14     
  Partials       96       96              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sjchmiela sjchmiela requested a review from Copilot June 25, 2026 13:50
@sjchmiela sjchmiela marked this pull request as ready for review June 25, 2026 13:54
@sjchmiela sjchmiela requested a review from sswrk June 25, 2026 13:55

Copilot AI 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.

Pull request overview

This PR updates the shared Env type (from @expo/eas-build-job) to allow undefined values, aligning it with Node’s process.env semantics, and adjusts downstream code to explicitly require string values at strict boundaries (e.g., GraphQL IDs / API URLs) while filtering undefined where only strings are valid.

Changes:

  • Widen Env to Record<string, string | undefined> and propagate the type through eas-cli, build-tools, and worker code.
  • Add explicit “must be set” checks (via nullthrows) at strict boundaries like GraphQL ID variables and certain API URL usage.
  • Filter undefined values out of string-only env display maps, while allowing undefined in diagnostic metadata/extras.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/worker/src/displayRuntimeInfo.ts Filters undefined env values from displayed “public/instance” maps; allows undefined for secret FILE paths to surface missing values in logs.
packages/eas-cli/src/submit/context.ts Switches submission context env typing to shared Env.
packages/eas-cli/src/project/ios/target.ts Switches iOS target resolution env typing to shared Env.
packages/eas-cli/src/project/ios/entitlements.ts Switches entitlements resolution env typing to shared Env and passes it through to config resolution paths.
packages/eas-cli/src/fingerprint/utils.ts Switches fingerprint helper env typing to shared Env.
packages/eas-cli/src/build/local.ts Switches local build env typing to shared Env.
packages/eas-cli/src/build/createContext.ts Switches build context creation env typing to shared Env.
packages/eas-cli/src/build/context.ts Switches build context interface env typing to shared Env.
packages/eas-build-job/src/context.ts Makes expoApiServerURL optional in the static interpolation context.
packages/eas-build-job/src/common.ts Widens exported Env type to allow undefined values.
packages/build-tools/src/utils/expoUpdates.ts Ensures GraphQL query variables use a defined build ID (nullthrows).
packages/build-tools/src/steps/functions/saveCache.ts Requires expoApiServerURL to be present before cache upload calls.
packages/build-tools/src/steps/functions/restoreCache.ts Requires expoApiServerURL to be present before cache download calls.
packages/build-tools/src/steps/functions/downloadArtifact.ts Requires expoApiServerURL to be present before artifact download calls.
packages/build-tools/src/ios/fastlane.ts Switches fastlane runner env typing to shared Env.
packages/build-tools/src/context.ts Allows undefined values in reportError extras metadata.
packages/build-tools/src/common/projectSources.ts Ensures GraphQL mutation uses a defined build ID (nullthrows).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eas-build-job/src/context.ts
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from b5c5e54 to 45c3357 Compare June 26, 2026 10:52
@sjchmiela sjchmiela force-pushed the stanley/env-allows-undefined branch from 45c3357 to 1fcaa05 Compare June 26, 2026 11:14
@github-actions

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

Copilot AI 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.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.


export type Env = Record<string, string>;
export type Env = Record<string, string | undefined>;
export const EnvSchema = Joi.object().pattern(Joi.string(), Joi.string());
}
`),
{ id: ctx.env.EAS_BUILD_ID }
{ id: nullthrows(ctx.env.EAS_BUILD_ID, 'EAS_BUILD_ID is not set') }

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.

Is it safe to do nullthrows here? What about local builds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants