Skip to content

[OPIK-5200] [BE] feat: add P3 workspace permission annotations#5785

Open
LifeXplorer wants to merge 2 commits intomainfrom
avinahradau/OPIK-P3-workspace-permissions
Open

[OPIK-5200] [BE] feat: add P3 workspace permission annotations#5785
LifeXplorer wants to merge 2 commits intomainfrom
avinahradau/OPIK-P3-workspace-permissions

Conversation

@LifeXplorer
Copy link
Copy Markdown
Contributor

Summary

  • Add 8 new P3 workspace permissions to WorkspaceUserPermission enum: project_create, project_data_view, comment_write, trace_span_thread_annotate, trace_tag, online_evaluation_rule_update, alert_update, annotation_queue_create
  • Annotate ~30 endpoints across 7 resource classes (ProjectsResource, TracesResource, SpansResource, AlertResource, AutomationRuleEvaluatorsResource, ManualEvaluationResource, AnnotationQueuesResource) with @RequiredPermissions
  • Add 403 permission denial tests for all new permissions across test classes

Test plan

  • Verify compilation passes
  • Run permission denial tests in ProjectsResourceTest, TracesResourceTest, SpansResourceTest, AlertResourceTest, AutomationRuleEvaluatorsResourceTest, ManualEvaluationResourceTest, AnnotationQueuesResourceTest
  • Verify existing tests still pass (no regressions)
  • Deploy with comet-backend P3 permissions PR (companion PR in comet-backend)

🤖 Generated with Claude Code

Add 8 new P3 workspace permissions (project_create, project_data_view,
comment_write, trace_span_thread_annotate, trace_tag,
online_evaluation_rule_update, alert_update, annotation_queue_create)
and annotate ~30 endpoints across 7 resource classes with
@RequiredPermissions. Includes 403 permission denial tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@LifeXplorer LifeXplorer requested a review from a team as a code owner March 23, 2026 10:43
@github-actions github-actions bot added java Pull requests that update Java code Backend tests Including test files, or tests related like configuration. labels Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

@LifeXplorer LifeXplorer changed the title [NA] [BE] feat: add P3 workspace permission annotations [OPIK-5200] [BE] feat: add P3 workspace permission annotations Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 23, 2026

Backend Tests - Integration Group 11

 35 files   35 suites   2m 31s ⏱️
192 tests 191 ✅ 0 💤 1 ❌
169 runs  168 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit d3003cc.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 23, 2026

Backend Tests - Integration Group 9

321 tests   319 ✅  7m 28s ⏱️
 25 suites    1 💤
 25 files      1 ❌

For more details on these failures, see this check.

Results for commit d3003cc.

♻️ This comment has been updated with latest results.

Comment on lines +24 to +32
ANNOTATION_QUEUE_ANNOTATE("annotation_queue_annotate"),
PROJECT_CREATE("project_create"),
PROJECT_DATA_VIEW("project_data_view"),
COMMENT_WRITE("comment_write"),
TRACE_SPAN_THREAD_ANNOTATE("trace_span_thread_annotate"),
TRACE_TAG("trace_tag"),
ONLINE_EVALUATION_RULE_UPDATE("online_evaluation_rule_update"),
ALERT_UPDATE("alert_update"),
ANNOTATION_QUEUE_CREATE("annotation_queue_create");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New permission enums added at lines 24-32 aren't registered in the auth/permission registry or workspace roles, should we update the registry and role assignments or gate the change and verify resource annotations?

Finding type: Breaking Changes | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents:

Before applying, verify this suggestion against the current code. In
apps/opik-backend/src/main/java/com/comet/opik/infrastructure/auth/WorkspaceUserPermission.java
around lines 24 to 32, the WorkspaceUserPermission enum was extended with new values
(e.g. ALERT_UPDATE, PROJECT_DATA_VIEW, COMMENT_WRITE, TRACE_SPAN_THREAD_ANNOTATE,
ONLINE_EVALUATION_RULE_UPDATE, ANNOTATION_QUEUE_CREATE). This change is breaking because
the permission registry, workspace role definitions, and any API key/role provisioning
were not updated to expose or grant these new permission strings. Update the
authorization subsystem: add these new permission strings to the permission
registry/service and ensure default workspace roles and system API keys are granted the
appropriate subset (or create a migration that grants them to existing roles), and/or
add a feature flag to gate the new resource annotations until roles are provisioned.
Also scan the resources that now require these permissions (AlertResource,
ProjectsResource, SpansResource, TracesResource, AutomationRuleEvaluatorsResource,
ManualEvaluationResource, AnnotationQueuesResource) and confirm each required permission
maps to a granted role or API key; adjust role assignments or tests accordingly.

WORKSPACE_SETTINGS_CONFIGURE("workspace_settings_configure"),
AI_PROVIDER_UPDATE("ai_provider_update"),
ANNOTATION_QUEUE_ANNOTATE("annotation_queue_annotate");
ANNOTATION_QUEUE_ANNOTATE("annotation_queue_annotate"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: list similar enum values together (annotation queues etc.)

@github-actions
Copy link
Copy Markdown
Contributor

📋 PR Linter Failed

Missing Section. The description is missing the ## Details section.


Missing Section. The description is missing the ## Change checklist section.


Missing Section. The description is missing the ## Issues section.


Missing Section. The description is missing the ## Testing section.


Missing Section. The description is missing the ## Documentation section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend java Pull requests that update Java code tests Including test files, or tests related like configuration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants