Skip to content

Comments

fix(integrations): Ensure retryCount is sent as a number#37356

Merged
kodiakhq[bot] merged 6 commits intoRocketChat:developfrom
MrKalyanKing:fix/37346-webhook-retry-number
Jan 29, 2026
Merged

fix(integrations): Ensure retryCount is sent as a number#37356
kodiakhq[bot] merged 6 commits intoRocketChat:developfrom
MrKalyanKing:fix/37346-webhook-retry-number

Conversation

@MrKalyanKing
Copy link
Contributor

@MrKalyanKing MrKalyanKing commented Oct 31, 2025

  • I have read the Contributing Guide
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have tested my fix locally and it is effective
  • I have added necessary documentation (if applicable)

Proposed changes

This PR fixes a bug where the "Retry Count" field on the Outgoing Webhook form was sending its value as a string instead of a number. This caused the API to reject the save/update with a [invalid-params] error.

I have updated the outgoingwebhookform.tsx component. The TextInput for retryCount now uses an onChange handler to capture the event and set the form's state using e.currentTarget.valueAsNumber. This ensures the value is always a number (or undefined if the field is empty), which the API expects.

I was able to reproduce the bug and confirm the fix on my local dev server, which now saves the integration successfully.

Issue(s)

Closes #373

Steps to test or reproduce

  1. Go to Administration > Integrations.
  2. Click New and select Outgoing.
  3. Fill in the required fields (Name, Channel, URL).
  4. Scroll down to the Retry Count field and change the value (e.g., from 6 to 5).
  5. Click Save.
  6. Before this fix: An error "must be number" would appear.
  7. After this fix: The integration saves successfully with a "Integration has been added" message.

Issue(s)

Closes #37346
Related to #37356

Further comments

This is my first contribution. I'm happy to make any changes if needed!

COMM-77

Summary by CodeRabbit

  • Refactor
    • Outgoing webhook retry-count input updated to a numeric input control with non‑negative step increments, improving input constraints while preserving labels, hints, and accessibility.
  • Bug Fixes
    • Retry count is now reliably treated and submitted as a numeric value, preventing invalid/non‑numeric entries.
  • Chores
    • Added release metadata for a patch update.

@MrKalyanKing MrKalyanKing requested a review from a team as a code owner October 31, 2025 07:43
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 31, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2025

🦋 Changeset detected

Latest commit: efd9327

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Replaces the retryCount input in the outgoing webhook admin form from a text input to a NumberInput component (import added), rendered with min="0" and step="1", passing the form field through to NumberInput so retryCount is constrained as a numeric value.

Changes

Cohort / File(s) Summary
Retry Count → NumberInput
apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx
Replaces the retryCount TextInput with a NumberInput component, adds its import, and renders it with min="0" and step="1", passing the form field to enforce numeric input. Surrounding label, hint, and ARIA descriptors preserved.
Release changeset
.changeset/good-singers-kiss.md
Adds a changeset documenting a patch fix to ensure Outgoing Webhook retryCount is handled as a number.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Form as OutgoingWebhookForm
  participant NumberInput as NumberInput (retryCount)
  participant State as Form State
  participant API

  User->>Form: edits retryCount
  Form->>NumberInput: receives input event
  Note right of NumberInput `#f0f9ff`: enforces numeric input\n(min=0, step=1)
  NumberInput->>State: updates field value (numeric)
  State-->Form: retryCount numeric in form state
  Form->>API: submit integration (retryCount numeric or omitted)
  API-->>Form: response
  Form-->>User: success / error
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify NumberInput import and props (min/step) are correct.
  • Test edge cases: empty input, zero, large values, non-numeric entry attempts.
  • Confirm form submission sends numeric retryCount and validation/messages unchanged.

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • scuciatto
  • tassoevan

Poem

🐰 I swapped a string for a number neat,
Now retries march in orderly feet.
Min set to zero, steps counted true,
Webhooks retry the right way through. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR addresses issue #37346 by converting retryCount from TextInput to NumberInput with proper constraints. However, it does not address issue #373 regarding email verification settings. Either address the email verification requirement from issue #373 or clarify why it is not applicable to this PR. If unrelated, remove it from the linked issues.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: updating the retryCount input to be a number instead of a string, directly addressing issue #37346.
Out of Scope Changes check ✅ Passed The changes are scoped to fixing the retryCount field type issue in OutgoingWebhookForm.tsx and adding a corresponding changeset entry. No unrelated modifications detected.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1)

476-480: Remove commented-out code before merging.

The commented-out implementation should be removed to keep the codebase clean. Version control history preserves the old implementation if needed for reference.

Apply this diff:

-			{/* <Controller
-				name='retryCount'
-				control={control}
-				render={({ field }) => <TextInput type='number' id={retryCountField} {...field} aria-describedby={`${retryCountField}-hint`} />}
-			/> */}
 			<Controller
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 79c67c7 and 1640ce5.

📒 Files selected for processing (1)
  • apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1)
packages/livechat/src/components/Form/TextInput/index.tsx (1)
  • TextInput (38-38)
🔇 Additional comments (1)
apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1)

484-502: Good fix; API is compatible with undefined values.

