Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

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

Open MrKalyanKing opened this issue 2 months ago • 6 comments

  • [X] I have read the Contributing Guide
  • [X] I have signed the CLA
  • [X] Lint and unit tests pass locally with my changes
  • [X] I have tested my fix locally and it is effective
  • [X] 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 avatar Oct 31 '25 07:10 MrKalyanKing

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

  • This PR is missing the 'stat: QA assured' label
  • 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

dionisio-bot[bot] avatar Oct 31 '25 07:10 dionisio-bot[bot]

🦋 Changeset detected

Latest commit: 9f4ff150a352bc9842ea789b890f47f178f6d1f6

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

This PR includes changesets to release 41 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/freeswitch 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/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/stream-hub-service 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/ui-voip 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

changeset-bot[bot] avatar Oct 31 '25 07:10 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 31 '25 07:10 CLAassistant

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

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.

coderabbitai[bot] avatar Oct 31 '25 07:10 coderabbitai[bot]

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!

MrKalyanKing avatar Nov 03 '25 18:11 MrKalyanKing

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!

MrKalyanKing avatar Dec 07 '25 03:12 MrKalyanKing