Skip to content

[steps] Expand legacy command/path local functions to a single build step - #4096

Draft
sswrk wants to merge 1 commit into
szymonswierk/eng-25402-eas-build-job-legacy-function-shapefrom
szymonswierk/eng-25402-steps-expand-legacy-functions
Draft

[steps] Expand legacy command/path local functions to a single build step#4096
sswrk wants to merge 1 commit into
szymonswierk/eng-25402-eas-build-job-legacy-function-shapefrom
szymonswierk/eng-25402-steps-expand-legacy-functions

Conversation

@sswrk

@sswrk sswrk commented Jul 27, 2026

Copy link
Copy Markdown
Member

Why

Makes the moved functions actually run. A workflow step calling a command or path function should behave the way it did in a .eas/build custom build.

Builds on #4095, which taught function.yml the single-step shape.

How

When a step references a local function whose function.yml declares command or path, the expander emits a single build step instead of expanding a step group, reusing the same BuildFunction.createBuildStepFromFunctionCall machinery that runs these functions in custom builds today. Because that method already accepts a composite function scope, calls work in job steps, in hooks, and from inside a composite function.

  • New utils/legacyFunction.ts maps the parsed config onto a BuildFunction. Legacy semantics are preserved: inputs and outputs are required unless declared otherwise (the composite shape keeps its required ?? false default for inputs), and supported_platforms is enforced by the existing step-level platform validation.
  • The function-level shell field now takes effect. In .eas/build configs it was parsed and stored but never applied to the step.
  • CompositeFunctionExpander.expandCompositeFunctionStep becomes expandLocalFunctionStep and returns flattened BuildStep[], dispatching on the shape, so CompositeBuildStep no longer leaks to call sites. A single-step function keeps the caller's own id (no caller__inner prefix) and takes the call-site if: as its own condition; there is no expansion scope to hang it on.
  • The catalog builder treats single-step functions as leaves (no steps to recurse into, so no cycle risk).
  • Adds the shared resolveLegacyFunctionModulePath helper used by the loaders in the next two PRs, so the module-path rewrite cannot drift between them.
  • working_directory on a step that calls a local function stays rejected for both shapes; the error message is now shape-agnostic. Widens CompositeFunctionCatalog to hold either shape.

Test Plan

cd packages/steps && yarn test

New StepsConfigParser-legacy-functions-test.ts covers expansion to exactly one step with the caller's id, display-name fallbacks, with: values reaching inputs, defaults, required-input and allowed_values validation, outputs via set-output and their visibility to later steps, supported_platforms enforcement, forwarded shell, a path function producing a step that calls the module, rejected working_directory, and calls nested inside a composite function (id outer__inner, ${{ inputs.* }} into with:, outputs visible to siblings and to the composite's output templates). Extends the hooks and catalog-builder suites.

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

ENG-25402

sswrk commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (szymonswierk/eng-25402-eas-build-job-legacy-function-shape@9d5f159). Learn more about missing BASE report.

Additional details and impacted files
@@                                      Coverage Diff                                      @@
##             szymonswierk/eng-25402-eas-build-job-legacy-function-shape    #4096   +/-   ##
=============================================================================================
  Coverage                                                              ?   62.32%           
=============================================================================================
  Files                                                                 ?      996           
  Lines                                                                 ?    44867           
  Branches                                                              ?     9440           
=============================================================================================
  Hits                                                                  ?    27959           
  Misses                                                                ?    15462           
  Partials                                                              ?     1446           

☔ 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.

@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from b77819d to b43b302 Compare July 28, 2026 09:04
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-eas-build-job-legacy-function-shape branch 2 times, most recently from 3b018d6 to 891ef23 Compare July 28, 2026 12:58
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch 2 times, most recently from 22be929 to a49aa69 Compare July 28, 2026 13:11
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-eas-build-job-legacy-function-shape branch 2 times, most recently from 27f53d7 to e8d69a0 Compare July 28, 2026 15:30
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from a49aa69 to 0df6118 Compare July 28, 2026 15:30
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-eas-build-job-legacy-function-shape branch from e8d69a0 to 702bea2 Compare July 29, 2026 09:01
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from 0df6118 to 2e32e71 Compare July 29, 2026 09:01
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-eas-build-job-legacy-function-shape branch from 702bea2 to 961f32c Compare July 29, 2026 09:28
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from 2e32e71 to 3ba680d Compare July 29, 2026 09:29
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-eas-build-job-legacy-function-shape branch from 961f32c to 9d5f159 Compare July 29, 2026 13:40
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from 3ba680d to 096a5fd Compare July 29, 2026 13:40
@github-actions

Copy link
Copy Markdown

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

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.

1 participant