feat: Declare new doctype and schema for assistant ✨#2349
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughAdds a new permission entry 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
BundleMonFiles updated (10)
Unchanged files (6)
Total files change +27.92KB +0.63% Groups updated (3)
Final result: ✅ View report in BundleMon website ➡️ |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
manifest.webapp (1)
128-137: Critical: Duplicate JSON key will cause permission loss.The key
"announcements-uploads"is used twice (lines 128 and 133). JSON parsers typically keep only the last occurrence, so the original permission forcc.cozycloud.announcements.uploadswill be silently overwritten.Rename the new permission key to something meaningful like
"assistants":🐛 Proposed fix
"announcements-uploads": { "type": "cc.cozycloud.announcements.uploads", "verbs": ["GET"], "description": "Remote-doctype required to get announcements images" }, - "announcements-uploads": { + "assistants": { "type": "io.cozy.ai.chat.assistants", "verbs": ["ALL"], "description": "Remote-doctype required to fetch, create and update assistant data" }
🧹 Nitpick comments (1)
src/schema.js (1)
41-50: Consider using the existingACCOUNTS_DOCTYPEconstant.For consistency with the rest of the file (see line 13), use the constant instead of the hardcoded string.
♻️ Suggested change
assistants: { doctype: 'io.cozy.ai.chat.assistants', attributes: {}, relationships: { provider: { type: 'has-one', - doctype: 'io.cozy.accounts' + doctype: ACCOUNTS_DOCTYPE } } }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
manifest.webappsrc/schema.js
⏰ 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). (2)
- GitHub Check: Build and publish
- GitHub Check: Analyze (javascript)
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
53c5cdc to
35390de
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
manifest.webapp (1)
123-136: Rename the duplicate permission key to avoid overriding announcements uploads.
JSON object keys must be unique. The second"announcements-uploads"overrides the first, which likely drops thecc.cozycloud.announcements.uploadspermission and can break announcements images access.🐛 Proposed fix
"announcements-uploads": { "type": "cc.cozycloud.announcements.uploads", "verbs": ["GET"], "description": "Remote-doctype required to get announcements images" }, - "announcements-uploads": { + "chatAssistants": { "type": "io.cozy.ai.chat.assistants", "verbs": ["ALL"], "description": "Remote-doctype required to fetch, create and update assistant data" }
🤖 Fix all issues with AI agents
In `@manifest.webapp`:
- Around line 133-136: The manifest entry for "announcements-uploads" currently
grants overly broad permissions via the verbs array; change the "verbs" value on
the "announcements-uploads" resource from ["ALL"] to the minimal set matching
the description (e.g., ["GET","POST","PUT"]) or alternatively update the
description to explicitly include DELETE if that verb is required; locate the
"announcements-uploads" object and adjust its "verbs" property accordingly to
enforce least privilege.
🧹 Nitpick comments (1)
src/schema.js (1)
41-48: UseACCOUNTS_DOCTYPEfor provider relationship consistency.
Minor maintainability win: avoid hardcoding the same doctype string in multiple places.♻️ Proposed change
assistants: { doctype: 'io.cozy.ai.chat.assistants', attributes: {}, relationships: { provider: { type: 'has-one', - doctype: 'io.cozy.accounts' + doctype: ACCOUNTS_DOCTYPE } } }
manifest.webapp
Outdated
| "verbs": ["GET"], | ||
| "description": "Remote-doctype required to get announcements images" | ||
| }, | ||
| "announcements-uploads": { |
35390de to
7bb7968
Compare
12d5d55 to
caf3557
Compare
caf3557 to
ef81546
Compare
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Related to:
linagora/cozy-libs#2911
linagora/cozy-client#1661
cozy/cozy-store#959
cozy/cozy-stack#4641