-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[issue-2572] [FE] Update experiment name metadata in UI #3136
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
[issue-2572] [FE] Update experiment name metadata in UI #3136
Conversation
...hub.com/riturajFi/opik into feature/update-experiment-name-metadata
...hub.com/riturajFi/opik into feature/update-experiment-name-metadata
Hi @yaricom @Lothiraldan @dsblank @vincentkoc , would like this PR to be reviewd
@riturajFi can you please address the linter and test failures please before team can review. Thanks for your contribution.
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.
Pull Request Overview
This PR introduces functionality to update experiment names and metadata across all Opik applications. The feature enables users to modify existing experiments through API endpoints, frontend UI, and SDK methods.
Key changes:
- Added API endpoint for updating experiment name and metadata with validation and change detection
- Created interactive frontend dialog with Monaco editor for JSON metadata editing
- Extended both Python and TypeScript SDKs with update methods
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
apps/opik-backend/src/main/java/com/comet/opik/api/resources/v1/priv/ExperimentsResource.java |
REST endpoint for experiment updates with change detection |
apps/opik-backend/src/main/java/com/comet/opik/domain/ExperimentService.java |
Business logic for planning and applying experiment updates |
apps/opik-backend/src/main/java/com/comet/opik/domain/ExperimentDAO.java |
Database operations for updating experiment name and metadata |
apps/opik-frontend/src/components/shared/UpdateExperimentDialog/UpdateExperimentDialog.tsx |
React dialog component with Monaco editor for experiment editing |
apps/opik-frontend/src/api/datasets/useExperimentUpdate.ts |
Frontend mutation hook for experiment updates |
sdks/python/src/opik/api_objects/opik_client.py |
Python SDK method for updating experiments |
sdks/typescript/src/opik/client/Client.ts |
TypeScript SDK method for updating experiments |
sdks/typescript/tests/experiment/client-experiment.test.ts |
Unit and integration tests for TypeScript SDK |
Files not reviewed (1)
- apps/opik-frontend/package-lock.json: Language not supported
Copilot
AI
Sep 2, 2025
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.
Debug console.log statement should be removed from test code. Use proper test logging or assertions instead.
Copilot uses AI. Check for mistakes.
Copilot
AI
Sep 2, 2025
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.
Using browser alert() for error messages is not consistent with the application's UI patterns. Use the toast notification system instead, similar to other components in the codebase.
Copilot uses AI. Check for mistakes.
Copilot
AI
Sep 2, 2025
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.
Function parameters lack TypeScript type definitions. Define an interface for the props to ensure type safety and better developer experience.
Copilot uses AI. Check for mistakes.
Copilot
AI
Sep 2, 2025
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.
The docstring parameter type annotation is incorrect. newMetadata
should be Optional[Dict[str, Any]]
not Optional[str]
to match the actual parameter type.
Copilot uses AI. Check for mistakes.
Copilot
AI
Sep 2, 2025
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.
The confirm text should be "Delete experiment" (singular) since the action deletes only one experiment, not multiple experiments.
Copilot uses AI. Check for mistakes.
Copilot
AI
Sep 2, 2025
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.
Inconsistent indentation after the blocking call. The ObjectMapper instantiation should be aligned with the surrounding code block.
Copilot uses AI. Check for mistakes.
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.
Hi @riturajFi
Thanks a lot for your contribution.
I left a review on the backend part, with the general guidelines to follow in this service.
The main question here is how to handle the ClickHouse updates, which isn't straight forward and probably one of the reasons why we haven't implemented this ourselves yet.
I'll discuss and double check the approach with the team for that, but for now, the best option is to handle the update with a INSERT + SELECT query (see examples in this DAO already) and document that the endpoint is only meant for the UI and doesn't handle concurrent scenarios for the SDK (already the case).
Other members of the team will review the FE and SDK parts. In the meantime, please remove changes on the auto-generated code.
Thank you very much for all this work!
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.
Per architectural reasons, we don't do mutations in ClickHouse, as they're not performant:
Regarding entities stored in CH, only spans and traces are PATCHED. The approach is to query and re-insert only the data that changes, in this case it'd be name
and metadata
. In this approach is tricky to keep data consistency for concurrent SDK flows. But maybe is reasonable to just document that this endpoint is for UI purposes only.
Another alternative is lightweight updates:
But considering that is a Beta feature, has some performance implications, and it'd have the same concurrency issues, I'd go with the previous approach.
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 should be a PATCH operation.
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.
You need tests for this new endpoint. Please follow the conventions in the code base.
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.
After updating to PATCH, the verb should be removed from the path. It isn't a good REST practice.
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.
Minor: let's rename the method to update
.
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.
Move to package com.comet.opik.api;
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.
Add @Builder(toBuilder = true)
.
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 won't be needed.
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.
We have an automation for everything under sdks/python/src/opik/rest_api/
folder, please remove these changes. They'll be auto-generated.
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.
Same for the typescript SDK, we have an automation for everything under rest_api
folder, please remove these changes. They'll be auto-generated.
Great insights @andrescrz ! Will do the changes right away!
...riment-name-metadata
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.
Thank you very much for your contribution. I have provided a few comments regarding the frontend implementation for your consideration.
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.
I would not introduce this very heavy dependency, we already have the editor we use in other places, Codemirror.
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.
It would be great if you could align this with the existing naming conventions and parameter structures we use for other update endpoints. For reference, you can check [apps/opik-frontend/src/api/projects/useProjectUpdateMutation.ts]. This will help keep things consistent, especially once the backend is migrated to use a PATCH request.
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.
I’d suggest not introducing new state here. It would be better to follow the existing pattern we use elsewhere—for example, in [apps/opik-frontend/src/components/pages/ProjectsPage/ProjectRowActionsCell.tsx]. This will help keep the implementation consistent across the codebase.
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.
Could you please update the wording here to use "Edit", so it stays consistent with the rest of the codebase?
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.
As I mentioned above regarding the code editor, I’d recommend using this file as a reference for integrating the CodeMirror editor:
[apps/opik-frontend/src/components/pages/DatasetItemsPage/AddEditDatasetItemDialog.tsx].
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.
Let’s reuse the existing input component from [apps/opik-frontend/src/components/ui/input.tsx] to keep things consistent across the codebase.
@cursor
cursor
bot
left a comment
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 PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
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.
Bug: API Endpoint Mismatch Causes Client Errors
The frontend, Python, and TypeScript clients for updating experiments have an API endpoint mismatch with the backend. All clients incorrectly include an /update
segment in the URL path. Additionally, the Python and TypeScript SDKs use a POST
method instead of the expected PATCH
. This results in 404 errors.
Additional Locations (2)
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.
Bug: Test Code Issues: Debugging, Hardcoded Values, Localhost URL
The updateExperiment
integration test appears to be debugging code. It includes a console.log
, hardcoded experiment IDs, a localhost
API URL, and commented-out assertions. This setup will likely fail in CI/CD or other test environments.
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.
Bug: Experiment Update Endpoint URL Mismatch
The useExperimentUpdate
mutation sends PATCH
requests to /v1/private/experiments/update/${id}
. The backend's corresponding update endpoint expects /v1/private/experiments/{id}
, without the /update/
segment. This URL mismatch results in 404 errors when updating experiments.
Hi @riturajFi
We've just added a new experiment update API endpoint which supports your use cases, see: #3263
You don't need to implement that part anymore. You can't simplify this PR and simply use it from the FE and SDK changes.
Feel free to rebase the latest changes from main
branch, resolve the conflicts and resume this implementation.
Let me know if any question.
Regards,
Andrés
Uh oh!
There was an error while loading. Please reload this page.
Details
Summary
Introduced a new API for updating an experiment’s name and metadata.
Changes
Screencast.from.2025年09月01日.20-23-22.webm
Change checklist
Issues
Testing
Documentation