Repository navigation
delete: knowledge export skills on the backend #7721
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,6 @@ def test_new_permissions_appear_in_workspace_role_tree(self): | |
| self.assertEqual(len(children[group]["permission"]), count) | ||
| ids = {p["id"] for p in children["KNOWLEDGE"]["permission"]} | ||
| self.assertIn(str(P.KNOWLEDGE_MCP_CONFIG.value), ids) | ||
| self.assertIn(str(P.KNOWLEDGE_EXPORT_SKILLS.value), ids) | ||
|
|
||
| @patch("knowledge.views.document.DocumentSerializers.Query") | ||
| def test_image_and_document_lists_require_their_own_read_permission(self, serializer): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Review of the diff@@ -91,7 +91,6 @@ def test_new_permissions_appear_in_workspace_role_tree(self):
ids = {p["id"] for p in children["KNOWLEDGE"]["permission"]}
self.assertIn(str(P.KNOWLEDGE_MCP_CONFIG.value), ids)
- self.assertIn(str(P.KNOWLEDGE_EXPORT_SKILLS.value), ids)Issues / irregularities
Minor / optimization suggestions
Bottom lineThe change is syntactically fine, but functionally it weakens the test without documenting the new expected behavior. Replace the deletion with an explicit negative assertion (or add the replacement permission), reconcile |
||
|
|
||
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.
Based on the provided diff, the changes are syntactically plausible: three
PermissionConstantsenum members are removed.However, I see several potential risks and missing follow-ups:
1. High: Dangling references may break startup or authorization
Search the entire codebase for these removed symbols:
KNOWLEDGE_EXPORT_SKILLSSHARED_KNOWLEDGE_EXPORT_SKILLSRESOURCE_KNOWLEDGE_EXPORT_SKILLSOperate.EXPORT_SKILLSIf any decorator, authorization check, serializer, fixture, test, or config still references them, it will likely fail with
AttributeError,KeyError, or import errors.2. High: Persistent permissions and role grants need migration
If these permissions are stored in DB tables, role-permission mappings, cached bitmasks, or serialized configs, simply deleting the enum members is not enough. You likely need a data migration to:
Otherwise, stale grants may remain.
3. High: Do not reuse deleted
bit_indexvaluesThe removed permissions use:
bit_index=13bit_index=64bit_index=45If those bit indices are later reused for new permissions, existing role bitmasks may unintentionally grant the new permission. This is a privilege-escalation risk. Retire these bit indices permanently, or implement an explicit migration before reuse.
4. High: Check for authorization regressions
If the corresponding export-skill endpoints still exist, removing their permission constants may leave those endpoints:
500instead of403,Confirm that removing these permissions is intentional and that the endpoints are either removed, feature-disabled, or still correctly authorized.
5. Medium: Breaking change for external consumers
Permission names are often part of API responses, configs, or client behavior. Removing them may be a breaking change. If they were released, consider deprecation/aliasing first unless this is coordinated with all consumers.
6. Medium: Tests and snapshots need updates
Check for tests that assert:
The
is_ee=is_eefield onSHARED_KNOWLEDGE_EXPORT_SKILLSsuggests EE-specific behavior may be affected.7. Low: Dead enum values and bit gaps
After removal,
Operate.EXPORT_SKILLSmay become unused. Also, permission bits are now non-contiguous. That is usually fine, but verify no code assumes contiguous bit ranges or maximum bit indices.Recommendation
Before merging:
Operate.EXPORT_SKILLS.bit_indexvalues are never reused without migration.The diff itself does not show an obvious syntax error, but without the full repository I cannot confirm that all references and persisted data are handled.