Refactor extension build process to use modular build steps#6867
Refactor extension build process to use modular build steps#6867alfonso-noriega wants to merge 1 commit into01-build-steps-infrastructurefrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
64d581f to
c4c3353
Compare
1c5c718 to
3ac919f
Compare
c4c3353 to
d2a2b21
Compare
2b6f7ba to
68c2a9f
Compare
d2a2b21 to
3837d71
Compare
8096aa6 to
f6ae0a0
Compare
794d3e0 to
75deab1
Compare
f6ae0a0 to
1b503e0
Compare
75deab1 to
feab6d2
Compare
1b503e0 to
01cfc8b
Compare
feab6d2 to
27b8cfc
Compare
01cfc8b to
048e70a
Compare
27b8cfc to
34005f5
Compare
048e70a to
c25acc0
Compare
4dd6917 to
56f0d4a
Compare
Coverage report
Test suite run success3860 tests passing in 1486 suites. Report generated by 🧪jest coverage report action from 4061625 |
8b922b5 to
38a9028
Compare
| import {bundleThemeExtension, copyFilesForExtension} from '../../services/extensions/bundle.js' | ||
| import {ExtensionBuildOptions, bundleFunctionExtension} from '../../services/build/extension.js' | ||
| import {bundleThemeExtension} from '../../services/extensions/bundle.js' | ||
| import {BuildContext, executeStep} from '../../services/build/build-steps.js' |
There was a problem hiding this comment.
Import target for build steps points to non-existent module (runtime crash)
ExtensionInstance imports BuildContext/executeStep from ../../services/build/build-steps.js, but that file does not exist in the repo. The actual implementation is packages/app/src/cli/services/build/client-steps.ts, which exports executeStep and BuildContext. This will fail Node ESM module resolution at runtime, breaking any command path that loads extension-instance.ts (build, deploy, etc.).
| context.stepResults.set(step.id, result) | ||
|
|
||
| if (!result.success && !step.continueOnError) { | ||
| throw new Error(`Build step "${step.displayName}" failed: ${result.error?.message}`) |
There was a problem hiding this comment.
Step shape mismatch: executor expects name, configs/build loop use displayName
The build loop references step.displayName for error messages, while the executor (client-steps.ts) expects a ClientStep with name and logs using step.name. Updated step specs appear to use displayName rather than name, which can result in logs like Executing step: undefined and unreliable routing/error reporting. If TypeScript is strictly enforced, this should fail typechecking; otherwise it degrades observability and debugging.
38a9028 to
a5303fd
Compare
1fa9fa8 to
174ca57
Compare
a5303fd to
0945d47
Compare
174ca57 to
9964055
Compare
0945d47 to
c468483
Compare
9964055 to
d835caf
Compare
c468483 to
067c371
Compare
067c371 to
be84850
Compare
d835caf to
57a0790
Compare
be84850 to
dd1d204
Compare
57a0790 to
316c2ab
Compare
e90a1b3 to
93493c9
Compare
|
These findings are in files not modified by this PR and cannot be posted as inline comments.
For Impact:
|
316c2ab to
a9d3692
Compare
93493c9 to
af69f6c
Compare
| break | ||
| const steps = clientSteps | ||
| .filter((lifecycle) => lifecycle.lifecycle === 'deploy') | ||
| .flatMap((lifecycle) => lifecycle.steps) |
There was a problem hiding this comment.
Crash when specification.clientSteps is missing/undefined
ExtensionInstance.build() now does:
const steps = clientSteps
.filter((lifecycle) => lifecycle.lifecycle === 'deploy')
.flatMap((lifecycle) => lifecycle.steps)If this.specification.clientSteps is undefined for any extension type (including internal/legacy specs not updated in this PR), this will throw: TypeError: Cannot read properties of undefined (reading 'filter').
Impact:
- Extension builds/deploys will hard-fail for any extension type missing
clientSteps, blocking development and deployments. - CI/release pipelines that build extensions will fail; could break deploys for affected extension types.
- Potentially broad depending on how many specs are migrated; PR only updates some specs so risk is high.
- Could cause widespread deployment failures.
a9d3692 to
ce4a75e
Compare
af69f6c to
4061625
Compare

Wire extension specifications to use client steps
Summary
This PR wires all extension specifications to use the
clientStepscontract introduced in #01-build-steps-infrastructure. Thebuild()method inExtensionInstanceis refactored from a hard-coded mode switch to a generic step execution loop, and every spec now declares its ownclientStepsarray.Depends on:
01-build-steps-infrastructureWhat changed
ExtensionInstance.build()— mode switch replaced by step loopBefore:
After:
The mode switch and all its direct function call imports (
buildThemeExtension,buildUIExtension,buildFunctionExtension,copyFilesForExtension) are removed. The step loop is uniform across all extension types.extension.ts—buildThemeExtensionremovedbuildThemeExtension()and itsrunThemeCheckimport are removed fromextension.ts— the logic now lives exclusively inbuild-theme-step.ts.Specs wired
All specs now declare
clientSteps. ThebuildConfig.modeis kept as a transitional field.UI extensions
Theme
Function
Tax calculation
Flow template
Channel
Tests added
Each spec now has a dedicated build test file asserting:
buildConfig.modeis correctclientStepshas the expected step structureextension.build()produces the correct output on disk (integration)ui_extension_build.test.tsbundle_ui+copy_static_assetsstepstheme.test.tsbuild_theme+bundle_themestepsfunction_build.test.tsbuild_functionstep delegates tobuildFunctionExtensiontax_calculation_build.test.tscreate_tax_stubwrites(()=>{})();flow_template.test.ts.flow/.json/.toml, not.js/.ts; preserves subdirschannel.test.tsspecifications/subdirectory intooutput/specifications/; filters by extensionFiles changed
models/extensions/extension-instance.tsbuild()rewritten to useexecuteSteploopservices/build/extension.tsbuildThemeExtension+runThemeCheckimportspecifications/ui_extension.tsclientStepsspecifications/checkout_post_purchase.tsclientStepsspecifications/checkout_ui_extension.tsclientStepsspecifications/pos_ui_extension.tsclientStepsspecifications/product_subscription.tsclientStepsspecifications/web_pixel_extension.tsclientStepsspecifications/theme.tsclientStepsspecifications/function.tsclientStepsspecifications/tax_calculation.tsclientStepsspecifications/flow_template.tsclientStepswithinclude_assetsconfigspecifications/channel.tsinclude_assetsscoped tospecifications/subdirectoryMeasuring impact
How do we know this change was effective? Please choose one:
Checklist