Skip to content

Conversation

@bcb37
Copy link
Collaborator

@bcb37 bcb37 commented Dec 9, 2025

No description provided.

Copy link
Contributor

Copilot AI left a 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 implements the duplicate experiment modal and functionality, allowing users to create a copy of an existing experiment with all its configurations including conditions, partitions, factors, condition payloads, and other metadata.

Key changes:

  • Added openDuplicateExperimentModal() method in the dialog service to handle duplicate action
  • Implemented createDuplicateRequest() method to build the experiment request with source experiment data
  • Updated backend to properly handle ID mapping for conditions, decision points, and condition payloads during duplication

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/projects/upgrade/src/app/shared/services/common-dialog.service.ts Added new method to open duplicate experiment modal with appropriate configuration
frontend/projects/upgrade/src/app/features/dashboard/experiments/pages/experiment-details-page/experiment-details-page-content/experiment-overview-details-section-card/experiment-overview-details-section-card.component.ts Replaced TODO comment with call to duplicate experiment modal
frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/upsert-experiment-modal/upsert-experiment-modal.component.ts Added duplicate action support including new createDuplicateRequest() method and updated form initialization logic
frontend/projects/upgrade/src/app/features/dashboard/experiments/modals/upsert-experiment-modal/upsert-experiment-modal.component.html Updated template conditions to include duplicate action when showing context change warnings
frontend/projects/upgrade/src/app/core/experiments/store/experiments.effects.ts Refined navigation logic to check for exact experiment detail URL match
backend/packages/Upgrade/src/api/services/ExperimentService.ts Refactored ID mapping to use local maps, moved condition payload creation after conditions/decision points are created, and added null-safety check for condition payloads

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

bcb37 and others added 3 commits December 9, 2025 17:19
…ts/modals/upsert-experiment-modal/upsert-experiment-modal.component.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bcb37 bcb37 requested a review from danoswaltCL December 16, 2025 16:27
@danoswaltCL
Copy link
Collaborator

The submit button is greyed out initially, even though technically we ought to be able to duplicate an experiment with all the exact same form values, as the experiment name doesn't have to be unique. The constraint on changing from initial-values in the upsert-exp modal shouldn't apply to the DUPLICATE mode.

btw we're doing something slightly different for the name and submit behavior each entity when duplicating...

  • for flags we remove the name of flag, forcing the user to write something new in before they can submit.
  • when duplicating segments, we tack on (COPY) to the name, and they can submit immediately.
  • here we're duplicating all the values, it's the same name... which is technically valid, BUT I can't submit immediately, as if this is an EDIT form where you have to make a change in order to be allowed to submit.

so the secondary thing is if we want some consistency here. probably not terribly important but food for thought. cc: @zackcl

@bcb37 bcb37 requested a review from danoswaltCL December 17, 2025 19:53
@zackcl
Copy link
Collaborator

zackcl commented Dec 18, 2025

Yeah, I think we should make the duplicate modal behavior consistent across feature flags, segments, and experiments. The segment approach of auto-tacking on “(COPY)” feels the most intuitive since it allows immediate submit while still letting users rename if they want.

The submit button is greyed out initially, even though technically we ought to be able to duplicate an experiment with all the exact same form values, as the experiment name doesn't have to be unique. The constraint on changing from initial-values in the upsert-exp modal shouldn't apply to the DUPLICATE mode.

btw we're doing something slightly different for the name and submit behavior each entity when duplicating...

  • for flags we remove the name of flag, forcing the user to write something new in before they can submit.
  • when duplicating segments, we tack on (COPY) to the name, and they can submit immediately.
  • here we're duplicating all the values, it's the same name... which is technically valid, BUT I can't submit immediately, as if this is an EDIT form where you have to make a change in order to be allowed to submit.

so the secondary thing is if we want some consistency here. probably not terribly important but food for thought. cc: @zackcl

@zackcl
Copy link
Collaborator

zackcl commented Dec 18, 2025

@bcb37 It seems like the duplicated experiment’s include/exclude list description is being filled with a UUID when the original list’s description is empty. The duplicated experiment’s include/exclude list description should remain empty if the original list’s description is empty.

Original experiment's exclude list:
Screenshot 2025-12-18 at 10 54 24 AM

Duplicated experiment's exclude list:
Screenshot 2025-12-18 at 10 55 57 AM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Experiment Design (Overview Section Card)

4 participants