Repository navigation
ref(events): Remove duplicate watch checks in GitHub and Vercel - #2378
Merged
Merged
Conversation
Tools already check ctx.events.canSubscribe before they build a watchable resource, and canSubscribe comes from the plugin isEnabled check. The per-helper webhook secret checks only repeated that check. Also define the GitHub repository event lists once, share gitHubEventKey and pullRequestTargets between the GitHub normalizers, and document that terminal goes only on the exact resource. Refs #2362 Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Each GitHub and Vercel *Subscribable helper now takes canSubscribe and returns undefined when the host cannot create Watches. Tools no longer repeat the ternary, so a new caller cannot forget the check. Also mark the GitHub repository event lists as const, like the other event lists. Refs #2362 Co-Authored-By: David Cramer <[email protected]>
dcramer
approved these changes
Oct 29, 2026
This was referenced Oct 29, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is item 1 of #2362 (cleanup, no behavior change).
Each GitHub
*Subscribablehelper checkedGITHUB_WEBHOOK_SECRETagain. The Vercel helper took awebhookSecretinput for the same reason. Every caller already checkedctx.events.canSubscribefirst. Core setscanSubscribefrom the plugin'sisEnabled, which reads the same secret.Now each helper takes
canSubscribeas an input and returnsundefinedwhen it is false. The rule lives in one place, so the tools no longer repeatctx.events.canSubscribe ? helper(...) : undefined, and a new caller cannot forget the check. The Vercel rule that a commit needs a target stays.Other changes:
as constlists inevents/repository.ts, like the other event lists.plugin.tsandgitHubRepositorySubscribableboth use them. The[...]copies stay because the registration andSubscribableResourcetypes need mutable arrays.gitHubEventKeyandpullRequestTargetswere copied inwebhooks/events.tsandwebhooks/check-suite.ts. They now live in a newwebhooks/event-targets.ts. Because the helper is shared, check suites no longer have their own copy of theterminalstrip, which did nothing there.terminalfield in plugin-api now says to set it only on the exact resource, never on copies for broader resources.Tests:
canSubscribestayed true. The "host cannot subscribe" tests already cover the gate.isEnabledtrue and false. Before this, no test checked that a disabled plugin getscanSubscribe: false. I extended the existing case instead of adding a new one, because the test architecture check does not allow moresetPluginscalls in that file.Open questions:
webhooks/event-targets.tsthe right home for the shared helpers? The other choice was to export them fromcheck-suite.ts. I did not do that, because a reader looking for a general helper would not look in the check-suite file.index.tsandevents/deployment.ts. Both only spreadVERCEL_DEPLOYMENT_EVENTS, which is already one constant, so I left them as they are.via David Cramer.
--
View Junior Session [Sentry]