Repository navigation
fix(content): say a webhook redirects after a bulk send, and in the webhook test, as a single send does - #1672
Merged
Conversation
…ebhook test, as a single send does Follow-ups from ansvisor#1590. A bulk send doesn't say why. A webhook that redirects does so for every row, so the person saw "Sent 0 opportunities to workflow" and "3 failed to send", with no reason. /bulk/send-webhook now counts the redirects on their own ({ sent, failed, redirected }). Opportunities shows the success note only when something was sent, and when every failure was a redirect, the single send's words: "Nothing was sent: the webhook address redirects. Use the address it redirects to." (bulkSendNotes, tested on its own; the page has no test of its own). "Sent 1 opportunities" reads "Sent 1 opportunity" now. The test's words for a redirect. The webhook test answers a 3xx with the same error a send gives (WEBHOOK_REDIRECT_ERROR), so the dialog says it for a redirect with no Location too, where it showed "HTTP 302". With a Location it still names the address to use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ing was
Review follow-up.
- bulkSendNotes called it a redirect whenever every failure was one, so
{ sent: 1, failed: 1, redirected: 1 } showed both "Sent 1 opportunity"
and "Nothing was sent: the webhook address redirects". It's the redirect
note only when nothing was sent; otherwise "1 failed to send".
- content.js: WEBHOOK_REDIRECT_ERROR sat between the imports; it's below
them now.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups. CI's server job failed on content-people.test.js "puts thousands of names on one line in time near its length" (158 ms against a 150 ms limit). This PR doesn't touch that code, and the test passes here, so it's the known timing flake. Re-run the job before merging.
What I checked:
- Merge. Two commits (d2cba2b, c76985f) on 3f6a4d4. It merges clean on main (b591947), alone and together with #1668 and #1673. Of the files it touches, only
en.jsonchanged on main since its base, and it merges on its own. - Server.
redirectedcounts only rows that were already countedfailedbecause of a 3xx, soredirected <= failedalways holds.- The webhook test adds
error: WEBHOOK_REDIRECT_ERRORonly for a 3xx, and the single send now uses the same constant.successandlocationare unchanged.
- Web.
bulkSendNotes:- every row gets counted
sentorfailed, so "nothing at all" can't happen; - "Nothing was sent: …redirects" shows only when nothing was sent and every failure was a redirect;
- a mix shows "Sent N" and "N failed to send".
- every row gets counted
- The dialog already shows
result.errorwhen there's nolocation, so a 302 with no Location now reads as a redirect instead of "HTTP 302". With a Location it still showstestRedirect. bulkSentToastnow uses an ICU plural; "Sent 1 opportunity" renders.
- Tests.
- At the head, the
content-webhooksserver tests (25) and the webbulk-sendandcontent-webhooktests (13) pass. - With main's
content.jsunder the head's tests, 4 fail: the two test-redirect bodies and the two bulk counts.
- At the head, the
- Before the API deploy. The web reads
redirected ?? 0. Until the API is deployed, a bulk send shows "N failed to send" as today. The only change is that "Sent 0 opportunities" no longer shows. The test dialog stays as it is until the API is deployed. - Speed. No regex and no loop over user input.
Follow-ups:
- An opportunity send still counts a 4xx or 5xx as sent, as the description notes. Since #1668, that also includes a 4xx or 5xx whose answer stalls past the time limit. That's worth its own issue.
- Nothing tests the page's toasts or the action's
redirected ?? 0.bulkSendNotescarries the logic, so this is minor.
This was referenced Oct 28, 2026
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.
Summary
Follow-ups from #1590: a bulk send and the webhook test say a webhook redirects, as a single send does.
/bulk/send-webhooknow counts redirects on their own:{ sent, failed, redirected }. Only the Opportunities page calls it.bulkSendNotes, which has its own tests.{ sent: 1, failed: 1, redirected: 1 }shows "Sent 1 opportunity" and "1 failed to send", not both success and "Nothing was sent".WEBHOOK_REDIRECT_ERROR). So the dialog says it's a redirect even when there's no Location header, where it used to show "HTTP 302". With a Location, it still names the address to use.Where people see it: Content › Opportunities › bulk Send, and Webhook Settings › Test Webhook.
Related issue
Follow-ups from #1590's review.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/routes/content-webhooks.test.jscd web && npx vitest run src/lib/content/bulk-send.test.tsFollow-up (pre-existing, not changed here): an opportunity send still counts a 4xx or 5xx answer as sent. The docs give "non-2xx = failed" only for
content_draft.sent.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's ten follow-up branches merged, and again after the review fixes:
npm test: 246 files, 3,343 tests passed;vitest: 447 files, 4,352 tests passed (after the review fixes).A pre-push review was run on all ten branches.
🤖 Generated with Claude Code