The implementation correctly uses valueAsNumber to ensure numeric conversion and properly handles empty inputs by converting NaN to undefined. The API schema in packages/rest-typings defines retryCount as optional, so sending undefined (or omitting it from the payload) is fully compatible.

The logic is sound: empty inputs become undefined, React Hook Form omits undefined fields from the submission, and the API accepts the optional field.

Optional: Consider more concise inline comments.

The inline comments (lines 489, 491-492, 494-495, 498) are helpful but verbose. Suggested shorter versions:

  • Line 489: "Convert to number; empty input becomes undefined"
  • Line 499: "Display blank when undefined"

@MrKalyanKing MrKalyanKing force-pushed the fix/37346-webhook-retry-number branch from 1640ce5 to bdfd51c Compare October 31, 2025 07:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1)

481-503: The numeric conversion logic is correct.

The implementation properly addresses the bug by using valueAsNumber to ensure the retry count is submitted as a number (or undefined when empty), which aligns with API expectations.

Consider these optional refinements:

  1. Add input constraints since retry count should be a non-negative integer:
 <TextInput
   {...field}
   id={retryCountField}
   type='number'
+  step='1'
+  min='0'
   onChange={(e) => {
  1. Simplify comments - the inline comments are helpful but could be more concise:
-  // This 'onChange' is the new magic
   onChange={(e) => {
-    // e.currentTarget.valueAsNumber gives us a real number (or NaN)
     const value = e.currentTarget.valueAsNumber;

-    // If the field is empty (value=NaN), send 'undefined'
-    // Otherwise, send the number
     field.onChange(isNaN(value) ? undefined : value);
   }}
-  // This 'value' prop ensures the input is blank when the value is undefined
   value={field.value ?? ''}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1640ce5 and bdfd51c.

📒 Files selected for processing (2)
  • .changeset/good-singers-kiss.md (1 hunks)
  • apps/meteor/client/views/admin/integrations/outgoing/OutgoingWebhookForm.tsx (1 hunks)
🔇 Additional comments (1)
.changeset/good-singers-kiss.md (1)

2-2: Verify that this bug fix warrants a major version bump.

Bug fixes typically warrant a patch release rather than a major version bump. Major versions are conventionally reserved for breaking changes.

If this is part of a larger planned major release, consider noting that context. Otherwise, consider changing to:

-'@rocket.chat/meteor': major
+'@rocket.chat/meteor': patch

@MrKalyanKing MrKalyanKing changed the title fix(integrations): Ensure retryCount is sent as a number fix(integrations): Ensure retryCount is sent as a number #37346 Oct 31, 2025
@MrKalyanKing MrKalyanKing force-pushed the fix/37346-webhook-retry-number branch from bdfd51c to cf7a431 Compare October 31, 2025 10:04
@MrKalyanKing
Copy link
Contributor Author

Hi @MartinSchoeler, thank you for the detailed feedback! This was very helpful.

I've made all the changes you requested:

Switched from TextInput to NumberInput.

Removed the custom onChange and value props to use the RHF defaults correctly.

Removed the extra comments.

Updated the changeset file description.

I've pushed the amended commit. This should be ready for another look. Thanks!

MartinSchoeler
MartinSchoeler previously approved these changes Nov 6, 2025
@MartinSchoeler MartinSchoeler added the stat: QA assured Means it has been tested and approved by a company insider label Nov 6, 2025
@scuciatto scuciatto removed the stat: QA assured Means it has been tested and approved by a company insider label Nov 6, 2025
@MrKalyanKing MrKalyanKing force-pushed the fix/37346-webhook-retry-number branch from ad2d98a to 9f4ff15 Compare December 7, 2025 03:35
@MrKalyanKing
Copy link
Contributor Author

Hi @MartinSchoeler, I have synced my branch with the latest develop branch to fix the outdated status.
Could you please approve the workflows so the tests can run? Once they pass, this should be ready to merge. Thanks!

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.85%. Comparing base (d3758a7) to head (efd9327).
⚠️ Report is 42 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37356      +/-   ##
===========================================
- Coverage    70.85%   70.85%   -0.01%     
===========================================
  Files         3161     3161              
  Lines       109785   109785              
  Branches     19700    19671      -29     
===========================================
- Hits         77790    77784       -6     
- Misses       29973    29979       +6     
  Partials      2022     2022              
Flag Coverage Δ
e2e 60.35% <0.00%> (+0.02%) ⬆️
e2e-api 47.81% <ø> (ø)
unit 72.06% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MartinSchoeler MartinSchoeler added community stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge labels Jan 29, 2026
@kodiakhq kodiakhq bot merged commit 7a10990 into RocketChat:develop Jan 29, 2026
42 checks passed
@dougfabris dougfabris changed the title fix(integrations): Ensure retryCount is sent as a number #37346 fix(integrations): Ensure retryCount is sent as a number Jan 29, 2026
@dougfabris dougfabris added contrib: valid A valid contribution where maintainers will review based on priority and removed community labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contrib: valid A valid contribution where maintainers will review based on priority stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Outgoing webhook, retry count change results in bad API call Disable e-mail verification

6 participants