Skip to content

[build-tools] Load local composite function catalog at build runtime - #3930

Merged
sswrk merged 6 commits into
mainfrom
szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time
Jul 29, 2026
Merged

[build-tools] Load local composite function catalog at build runtime#3930
sswrk merged 6 commits into
mainfrom
szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time

Conversation

@sswrk

@sswrk sswrk commented Jul 1, 2026

Copy link
Copy Markdown
Member

Why

This PR stack adds local composite functions for EAS workflows (uses: ./.eas/functions/...). Earlier PRs define the schema, expand calls into steps, and wire inputs/outputs. The build runtime still needs to load those function.yml files from the project and pass them into StepsConfigParser.

This PR is the I/O layer: discover referenced local composite functions on disk, validate them, and hand the catalog to the parser for custom builds and generic jobs.

How

  • Adds catalog helpers in @expo/steps (buildCompositeFunctionCatalogFromStepsAsync, resolveLocalCompositeFunctionPath)
  • Adds packages/build-tools/src/steps/compositeFunctions.ts to resolve paths relative to the EAS project root, read function.yml / function.yaml, and validate with CompositeFunctionConfigZ
  • Wires the catalog into runCustomBuildAsync and runGenericJobAsync

Test Plan

Added unit tests for catalog loading and custom-build parse integration.

@linear-code

linear-code Bot commented Jul 1, 2026

Copy link
Copy Markdown

ENG-22387

sswrk commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 72189ae to 4764420 Compare July 1, 2026 16:50
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 10a8039 to 32e1305 Compare July 1, 2026 16:50
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 4764420 to 56ee52f Compare July 2, 2026 16:56
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 32e1305 to d95f9f7 Compare July 2, 2026 16:56
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.20%. Comparing base (ea32f67) to head (dee4cd3).

Files with missing lines Patch % Lines
...ckages/build-tools/src/steps/compositeFunctions.ts 90.00% 3 Missing ⚠️
packages/steps/src/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3930      +/-   ##
==========================================
+ Coverage   62.15%   62.20%   +0.05%     
==========================================
  Files         993      994       +1     
  Lines       44658    44716      +58     
  Branches     9403     9409       +6     
==========================================
+ Hits        27754    27812      +58     
- Misses      15455    15457       +2     
+ Partials     1449     1447       -2     

☔ 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-22387-build-tools-load-custom-action-catalog-at-build-time branch from d95f9f7 to e5d34d9 Compare July 3, 2026 13:43
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 56ee52f to e436769 Compare July 3, 2026 13:43
@sswrk sswrk changed the title [build-tools] Load custom action catalog at build runtime [build-tools] Load local action catalog at build runtime Jul 3, 2026
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from e5d34d9 to 4f20b26 Compare July 3, 2026 14:08
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from e436769 to 92fe812 Compare July 3, 2026 14:08
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 4f20b26 to d6b61d3 Compare July 3, 2026 14:46
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch 2 times, most recently from 3e774f9 to f74b6da Compare July 3, 2026 14:58
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from d6b61d3 to 00ab20d Compare July 3, 2026 14:58
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from f74b6da to b5be21a Compare July 3, 2026 15:40
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch 2 times, most recently from 506eea1 to 0eb9999 Compare July 3, 2026 15:48
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from b5be21a to 1e89296 Compare July 3, 2026 15:48
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 0eb9999 to b8bb5e0 Compare July 6, 2026 12:11
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 1e89296 to 4f79fdc Compare July 6, 2026 12:11
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 4f79fdc to 2190527 Compare July 6, 2026 13:23
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from b8bb5e0 to 6d1c11d Compare July 6, 2026 13:23
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-expand-custom-actions-at-parse-time branch from 2190527 to 8d70398 Compare July 6, 2026 13:51
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 6d1c11d to 899157c Compare July 6, 2026 13:51
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-resolve-action-outputs branch from ea64846 to 31f7032 Compare July 14, 2026 17:37
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch 2 times, most recently from 31e714c to 78b4981 Compare July 14, 2026 17:57
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-resolve-action-outputs branch 2 times, most recently from b1da672 to f8463eb Compare July 15, 2026 12:06
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch 2 times, most recently from a4a93c7 to 6dc8837 Compare July 15, 2026 12:43
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-resolve-action-outputs branch from f8463eb to 28fbfd1 Compare July 15, 2026 12:43
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from 6dc8837 to c64ad5c Compare July 15, 2026 12:51
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-steps-resolve-action-outputs branch from 28fbfd1 to 78a6801 Compare July 15, 2026 12:51
@sswrk
sswrk force-pushed the szymonswierk/eng-22387-build-tools-load-custom-action-catalog-at-build-time branch from c64ad5c to 63d2c7b Compare July 15, 2026 13:10

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@@ -0,0 +1,85 @@
/**
* Loads local function.yml files from the project and builds the catalog consumed by
* {@link StepsConfigParser}. Keeps filesystem I/O in build-tools; expansion logic lives in @expo/steps.

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 keeping filesystem io in build tools a goal for us?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a hard goal, just me being careful about not breaking any boundaries here. We could move this to steps, which would also help with the duplication between build-tools and eas-cli #3931 (comment) if you think that is okay

Comment thread packages/steps/src/utils/localCompositeFunctions.ts Outdated

@sjchmiela sjchmiela 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.

supposedly these two tests are going to fail

CompositeFunctionConfigZ.parse({ runs: { steps: [{ run: 'echo setup' }] } }),
});
expect(Object.keys(catalog)).toEqual([]);
});

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.

Suggested change
});
});
it('does not load composite functions beyond the maximum nesting depth', async () => {
const paths = Array.from({ length: 11 }, (_, index) => `./.eas/functions/a${index}`);
const loadCompositeFunction = jest.fn(async (compositeFunctionPath: string) => {
const index = paths.indexOf(compositeFunctionPath);
if (index === 10) {
throw new Error('function beyond maximum depth was loaded');
}
return CompositeFunctionConfigZ.parse({
runs: {
steps: [{ uses: paths[index + 1] }],
},
});
});
const catalog = await buildCompositeFunctionCatalogFromStepsAsync({
rootSteps: [{ uses: paths[0] }],
loadCompositeFunction,
});
expect(loadCompositeFunction).toHaveBeenCalledTimes(10);
expect(Object.keys(catalog)).toEqual(paths.slice(0, 10));
});
it('does not let an error beyond the maximum depth mask the nesting-depth error', async () => {
const paths = Array.from({ length: 11 }, (_, index) => `./.eas/functions/a${index}`);
const catalog = await buildCompositeFunctionCatalogFromStepsAsync({
rootSteps: [{ uses: paths[0] }],
loadCompositeFunction: async compositeFunctionPath => {
const index = paths.indexOf(compositeFunctionPath);
if (index === 10) {
throw new Error('missing composite function beyond maximum depth');
}
return CompositeFunctionConfigZ.parse({
runs: {
steps: [{ uses: paths[index + 1] }],
},
});
},
});
expect(Object.keys(catalog)).toEqual(paths.slice(0, 10));
});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not that bad if we let build-tools load those files that user intends to load. The depth limit is an expansion time concern and it's going to error there, so the logic stays isolated.

@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@sswrk

sswrk commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

Merged with 2 non-blocking open discussions to no longer block this feature. There are similar/related PRs coming with hooks support, so we can follow up there.

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.

2 participants