-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix!: title and value properties should be required on attachments.fields
#37233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: ac92f9d The changes in this PR will be included in the next version bump. This PR includes changesets to release 40 packages
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 |
WalkthroughAdds server-side validation requiring each Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as API Client
participant API as Chat API (Server)
participant Validator as Attachment Validator
participant Service as Message Service
participant DB as Database
Client->>API: POST /api/v1/chat.postMessage { attachments.fields[...] }
API->>Validator: Validate each attachment.field (require title & value)
alt Missing title or value
Validator-->>API: Validation error
API-->>Client: 400 { success: false, error: "Invalid attachment field, title and value is required" }
else All fields valid
Validator-->>API: Validation passed
API->>Service: sendMessage(payload)
Service->>DB: Insert message with attachments
DB-->>Service: OK
Service-->>API: Message stored
API-->>Client: 200 { success: true, message }
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-8.0.0 #37233 +/- ##
=================================================
- Coverage 70.24% 69.89% -0.35%
=================================================
Files 2999 2983 -16
Lines 102301 102087 -214
Branches 18221 18175 -46
=================================================
- Hits 71861 71357 -504
- Misses 28576 28889 +313
+ Partials 1864 1841 -23
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 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.
📒 Files selected for processing (3)
.changeset/hungry-fans-wait.md(1 hunks)apps/meteor/app/lib/server/functions/sendMessage.ts(1 hunks)apps/meteor/tests/end-to-end/api/chat.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/tests/end-to-end/api/chat.ts (1)
apps/meteor/tests/data/api-data.ts (3)
request(10-10)api(46-48)credentials(39-42)
🔇 Additional comments (2)
.changeset/hungry-fans-wait.md (1)
1-5: LGTM!The changeset correctly documents the validation changes and uses an appropriate version bump (minor) since this adds validation that could potentially break existing API calls with malformed attachment fields.
apps/meteor/tests/end-to-end/api/chat.ts (1)
557-585: Verify JSON schema for falsy values in attachment.fieldsCouldn't locate the ChatPostMessageSchema; please confirm the validation allows 0, false, and empty string for fields.value and title and add or adjust tests accordingly.
dd959e2 to
589f2a1
Compare
481c8af to
94daba9
Compare
e06b0cd to
ee2a34f
Compare
27fe006 to
bd0a5ef
Compare
22cdc8e to
6199d29
Compare
a9a5e60 to
ac92f9d
Compare
Proposed changes (including videos or screenshots)
Adds validation on API endpoints for required
attachment.fieldsproperties. It shouldn't be possible to send a message with missingtitleandvalueproperties.Issue(s)
Steps to test or reproduce
Further comments
CORE-1498
Summary by CodeRabbit
Bug Fixes
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.