Affects Version/s: 7.2.X, Master
When staging is activated in a site, segments are unstaged by default. This way, the segments are the same for both the live and the staging environments.
In this setup, there is a strange behavior, which can be reproduced as follows:
- Create a site
- Create 2 segments seg1 and seg2 in the site
- Create a content page cp1 in the site
- Add a text fragment to cp1, write "default" in it. Publish cp1
- Create a new experience for cp1. Name it exp1 and select seg1 for the Audience field
- In the text fragment, write "segment 1". Publish cp1
- Checkpoint: you can switch default and exp1 experiences, cp1 reflects the differences
- Enable staging in that site. (Note: ensure "Segments" checkbox remains unchecked, that's the default)
- Go to staging site. Visit cp1.
- Create a new experience for cp1
- Go to the Audience drop down, click on it to select the audience
Observed: only seg1 is available for selection
Expected: both seg1 and seg2 are available, or, if seg1 is already part of an existing experience for cp1, only seg2 is available.
As a result, It is not possible to create new experiences based off on "unused" segments when working in the staging environment.
If we assume that site authors are interested in previewing all the experiences for a content page in the staging environment before publishing it to live, the reported behavior shall be considered a bug. This is even more clear if one considers that content pages can not be edited in the live environment, which implies that, in practise, it's not possible to use segments which were not part of the initial publication process. Finally, segments are being duplicated in both groups (staging & live), which goes against the settings used to activate staging.
Possible explanation: system looks for the segments using the stagingGroupId even if segments are not staged. In the staging activation process, existing experiences were transferred to the staging environment, making a copy of seg1 in that environment (I've checked this in the DB). This should not happen as segments are not staged
In case of this being the expected behavior, then we shall remove the option of selecting "Segments" in the staging configuration as their participation in the staging process would be mandatory, very much as content pages and experiences are.