Skip to content

[Refactor] Share deliveryMethodInstructions between webhook flags and prompts - #8716

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor-maintenance-36796578738
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
refactor-maintenance-36796578738

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

deliveryMethodInstructions exists twice, byte-for-byte identical: once in packages/app/src/cli/services/webhook/trigger-flags.ts and once in packages/app/src/cli/prompts/webhook/trigger.ts. Both copies produce the address-format hints shown when a webhook address doesn't match its delivery method, so the hint text for HTTP, Google Pub/Sub, and Amazon EventBridge has to be kept in sync by hand across two files.

WHAT is this pull request doing?

Export the copy in trigger-flags.ts and delete the one in prompts/webhook/trigger.ts, which already imports DELIVERY_METHOD and isAddressAllowedForDeliveryMethod from that module. The service file is the right home: it owns DELIVERY_METHOD and is the other caller, via validateAddressMethod.

The surviving function is unchanged apart from the export keyword and a JSDoc block matching the other exported functions in that file. Both call sites — the AbortError hints from validateAddressMethod and deliveryMethodInstructionsAsString used by addressPrompt and the command's flag help — get the same strings in the same order as before.

How to manually test your changes?

pnpm shopify app webhook trigger --topic products/create --api-version 2024-10 --delivery-method google-pub-sub --address https://example.org

The command should fail with "Can't deliver your webhook payload to this address using 'google-pub-sub'" and the Pub/Sub address hint. pnpm shopify app webhook trigger --help should still list the hints for all three delivery methods.

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 (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

… prompts

The function was duplicated byte-for-byte in trigger-flags.ts and
prompts/webhook/trigger.ts. Export the service copy and import it in the
prompt, which already imports from the same module.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

0 participants