cli icon indicating copy to clipboard operation
cli copied to clipboard

added a name field to webhook subscriptions

Open georgge293 opened this issue 1 month ago β€’ 6 comments

closes https://github.com/shop/issues-event-foundations/issues/518

WHY are these changes introduced?

Adds support for the name field on webhook subscriptions when registered in the app's shopify.app.toml

WHAT is this pull request doing?

  • Adds optional name field to webhook subscription TypeScript types
  • Adds validation for the name field in webhook subscription schemas (must be a non-empty string if provided)
  • Adds test coverage for webhook subscriptions with the name attribute

Name validation:

  • Field is optional
  • Must be a non-empty string if provided

How to test your changes

  1. Create a webhook subscription in your shopify.app.toml with a name field while running local app development in dev dash:

Example:

[[webhooks.subscriptions]]
name = "products-create"
topics = ["products/create"]
uri = "https://example.com/webhooks"
  1. Run shopify app deploy and verify it accepts the configuration
  2. Try with an empty name = "" and verify validation rejects it
  3. Run the test suite: pnpm vitest loader.test.ts --run

Tophat:

  • [x] Tophatted changes locally verifying that the min and max char validations are working

georgge293 avatar Nov 05 '25 16:11 georgge293

We detected some changes at packages/*/src and there are no updates in the .changeset. If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.

[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

github-actions[bot] avatar Nov 05 '25 16:11 github-actions[bot]

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
79.51% (+0.28% πŸ”Ό)
14177/17830
🟑 Branches
73.57% (+0.46% πŸ”Ό)
6952/9450
🟑 Functions
79.68% (+0.31% πŸ”Ό)
3639/4567
🟑 Lines
79.88% (+0.3% πŸ”Ό)
13401/16777
Show new covered files 🐣
St.:grey_question:
File Statements Branches Functions Lines
🟒
... / admin-as-app.ts
100% 100% 100% 100%
🟒
... / metafield_definitions.ts
100% 100% 100% 100%
🟒
... / metaobject_definitions.ts
100% 100% 100% 100%
🟒
... / bulk-operation-run-mutation.ts
100% 100% 100% 100%
🟒
... / bulk-operation-run-query.ts
100% 100% 100% 100%
🟒
... / get-bulk-operation-by-id.ts
100% 100% 100% 100%
🟒
... / list-bulk-operations.ts
100% 100% 100% 100%
🟒
... / staged-uploads-create.ts
100% 100% 100% 100%
πŸ”΄
... / execute.ts
0% 0% 0% 0%
πŸ”΄
... / status.ts
0% 0% 0% 0%
πŸ”΄
... / pull.ts
0% 100% 0% 0%
🟒
... / execute-operation.ts
92.59% 75% 100% 92.31%
πŸ”΄
... / pull.ts
0% 0% 0% 0%
🟒
... / bulk-operation-status.ts
96.55% 92.11% 100% 100%
🟒
... / constants.ts
100% 100% 100% 100%
🟒
... / download-bulk-operation-results.ts
100% 100% 100% 100%
🟒
... / execute-bulk-operation.ts
92.65% 86.67% 100% 93.94%
🟒
... / format-bulk-operation-status.ts
100% 100% 100% 100%
🟒
... / run-mutation.ts
100% 100% 100% 100%
🟒
... / run-query.ts
100% 100% 100% 100%
🟑
... / stage-file.ts
73.53% 62.5% 85.71% 72.73%
🟒
... / watch-bulk-operation.ts
100% 94.74% 100% 100%
🟒
... / declarative-definitions.ts
98.54% 93.18% 100% 98.51%
🟒
... / common.ts
97.22% 93.75% 100% 96.55%
🟒
... / execute-command-helpers.ts
100% 100% 100% 100%
πŸ”΄
... / promiseWithResolvers.ts
33.33% 50% 50% 33.33%
Show files with reduced coverage πŸ”»
St.:grey_question:
File Statements Branches Functions Lines
πŸ”΄
... / execute.ts
0%
0% (-100% πŸ”»)
0% 0%
🟒
... / extension-instance.ts
84.8% (+0.23% πŸ”Ό)
77.6% (-0.91% πŸ”»)
92.06% (+0.13% πŸ”Ό)
85.11% (+0.24% πŸ”Ό)
🟑
... / specification.ts
69.09%
75.61% (+2.44% πŸ”Ό)
76.47% (-1.31% πŸ”»)
68.75%
🟒
... / ui_extension.ts
85.38% (-9.44% πŸ”»)
72.34% (-8.91% πŸ”»)
84% (-16% πŸ”»)
88% (-8.46% πŸ”»)
🟒
... / developer-platform-client.ts
84.62% (-1.5% πŸ”»)
71.43% (+0.84% πŸ”Ό)
81.82% (+1.82% πŸ”Ό)
93.75% (+0.42% πŸ”Ό)
🟒
... / api.ts
87.07% (-0.43% πŸ”»)
76.71% (-0.1% πŸ”»)
100%
86.49% (-0.43% πŸ”»)
🟒
... / SingleTask.tsx
84.21% (-15.79% πŸ”»)
50% (-50% πŸ”»)
80% (-20% πŸ”»)
84.21% (-15.79% πŸ”»)
πŸ”΄
... / environment.ts
35% (-5% πŸ”»)
41.18%
40% (-10% πŸ”»)
36.84% (-5.26% πŸ”»)
πŸ”΄
... / ui.tsx
50.82% (-0.79% πŸ”»)
42.86% (-5.53% πŸ”»)
54.55% (+1.42% πŸ”Ό)
50% (-0.82% πŸ”»)
🟒
... / console.ts
81.82% (+15.15% πŸ”Ό)
75% (-25% πŸ”»)
100% (+33.33% πŸ”Ό)
81.82% (+15.15% πŸ”Ό)
πŸ”΄
... / dev.ts
14.29% (+0.95% πŸ”Ό)
3.13% (+0.18% πŸ”Ό)
50% (-7.14% πŸ”»)
14.29% (+0.95% πŸ”Ό)
🟒
... / init.ts
88% (-0.89% πŸ”»)
71.43% (+4.76% πŸ”Ό)
86.67% (+4.85% πŸ”Ό)
88% (-0.89% πŸ”»)
🟒
... / storefront-renderer.ts
90.2% (-0.54% πŸ”»)
78.95%
81.82% (-1.52% πŸ”»)
90.2% (-0.54% πŸ”»)
🟑
... / theme-polling.ts
67.12% (-0.93% πŸ”»)
68.75% 78.57%
66.67% (-0.98% πŸ”»)

Test suite run success

3554 tests passing in 1415 suites.

Report generated by πŸ§ͺjest coverage report action from 833d75115f6410aefa89d95372335201291436bc

github-actions[bot] avatar Nov 05 '25 17:11 github-actions[bot]

I have signed the CLA!

georgge293 avatar Nov 05 '25 19:11 georgge293

Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error

georgge293 avatar Nov 05 '25 21:11 georgge293

Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error

@georgge293 This PR is already approved but the core changes won't be deployed until after BFCM. I see some chances this PR is still accidentally merged. Which might be fine because afaik there won't be more CLI releases before BFCM, but core pending deploys could take a few days to deploy after BFCM and we should be careful to not release the CLI until that specific PR is deployed if we don't want to release a broken feature.

I may be a bit paranoid here, but what about moving this PR back to draft? You would keep the approvals and prevent an accidental merge from someone who hasn't read your comment on the core changes dependency

plvaldes avatar Nov 06 '25 14:11 plvaldes

Note: Shopify core changes must be deployed first before the CLI or adding the name field would fail to be recognized and error

@georgge293 This PR is already approved but the core changes won't be deployed until after BFCM. I see some chances this PR is still accidentally merged. Which might be fine because afaik there won't be more CLI releases before BFCM, but core pending deploys could take a few days to deploy after BFCM and we should be careful to not release the CLI until that specific PR is deployed if we don't want to release a broken feature.

I may be a bit paranoid here, but what about moving this PR back to draft? You would keep the approvals and prevent an accidental merge from someone who hasn't read your comment on the core changes dependency

Sounds good, will do. Thanks!

georgge293 avatar Nov 06 '25 18:11 georgge293