Skip to content

[Feature] Relative url patching on contract app extensions - #8362

Merged
EliasJRH merged 12 commits into
mainfrom
relative_lifecycle_url
Sep 22, 2026
Merged

EliasJRH merged 12 commits into
mainfrom
relative_lifecycle_url

Conversation

@EliasJRH

@EliasJRH EliasJRH commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Part of https://github.com/shop/issues-automate/issues/3352
Merge only after https://meteorite.shopify.io/repos/shop/world/pulls/2009553/files has merged

WHAT is this pull request doing?

We recently extended deployConfig with the capabilities of using application config info (primarily the application url) when deploying app extensions with local contracts (see #7715). This PR primarily extends this to extensions with remote contracts (in this PR, the Flow trigger lifecycle callback extension time).

How to test your changes?

Tested on flow-with-local-apps rig from flow zone.

  • Create Shopify app with "Flow trigger lifecycle callback" extension and "Flow trigger"
  • In the extensions toml file, make the url a relative path (e.g /realtive-path) with corresponding route file in /app/routes
  • With shopify app dev create and activate a Flow workflow using custom Flow trigger, observe that relative route file is hit in application logs
  • Deploy application with shopify app deploy, create and activate a Flow workflow using custom Flow trigger, observe that application url receives callback request at relative path

CI
dev test packages/app/src/cli/models/extensions/specifications/validation/app_relative_urls.test.ts packages/app/src/cli/models/extensions/specification.integration.test.ts packages/app/src/cli/services/flow/utils.test.ts -> 34 tests pass

Post-release steps

Will update "Flow trigger lifecycle callback" extension docs to include info about relative url support. Will also publish developer changelog entry.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct [bump type](minor bump type, backwards-compatible new feature)

@EliasJRH EliasJRH self-assigned this Aug 21, 2026
@EliasJRH
EliasJRH requested a review from a team as a code owner August 21, 2026 19:01
Copilot AI lite review requested due to automatic review settings August 21, 2026 19:01
@EliasJRH EliasJRH added the includes-post-release-steps PRs including this label require additional steps after releasing label Aug 21, 2026
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Aug 21, 2026

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 extends relative-URL support beyond locally-specified extensions by introducing shared URL resolution logic and applying it to contract-based modules (notably flow_trigger_lifecycle_callback), so relative URL fields can be resolved against the dev tunnel in app dev and against application_url during deploy.

Changes:

  • Introduces resolveAppRelativeUrl / patchAppRelativeUrls to centralize “app-relative URL” resolution and validation (HTTPS-only, blocks protocol-relative URLs and control characters).
  • Applies the shared resolver to Flow action URL fields and to contract-based module config patching (dev + deploy).
  • Adds/updates tests and a changeset documenting the new user-facing behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/app/src/cli/services/flow/validation.ts Reuses shared control-character regex for Flow action URL validation.
packages/app/src/cli/services/flow/utils.ts Removes Flow-action-specific URL resolution helper (now centralized elsewhere).
packages/app/src/cli/services/flow/utils.test.ts Removes tests for deleted resolveFlowActionUrl.
packages/app/src/cli/services/flow/types.ts Removes now-unused FlowActionUrlField type.
packages/app/src/cli/models/extensions/specifications/validation/app_relative_urls.ts Adds shared resolver/patcher for app-relative URLs and contract-module field mapping.
packages/app/src/cli/models/extensions/specifications/validation/app_relative_urls.test.ts Adds unit coverage for the shared resolver/patcher behavior and error cases.
packages/app/src/cli/models/extensions/specifications/flow_action.ts Switches Flow action URL resolution to shared resolveAppRelativeUrl.
packages/app/src/cli/models/extensions/specification.ts Hooks contract-based modules into app-relative URL patching in dev + deploy paths.
packages/app/src/cli/models/extensions/specification.integration.test.ts Adds integration coverage for contract-based module relative URL behavior.
packages/app/src/cli/models/app/validation/common.ts Adds shared URL_CONTROL_CHARACTERS and isHttpsUrl helpers.
.changeset/flow-trigger-lifecycle-callback-relative-url.md Declares the user-facing feature as a minor bump.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/app/src/cli/models/extensions/specification.ts Outdated
Comment thread packages/app/src/cli/models/app/validation/common.ts
Comment thread packages/app/src/cli/models/extensions/specification.ts Outdated
@EliasJRH
EliasJRH requested a review from a team as a code owner September 14, 2026 20:47
@EliasJRH
EliasJRH force-pushed the relative_lifecycle_url branch from 2f3194d to 4c4b682 Compare September 14, 2026 20:52
@EliasJRH
EliasJRH requested a review from dmerand September 15, 2026 17:47

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

Thanks for the changes! I have a few small comments left. Since this changes contract parsing, I'd love to see some dev/deploy tests on non-Flow cases. For example, admin-link extensions have remote contracts. And maybe an app with a wider variety of extension types, including other Flow extensions perhaps?

Comment thread packages/app/src/cli/models/extensions/specification.ts Outdated
Comment thread .changeset/flow-trigger-lifecycle-callback-relative-url.md Outdated
@EliasJRH

Copy link
Copy Markdown
Contributor Author

Thanks for the changes! I have a few small comments left. Since this changes contract parsing, I'd love to see some dev/deploy tests on non-Flow cases. For example, admin-link extensions have remote contracts. And maybe an app with a wider variety of extension types, including other Flow extensions perhaps?

Are you meaning to have admin-link extensions also make use of relative url patching?

@dmerand

dmerand commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for the changes! I have a few small comments left. Since this changes contract parsing, I'd love to see some dev/deploy tests on non-Flow cases. For example, admin-link extensions have remote contracts. And maybe an app with a wider variety of extension types, including other Flow extensions perhaps?

Are you meaning to have admin-link extensions also make use of relative url patching?

Nope, just to test this PR on an app with a variety of extension types to make sure no regressions have happened!

@github-actions github-actions Bot added Area: @shopify/app @shopify/app package issues and removed Area: @shopify/cli @shopify/cli package issues labels Sep 16, 2026
@EliasJRH

Copy link
Copy Markdown
Contributor Author

Thanks for the changes! I have a few small comments left. Since this changes contract parsing, I'd love to see some dev/deploy tests on non-Flow cases. For example, admin-link extensions have remote contracts. And maybe an app with a wider variety of extension types, including other Flow extensions perhaps?

Are you meaning to have admin-link extensions also make use of relative url patching?

Nope, just to test this PR on an app with a variety of extension types to make sure no regressions have happened!

Got it, thanks for the review!

@EliasJRH
EliasJRH requested a review from dmerand September 17, 2026 14:53

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

Thanks for the changes here!

@EliasJRH
EliasJRH added this pull request to the merge queue Sep 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 22, 2026
@EliasJRH

Copy link
Copy Markdown
Contributor Author

/merge

@EliasJRH
EliasJRH added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit ae83e94 Sep 22, 2026
30 checks passed
@EliasJRH
EliasJRH deleted the relative_lifecycle_url branch September 22, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/app @shopify/app package issues includes-post-release-steps PRs including this label require additional steps after releasing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants