fix(zendesk): modify body ticket comment as optional#21151
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified. |
|
Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:
|
📝 WalkthroughWalkthroughUpdate Zendesk component to 0.17.1 by making ticket comment body optional in the update-ticket action, conditionally including the comment body in the payload only when provided, and synchronizing version numbers across the component package and all 38 actions and sources. ChangesZendesk Component Version Update with Optional Comment Body
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/zendesk/actions/update-ticket/update-ticket.mjs (1)
8-8:⚠️ Potential issue | 🟠 Major | ⚡ Quick winBump the action version for this behavior change.
run()behavior changed for comment payload construction (Line 137-146), butversionremains0.2.9(Line 8). This should be a patch increment (e.g.,0.2.10) to satisfy component semver/versioning policy.As per coding guidelines, component
versionmust be incremented on every change, with patch bumps for non-breaking fixes.Also applies to: 137-146
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zendesk/actions/update-ticket/update-ticket.mjs` at line 8, The component version string was not updated after changing run()'s comment payload construction; update the exported version value (currently "0.2.9") to a patch bump like "0.2.10" to follow semver policy, and ensure the version change accompanies the modified run() logic that builds the comment payload (refer to the run function handling comment payload construction).Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@components/zendesk/actions/update-ticket/update-ticket.mjs`:
- Line 8: The component version string was not updated after changing run()'s
comment payload construction; update the exported version value (currently
"0.2.9") to a patch bump like "0.2.10" to follow semver policy, and ensure the
version change accompanies the modified run() logic that builds the comment
payload (refer to the run function handling comment payload construction).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 72521f4d-02e4-44c0-b634-a4b2603f8a97
📒 Files selected for processing (3)
components/zendesk/actions/update-ticket/update-ticket.mjscomponents/zendesk/package.jsoncomponents/zendesk/zendesk.app.mjs
47b4c97 to
07b36db
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/zendesk/actions/update-ticket/update-ticket.mjs`:
- Line 10: The annotation for the "Update Ticket" action incorrectly marks it as
destructive; change annotations.destructiveHint from true to false in the
update-ticket action definition (look for the property destructiveHint in the
action metadata for UpdateTicket / update-ticket.mjs) so the action is not
treated as an irreversible destructive operation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c51eb199-429f-43e8-bc64-e148030e1ad0
📒 Files selected for processing (3)
components/zendesk/actions/update-ticket/update-ticket.mjscomponents/zendesk/package.jsoncomponents/zendesk/zendesk.app.mjs
There was a problem hiding this comment.
Hi @Christianlauw123, thank you for your contribution! The PR looks functionally sound to me. But since this has changes in the zendesk.app.mjs file, it requires version updates across all other action/source files within the zendesk component. Please use the below command to update the versions.
Linux
sed -i 0,/0.0.12/{s/0.0.12/0.0.13/} components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs && sed -i 0,/0.1.16/{s/0.1.16/0.1.17/} components/zendesk/actions/create-ticket/create-ticket.mjs && sed -i 0,/0.1.16/{s/0.1.16/0.1.17/} components/zendesk/actions/delete-ticket/delete-ticket.mjs && sed -i 0,/0.0.6/{s/0.0.6/0.0.7/} components/zendesk/actions/get-article/get-article.mjs && sed -i 0,/0.0.6/{s/0.0.6/0.0.7/} components/zendesk/actions/get-macro/get-macro.mjs && sed -i 0,/0.0.2/{s/0.0.2/0.0.3/} components/zendesk/actions/get-side-conversation/get-side-conversation.mjs && sed -i 0,/0.0.14/{s/0.0.14/0.0.15/} components/zendesk/actions/get-ticket-info/get-ticket-info.mjs && sed -i 0,/0.0.11/{s/0.0.11/0.0.12/} components/zendesk/actions/get-user-info/get-user-info.mjs && sed -i 0,/0.0.6/{s/0.0.6/0.0.7/} components/zendesk/actions/list-active-macros/list-active-macros.mjs && sed -i 0,/0.0.7/{s/0.0.7/0.0.8/} components/zendesk/actions/list-articles/list-articles.mjs && sed -i 0,/0.0.3/{s/0.0.3/0.0.4/} components/zendesk/actions/list-fields-options/list-fields-options.mjs && sed -i 0,/0.0.11/{s/0.0.11/0.0.12/} components/zendesk/actions/list-locales/list-locales.mjs && sed -i 0,/0.0.4/{s/0.0.4/0.0.5/} components/zendesk/actions/list-macro-category-options/list-macro-category-options.mjs && sed -i 0,/0.0.11/{s/0.0.11/0.0.12/} components/zendesk/actions/list-macros/list-macros.mjs && sed -i 0,/0.0.2/{s/0.0.2/0.0.3/} components/zendesk/actions/list-side-conversations/list-side-conversations.mjs && sed -i 0,/0.0.11/{s/0.0.11/0.0.12/} components/zendesk/actions/list-ticket-comments/list-ticket-comments.mjs && sed -i 0,/0.0.14/{s/0.0.14/0.0.15/} components/zendesk/actions/list-tickets/list-tickets.mjs && sed -i 0,/0.0.12/{s/0.0.12/0.0.13/} components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs && sed -i 0,/0.0.4/{s/0.0.4/0.0.5/} components/zendesk/actions/search-articles/search-articles.mjs && sed -i 0,/0.0.4/{s/0.0.4/0.0.5/} components/zendesk/actions/search-community-posts/search-community-posts.mjs && sed -i 0,/0.0.4/{s/0.0.4/0.0.5/} components/zendesk/actions/search-help-center/search-help-center.mjs && sed -i 0,/0.0.5/{s/0.0.5/0.0.6/} components/zendesk/actions/search-macros/search-macros.mjs && sed -i 0,/0.0.15/{s/0.0.15/0.0.16/} components/zendesk/actions/search-tickets/search-tickets.mjs && sed -i 0,/0.0.9/{s/0.0.9/0.0.10/} components/zendesk/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs && sed -i 0,/0.0.12/{s/0.0.12/0.0.13/} components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs && sed -i 0,/0.0.1/{s/0.0.1/0.0.2/} components/zendesk/actions/upload-ticket-attachments/upload-ticket-attachments.mjs && sed -i 0,/0.0.10/{s/0.0.10/0.0.11/} components/zendesk/sources/locale-updated/locale-updated.mjs && sed -i 0,/0.0.3/{s/0.0.3/0.0.4/} components/zendesk/sources/new-side-conversation/new-side-conversation.mjs && sed -i 0,/0.0.3/{s/0.0.3/0.0.4/} components/zendesk/sources/new-side-conversation-reply/new-side-conversation-reply.mjs && sed -i 0,/0.2.15/{s/0.2.15/0.2.16/} components/zendesk/sources/new-ticket/new-ticket.mjs && sed -i 0,/0.1.7/{s/0.1.7/0.1.8/} components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs && sed -i 0,/0.0.15/{s/0.0.15/0.0.16/} components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs && sed -i 0,/0.2.15/{s/0.2.15/0.2.16/} components/zendesk/sources/ticket-closed/ticket-closed.mjs && sed -i 0,/0.2.15/{s/0.2.15/0.2.16/} components/zendesk/sources/ticket-pended/ticket-pended.mjs && sed -i 0,/0.2.15/{s/0.2.15/0.2.16/} components/zendesk/sources/ticket-solved/ticket-solved.mjs && sed -i 0,/0.2.15/{s/0.2.15/0.2.16/} components/zendesk/sources/ticket-updated/ticket-updated.mjs
MacOS
sed -i '' 's/0.0.12/0.0.13/' components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs && sed -i '' 's/0.1.16/0.1.17/' components/zendesk/actions/create-ticket/create-ticket.mjs && sed -i '' 's/0.1.16/0.1.17/' components/zendesk/actions/delete-ticket/delete-ticket.mjs && sed -i '' 's/0.0.6/0.0.7/' components/zendesk/actions/get-article/get-article.mjs && sed -i '' 's/0.0.6/0.0.7/' components/zendesk/actions/get-macro/get-macro.mjs && sed -i '' 's/0.0.2/0.0.3/' components/zendesk/actions/get-side-conversation/get-side-conversation.mjs && sed -i '' 's/0.0.14/0.0.15/' components/zendesk/actions/get-ticket-info/get-ticket-info.mjs && sed -i '' 's/0.0.11/0.0.12/' components/zendesk/actions/get-user-info/get-user-info.mjs && sed -i '' 's/0.0.6/0.0.7/' components/zendesk/actions/list-active-macros/list-active-macros.mjs && sed -i '' 's/0.0.7/0.0.8/' components/zendesk/actions/list-articles/list-articles.mjs && sed -i '' 's/0.0.3/0.0.4/' components/zendesk/actions/list-fields-options/list-fields-options.mjs && sed -i '' 's/0.0.11/0.0.12/' components/zendesk/actions/list-locales/list-locales.mjs && sed -i '' 's/0.0.4/0.0.5/' components/zendesk/actions/list-macro-category-options/list-macro-category-options.mjs && sed -i '' 's/0.0.11/0.0.12/' components/zendesk/actions/list-macros/list-macros.mjs && sed -i '' 's/0.0.2/0.0.3/' components/zendesk/actions/list-side-conversations/list-side-conversations.mjs && sed -i '' 's/0.0.11/0.0.12/' components/zendesk/actions/list-ticket-comments/list-ticket-comments.mjs && sed -i '' 's/0.0.14/0.0.15/' components/zendesk/actions/list-tickets/list-tickets.mjs && sed -i '' 's/0.0.12/0.0.13/' components/zendesk/actions/remove-ticket-tags/remove-ticket-tags.mjs && sed -i '' 's/0.0.4/0.0.5/' components/zendesk/actions/search-articles/search-articles.mjs && sed -i '' 's/0.0.4/0.0.5/' components/zendesk/actions/search-community-posts/search-community-posts.mjs && sed -i '' 's/0.0.4/0.0.5/' components/zendesk/actions/search-help-center/search-help-center.mjs && sed -i '' 's/0.0.5/0.0.6/' components/zendesk/actions/search-macros/search-macros.mjs && sed -i '' 's/0.0.15/0.0.16/' components/zendesk/actions/search-tickets/search-tickets.mjs && sed -i '' 's/0.0.9/0.0.10/' components/zendesk/actions/set-custom-ticket-fields/set-custom-ticket-fields.mjs && sed -i '' 's/0.0.12/0.0.13/' components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs && sed -i '' 's/0.0.1/0.0.2/' components/zendesk/actions/upload-ticket-attachments/upload-ticket-attachments.mjs && sed -i '' 's/0.0.10/0.0.11/' components/zendesk/sources/locale-updated/locale-updated.mjs && sed -i '' 's/0.0.3/0.0.4/' components/zendesk/sources/new-side-conversation/new-side-conversation.mjs && sed -i '' 's/0.0.3/0.0.4/' components/zendesk/sources/new-side-conversation-reply/new-side-conversation-reply.mjs && sed -i '' 's/0.2.15/0.2.16/' components/zendesk/sources/new-ticket/new-ticket.mjs && sed -i '' 's/0.1.7/0.1.8/' components/zendesk/sources/new-ticket-comment-added/new-ticket-comment-added.mjs && sed -i '' 's/0.0.15/0.0.16/' components/zendesk/sources/ticket-added-to-view/ticket-added-to-view.mjs && sed -i '' 's/0.2.15/0.2.16/' components/zendesk/sources/ticket-closed/ticket-closed.mjs && sed -i '' 's/0.2.15/0.2.16/' components/zendesk/sources/ticket-pended/ticket-pended.mjs && sed -i '' 's/0.2.15/0.2.16/' components/zendesk/sources/ticket-solved/ticket-solved.mjs && sed -i '' 's/0.2.15/0.2.16/' components/zendesk/sources/ticket-updated/ticket-updated.mjs
You can find the contribution guidelines for versioning at: https://pipedream.com/docs/components/contributing/guidelines#versioning
| version: "0.2.9", | ||
| version: "0.2.10", | ||
| annotations: { | ||
| destructiveHint: true, |
There was a problem hiding this comment.
| destructiveHint: true, | |
| destructiveHint: false, |
| } | ||
| : {} ); | ||
|
|
||
| ticketComment.public = ticketCommentPublic; |
There was a problem hiding this comment.
if (ticketCommentBody) {
ticketComment.public = ticketCommentPublic;
}
There was a problem hiding this comment.
Hi @ashwins01,
Thanks, that makes sense.
I've updated the ticketCommentBody logic and set destructiveHint to false.
I've also bumped the component versions.
Additionally, I tested the behavior directly against the Zendesk API using Postman. Sending an empty comment payload ({}) succeeds without any validation error, but no comment is added to the ticket.
As coderabbitai we should ensure we don’t send empty comment objects to Zendesk, i.e., omit the comment field entirely when no content exists (instead of sending {}), since the API treats it as a no-op rather than an error.
Let me know what you think.
… set destructiveHint to false
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/zendesk/actions/update-ticket/update-ticket.mjs (1)
137-147:⚠️ Potential issue | 🟠 MajorFix
commentfield to useundefinedinstead of empty object when no comment content exists.At lines 137–147,
ticketCommentfalls back to{}when there is no comment body. This empty object is always included inticketData(line 171) and sent to the Zendesk API as"comment": {}, which violates the Zendesk API design. According to Zendesk API documentation, thecommentfield should be omitted entirely when no comment content exists (nobody,html_body, oruploads).Set the fallback to
undefinedand let@pipedream/platformaxios strip it automatically, per the coding guidelines for handling optional values.Suggested minimal patch
const ticketComment = ticketCommentBodyIsHTML ? { html_body: ticketCommentBody, } : ( ticketCommentBody ? { body: ticketCommentBody, } - : {} ); + : undefined);Also applies to: 171–173 (where
comment: ticketCommentis always included in the request).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/zendesk/actions/update-ticket/update-ticket.mjs` around lines 137 - 147, In the ticketComment variable definition, the fallback value when there is no comment body is currently an empty object `{}`, which causes the comment field to be sent to the Zendesk API as an empty object, violating the API design. Change the fallback from `{}` to `undefined` so that the `@pipedream/platform` axios client will automatically strip the undefined value and omit the comment field entirely from the request when no comment content exists, which aligns with Zendesk API expectations.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@components/zendesk/actions/update-ticket/update-ticket.mjs`:
- Around line 137-147: In the ticketComment variable definition, the fallback
value when there is no comment body is currently an empty object `{}`, which
causes the comment field to be sent to the Zendesk API as an empty object,
violating the API design. Change the fallback from `{}` to `undefined` so that
the `@pipedream/platform` axios client will automatically strip the undefined
value and omit the comment field entirely from the request when no comment
content exists, which aligns with Zendesk API expectations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 176fd02b-a83f-497b-a2e8-8650058b507e
📒 Files selected for processing (1)
components/zendesk/actions/update-ticket/update-ticket.mjs
ashwins01
left a comment
There was a problem hiding this comment.
Looks good to me, moving to QA.
Thank you for your contribution!
|
QA passed. Testcases covered:
|
Summary
Closes #21149
Changes
zendesk-app.mjs: Update thepropDefinitionsforticketCommentBody. Addoptional: trueupdate-ticket.mjs:ticketCommentBodyoptional. If it is missing or falsy, the payload now safely defaults to an empty object {}.0.2.9->0.2.10package.json: Version bump0.17.0->0.17.1References
Ticket Comment- https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/Validation
pnpm eslint components/zendesk- passes cleannode --check- passesnode scripts/build-components.mjs components/zendesk- passesChecklist
Please check the following items before your PR can be reviewed:
Versioning
0.0.1for new ones)package.json's version updatedNew app
If this is a new app, please submit an app integration request - the PR will only be reviewed after the app is integrated.
CodeRabbit review
After the PR is opened, and if new changes are pushed, CodeRabbit will automatically review it. Do not 'mark as resolved' CodeRabbit's comments, but reply to them instead, whether you agree (and update the PR accordingly) or disagree.
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Updates