发布

  • [issue-2572] [FE] Update experiment name metadata in UI (#3136)

    frostbyte_neo 发布于 2025-11-24 09:46:26 +00:00

    • [issue-2572] [FE] [SDKs] Update experiment name and metadata

    • Removed BE implementation

    • Revision 2: Fix API endpoints and clean up duplicate methods in SDKs

    • Fixed frontend to use correct PATCH endpoint (removed /update/ from path)
    • Converted UpdateExperimentDialog to TypeScript with proper types
    • Removed duplicate update_experiment methods from Python SDK
    • Updated opik_client to use correct method signature
    • Fixed TypeScript SDK to use correct updateExperiment method
    • Removed unused UpdateExperimentRequest type and duplicate methods
    • Deleted unused useConfirmAction hook duplicate
    • Revision 3: Fix TypeScript SDK tests for updateExperiment
    • Updated unit test mocks to use correct method name (updateExperiment instead of updateExperimentById)
    • Removed integration test with hardcoded IDs and localhost URL
    • Integration tests belong in tests_end_to_end, not in unit test suite

    Addresses cursor bot PR comment about test quality issues

    • Removed auto-generated code

    • Rebase experiments SDK clients

    • Address copilot comment

    • Revision 4: Address andriidudar's review comments for consistency

    • Replaced Monaco Editor with CodeMirror (existing in codebase)
    • Updated API hook to match useProjectUpdateMutation naming pattern
    • Refactored ExperimentRowActionsCell to use single state (boolean | number)
    • Changed button text from 'Update' to 'Edit' with Pencil icon
    • Replaced custom input with Input component from ui/input.tsx
    • Removed Monaco editor dependency from package.json

    All changes follow existing codebase patterns for consistency.

    Addresses all comments from andriidudar's review.

    • Linting FE

    • Revision 5: Add query cache invalidation, dialog state reset, and change detection

    • Revision 6: Add parameter validation and test for Python SDK update_experiment

    • Improvements

    • Revision 7: Refactor updateExperiment tests to use shared spy setup

    • Manual review

    • Revision 8: Rename metadata to configuration in public-facing APIs

    • Revision 9: Add documentation for updating experiment name and configuration

    • Revision 10: Add UI screenshots to update experiment documentation

    • Linting P SDK

    • Revision 11: Fix configuration fallback logic to allow clearing with empty object

    • Revision 12: Align dialog state initialization with codebase patterns

    • Update sdks/python/src/opik/api_objects/opik_client.py

    Co-authored-by: Copilot 175728472+Copilot@users.noreply.github.com

    • Revision 13: Add name validation to experiment update dialog

    • Revision 14: configuration validation

    • Revision 17: Address Copilot review - fix useEffect deps, add defensive null guard, add TS SDK validation

    • Revision 19: Address Copilot review - update state on prop changes, move invalidation to onSuccess, simplify parsing

    • Revision 20: Revert dialog state initialization change, keep only onSuccess and simplified parsing fixes

    • Revision 22: Add Python SDK parameter validation and test for update_experiment

    • Revision 23: Complete JSDoc for TypeScript SDK updateExperiment method

    • Revision 24: Clear validation errors on dialog reset and remove unnecessary return

    • Revision 25: Fix useEffect deps to prevent state reset when props change while dialog is open

    • Updated docs images

    • Revision 26: Fix SDK update_experiment to only send provided parameters

    • Both Python and TypeScript SDKs now conditionally include only the parameters that are provided
    • Python SDK uses OMIT sentinel value to exclude unprovided fields
    • TypeScript SDK builds payload object dynamically
    • This prevents clearing name when only updating config, and vice versa
    • Added comprehensive test coverage for all three scenarios: name-only, config-only, and both
    • Revision 34: Fix ClickHouse experiment update query to use latest row
    • Add ORDER BY last_updated_at DESC LIMIT 1 to ensure the query selects the most recent row
    • Prevents bug where partial updates could select old historical rows and overwrite current values with ancient data
    • Add regression test for multiple partial updates to verify latest values are preserved
    • Updated TS signature

    • Revision 36: Use random values in updateExperiment regression test

    • Replace hardcoded strings with RandomStringUtils.secure().nextAlphanumeric()
    • Replace hardcoded JSON metadata with podamFactory.manufacturePojo(JsonNode.class)
    • Aligns with existing test patterns in ExperimentsResourceTest
    • Improves test robustness by using unique random values each run

    Co-authored-by: Andres Cruz andresc@comet.com

    下载附件