Skip to content

[build-tools] Load legacy command/path local functions and resolve module paths - #4097

Draft
sswrk wants to merge 1 commit into
szymonswierk/eng-25402-steps-expand-legacy-functionsfrom
szymonswierk/eng-25402-build-tools-load-legacy-functions
Draft

[build-tools] Load legacy command/path local functions and resolve module paths#4097
sswrk wants to merge 1 commit into
szymonswierk/eng-25402-steps-expand-legacy-functionsfrom
szymonswierk/eng-25402-build-tools-load-legacy-functions

Conversation

@sswrk

@sswrk sswrk commented Jul 27, 2026

Copy link
Copy Markdown
Member

Why

Build runners load referenced local functions from the checked-out project sources before parsing the job, so they need to understand the single-step shape added in #4095/#4096. A path function also needs its module directory resolved on the runner.

How

Parses function.yml with the widened LocalFunctionConfigZ and returns either shape.

For a path function, the module path is resolved against the function's own directory, mirroring how a .eas/build config resolves it against the config file, using the shared resolveLegacyFunctionModulePath helper. The loader fails early with a clear error naming both the literal path: value and the resolved location when the module directory or its package.json is missing. This check has to live here: single-step functions never join workflow.buildFunctions, so BuildWorkflowValidator.validateCustomFunctionModulesAsync will not see them.

The absolute path stays under projectSourceDirectory, so the existing source-to-target remap in createCustomFunctionCall keeps working exactly as it does for .eas/build functions. buildCompositeFunctionCatalogAsync and its callers (generic.ts, jobHooks.ts, custom.ts) need no changes; they delegate to the shared catalog builder.

Test Plan

cd packages/build-tools && yarn test src/steps/__tests__/compositeFunctions.test.ts

Loader tests: a command function loads with its inputs, outputs, shell and platforms; a path function's module path is rewritten to an absolute path under the function directory; a missing module directory and a module without package.json both fail fast; a catalog mixing composite and single-step functions loads; a config mixing both shapes reports the prettified error.

Also smoke-tested end to end against a scratch project: a command function with an input ran and set its output through set-output, and a path function using the prebuilt my-custom-ts-function fixture ran and set its outputs.

@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.
✅ Project coverage is 62.33%. Comparing base (096a5fd) to head (548b648).

Additional details and impacted files
@@                                   Coverage Diff                                    @@
##           szymonswierk/eng-25402-steps-expand-legacy-functions    #4097      +/-   ##
========================================================================================
+ Coverage                                                 62.32%   62.33%   +0.02%     
========================================================================================
  Files                                                       996      996              
  Lines                                                     44867    44881      +14     
  Branches                                                   9440     9443       +3     
========================================================================================
+ Hits                                                      27959    27973      +14     
  Misses                                                    15462    15462              
  Partials                                                   1446     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-build-tools-load-legacy-functions branch from 6ce77e0 to c468e34 Compare July 28, 2026 09:04
@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-build-tools-load-legacy-functions branch from c468e34 to d2e8524 Compare July 28, 2026 12:58
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch from 22be929 to a49aa69 Compare July 28, 2026 13:11
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-build-tools-load-legacy-functions branch 2 times, most recently from 5554d33 to 76e0f68 Compare July 28, 2026 15:30
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-steps-expand-legacy-functions branch 2 times, most recently from 0df6118 to 2e32e71 Compare July 29, 2026 09:01
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-build-tools-load-legacy-functions branch from 76e0f68 to 2da65a9 Compare July 29, 2026 09:01
@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-build-tools-load-legacy-functions branch from 2da65a9 to d1cc5f1 Compare July 29, 2026 09:29
@sswrk
sswrk force-pushed the szymonswierk/eng-25402-build-tools-load-legacy-functions branch from d1cc5f1 to 548b648 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

✅ Thank you for adding the changelog entry!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant