-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Declare new doctype and schema for assistant ✨ #2349
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
base: master
Are you sure you want to change the base?
Conversation
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
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 (2)
Unchanged files (14)
Total files change +1.42KB +0.03% Groups updated (1)
Unchanged groups (2)
Final result: ✅ View report in BundleMon website ➡️ |
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: 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 } } }
| "announcements-uploads": { | ||
| "type": "io.cozy.ai.chat.assistants", | ||
| "verbs": ["ALL"], | ||
| "description": "Remote-doctype required to fetch, create and update assistant data" |
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.
Scope verbs to the described operations (least privilege).
The description says fetch/create/update, but ["ALL"] also grants DELETE. If DELETE isn’t required, tighten to GET/POST/PUT or update the description to match intended access.
🔒 Suggested scope (if DELETE isn’t needed)
- "verbs": ["ALL"],
+ "verbs": ["GET", "POST", "PUT"],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "announcements-uploads": { | |
| "type": "io.cozy.ai.chat.assistants", | |
| "verbs": ["ALL"], | |
| "description": "Remote-doctype required to fetch, create and update assistant data" | |
| "announcements-uploads": { | |
| "type": "io.cozy.ai.chat.assistants", | |
| "verbs": ["GET", "POST", "PUT"], | |
| "description": "Remote-doctype required to fetch, create and update assistant data" |
🤖 Prompt for AI Agents
In `@manifest.webapp` around lines 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.
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.
This config has been used before in old part
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.
@lethemanh, understood! If this permission scope follows the existing patterns in your codebase (I can see other permissions like jobs, contacts, triggers, etc. also use ["ALL"]), then maintaining consistency makes sense. Thank you for the clarification.
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