refactor: consolidate fallback webhook firing with form submission webhooks#28058
Draft
joeauyeung wants to merge 1 commit intodevin/1770145632-routing-form-fallback-webhookfrom
Draft
Conversation
…with normal webhooks Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
What does this PR do?
Consolidates the
ROUTING_FORM_FALLBACK_HITwebhook so it fires in the samePromise.all()batch asFORM_SUBMITTEDandFORM_SUBMITTED_NO_EVENTwebhooks, instead of being triggered as a separate call after form submission.Previously,
triggerFallbackWebhookwas called independently inhandleResponse.tsafteronSubmissionOfFormResponsecompleted. This duplicated webhook infrastructure calls (getWebhookTargetEntity,getOrgIdFromMemberOrTeamId,getWebhooks) that already happen inside_onFormSubmission. Now all three webhook types are fetched and sent in a single batch.Changes:
formSubmissionUtils.ts: AddedfallbackActionparam to_onFormSubmissionandonSubmissionOfFormResponse. Fallback webhooks are fetched in parallel with other webhook types and sent in the samePromise.all(). Removed the standalonetriggerFallbackWebhookexport.handleResponse.ts: MovedgetFallbackAction()beforeonSubmissionOfFormResponsecall. PassesfallbackActionthrough. Removed separatetriggerFallbackWebhookinvocation and unused imports.fallbackActionflows throughonSubmissionOfFormResponserather than asserting on the removedtriggerFallbackWebhook.Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Unit tests:
All 30 tests pass (14 in
formSubmissionUtils.test.ts, 16 inhandleResponse.test.ts).Manual testing (if desired):
ROUTING_FORM_FALLBACK_HITwebhook fires alongsideFORM_SUBMITTEDwebhooksHuman Review Checklist
Critical areas to review:
getFallbackAction()placement (handleResponse.ts:187-215): Verify the function is called at the right time for all code paths (preview mode, queued responses, normal responses).fallbackActionparameter flow: TracefallbackActionfromhandleResponse.ts:235→onSubmissionOfFormResponse→_onFormSubmissionto ensure it's passed correctly.Webhook batching logic (formSubmissionUtils.ts:180-193): Confirm the conditional
subscriberOptionsFallbackHitcorrectly handles the case whenfallbackActionisnull/undefined.Test coverage: Two test cases were removed from the old
triggerFallbackWebhooktests:The behavior is still covered by existing
_onFormSubmissiontests, but worth confirming this is acceptable.Queued form responses: When
queueFormResponse=true,onSubmissionOfFormResponseis not called, so no fallback webhook fires. Verify this matches the previous behavior (it does —triggerFallbackWebhookonly fired whendbFormResponseexisted).Devin session: https://app.devin.ai/sessions/c9f624b956e04c5b8239ae8fc3519ef3
Requested by: @joeauyeung