Problem/Motivation
The intended workflow for Configuration Management is to stage configuration changes on a staging site, then to import those changes to the production site. A user who does not follow the intended workflow may make configuration changes to the production site, then later import more configurations from the staging site.
If that happens, the imported configuration changes from staging may overwrite current production values. The purpose of this issue is to provide a warning if configuration changes have been made directly on the production site that could be overwritten by staging.
Proposed resolution
After installation and configuration import we save the active configuration as a snapshot. When the user imports configuration again this can be used to determine if there have been any changes on that specific site instance and warn the user that these changes might be lost on import (unless of course the changes have been implemented on the site you are importing from too).
We should compare the snapshot storage and active storage and issue a warning on admin/config/development/configuration
(synchronize) if this is the case.
Remaining tasks
- Write patch
User interface changes
- New warning on the configuration synchronize screen.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#125 | increment.txt | 873 bytes | pwolanin |
#125 | 2148199-125.patch | 5.86 KB | pwolanin |
#125 | 2148199-125.patch | 5.86 KB | pwolanin |
#123 | increment.txt | 841 bytes | pwolanin |
#123 | 2148199-123.patch | 5.85 KB | pwolanin |
Comments
Comment #1
Barry Madore CreditAttribution: Barry Madore commentedComment #2
cilefen CreditAttribution: cilefen commentedIs the form of this warning intended to be different than, or an enhancement to, "view differences" on admin/config/development/configuration?
Or, is this something we want to have displayed on admin/config/development/configuration/full/import if there are currently config differences?
Comment #3
alexpottComment #4
catchThis looks to me like it'd be fine to add after beta - will only be an interface change no?
Comment #5
xjmYep, this was supposed to be a beta target but looks like it didn't get updated when we decided that.
Comment #6
attila.fekete CreditAttribution: attila.fekete commentedComment #7
attila.fekete CreditAttribution: attila.fekete commentedSince this is my first D8 core patch, I'd really appreciate any feedback.
Comment #8
attila.fekete CreditAttribution: attila.fekete commentedTo option to change between which storage to compare against (active or staging) is still missing. Using active storage as default for the time being.
Comment #9
attila.fekete CreditAttribution: attila.fekete commentedChanges since previous patch:
Comment #10
jessebeach CreditAttribution: jessebeach commentedThe
l()
function should not be used in Drupal 8. There might be a link generation service now. Maybelink_generator
?Comment #11
tim.plunkettIf you change the class to extend ControllerBase, you can do the following:
$compare_button = $this->l($this->t('Compare snapshot with staging storage'), 'config.snapshot_diff', array('storage' => 'staging'), array('attributes' => array('class' => array('button'))));
You use the route name and an array that matches the parameters. Also note that attributes=>class should be an array, not a string.
This can also be
'#route_name' => 'config.sync'
Use $this->url()
Comment #12
jessebeach CreditAttribution: jessebeach commentedScreenshot of suggested changes:
Comment #13
attila.fekete CreditAttribution: attila.fekete commented@jessebeach, @tim.plunkett: thanks for the review!
Managed to fix all issues, I think:
#route_name
instead of#href
$this->urlGenerator()->generateFromRoute()
to$this->url()
Comment #14
attila.fekete CreditAttribution: attila.fekete commentedUploading patch again because tests didn't run.
Comment #15
attila.fekete CreditAttribution: attila.fekete commentedComment #16
mtift14: show-snapshot-and-active-or-staging-storage-diff-2148199-13.patch queued for re-testing.
Comment #18
mtiftJust a reroll
Comment #20
mtiftMissed a comma
Comment #21
mtiftComment #23
cilefen CreditAttribution: cilefen commentedComment #24
cilefen CreditAttribution: cilefen commentedComment #25
cilefen CreditAttribution: cilefen commentedComment #26
cilefen CreditAttribution: cilefen commentedLeft in an extra parameter.
Comment #27
cilefen CreditAttribution: cilefen commentedShould we add "write tests" to remaining tasks or will that be a separate issue?
Comment #28
cilefen CreditAttribution: cilefen commentedComment #29
alexpottNot entirely sure the single import form should have this message. In fact I'm sure. It should not since it does not make a snapshot after you are done.
$this->t() instead of t()
This is needs to be translatable. So we need to do a switch and use $this->t() like the config synchronisation form does.
We should only be doing this is the form has not been submitted... so check that
$form_state['input']
is empty. Otherwise the message will appear after the import is completed.Yep we need to add tests in the this issue.
Comment #30
alexpottComment #31
cilefen CreditAttribution: cilefen commentedI started sketching out the tests.
Comment #33
cilefen CreditAttribution: cilefen commentedUsing randomName() instead of randomString() to test the slogan change because randomString() can be interpreted as HTML.
Comment #34
Bojhan CreditAttribution: Bojhan commentedLet me know when its ready for review.
Comment #35
cilefen CreditAttribution: cilefen commentedComment #36
cilefen CreditAttribution: cilefen commented@alexpott Correct me if I am wrong on these:
1) That controller isn't the single import form. The warning does not appear on the single import form anyway.
3) $name is the config machine name, so I don't think it is translatable.
Comment #37
alexpott1) you are right - still the check does not need to be there. The form is for uploading an config tar ball.
3) you are totally right
Comment #38
cilefen CreditAttribution: cilefen commentedOk, now I see. I think I am confused between "Import" in config system parlance with "import" as in importing a file.
Comment #39
cilefen CreditAttribution: cilefen commentedAssuming the error is now displayed on the correct path...
@attila.fekete First, good job on this task. I am wondering if it would make better sense to display the "Compare snapshot with staging storage" tabs instead of buttons. After considering it, that is what I would expect to see as a site admin. What do you think about that?
@Bojhan This patch works and has its basic tests. You can probably review it now.
Comment #40
pwolanin CreditAttribution: pwolanin commentedfix comment:
has 2 dots and maybe should be "Tests that"
Also a long line in the test is wrapped using string concatenation - just put it on one line
Comment #41
cilefen CreditAttribution: cilefen commentedComment #42
cilefen CreditAttribution: cilefen commented41: show-snapshot-and-active-or-staging-storage-diff-2148199-41.patch queued for re-testing.
Comment #43
pwolanin CreditAttribution: pwolanin commentedI'm not clear why this is a button. It would make more sense as a tab or tabs. Can we do that instead?
Comment #44
jessebeach CreditAttribution: jessebeach commentedWould someone be a gem and post a screenshot for me :) Pretty please.
Comment #45
cilefen CreditAttribution: cilefen commentedComment #46
pwolanin CreditAttribution: pwolanin commentedI don't think this should be a toggle button. Also the UI presentation is inconsistent with the main table showing differences. I feel like we could have 3 sub stabes.
Also, if there is no content in the staging storage, we should show a relevant message to that effect, rather than indicating no differences.
Comment #47
cilefen CreditAttribution: cilefen commented@pwolanin: something like this?
I think the alert will stay (not shown here though) and each tab will show exactly the same kind of table.
Comment #48
cilefen CreditAttribution: cilefen commentedThis is a prototype with the tabs, for a more consistent view of the changes.
Comment #49
cilefen CreditAttribution: cilefen commentedScreenshots.
Comment #50
cilefen CreditAttribution: cilefen commentedComment #51
cilefen CreditAttribution: cilefen commentedComment #52
cilefen CreditAttribution: cilefen commentedComment #54
cilefen CreditAttribution: cilefen commentedComment #55
cilefen CreditAttribution: cilefen commentedComment #56
pwolanin CreditAttribution: pwolanin commentedThanks - I think bringing these to tabs and making them visually consistent is better UX.
Comment #57
pwolanin CreditAttribution: pwolanin commented54: show-snapshot-and-active-or-staging-storage-diff-2148199-54.patch queued for re-testing.
Comment #59
cilefen CreditAttribution: cilefen commentedMaking sure I can get screenshots into the summary.
Comment #60
cilefen CreditAttribution: cilefen commentedComment #61
cilefen CreditAttribution: cilefen commentedScreenshots in the issue summary.
Comment #62
cilefen CreditAttribution: cilefen commentedReroll.
Comment #63
cilefen CreditAttribution: cilefen commentedWhatever happens with testbot, I need to be sure I didn't cause a regression in #2262861: Add concept of collections to config storages
Comment #64
cilefen CreditAttribution: cilefen commentedComment #65
xjmComment #66
xjmComment #67
xjmComment #68
cilefen CreditAttribution: cilefen commented@alexpott and I discussed on IRC and a problem with this patch is the Import (sync) button appearing on the "Compare snapshot with active" and "Compare snapshot with staging tabs". It should not be there, and the tab placement doesn't help.
Comment #69
alexpottComment #70
cilefen CreditAttribution: cilefen commentedI think the thing to do is just two simple tables on the config sync form: the current one for comparing staging to active, and a new one below it comparing snapshot and active. The warning would remain.
Comment #71
cilefen CreditAttribution: cilefen commentedThis is a new UI approach. I will update the summary with new screenshots.
Comment #72
cilefen CreditAttribution: cilefen commentedNew screenshots.
Comment #74
cilefen CreditAttribution: cilefen commentedRerolled for #1848266: Convert Diff into a proper, PSR-0-compatible PHP component.
Comment #75
pwolanin CreditAttribution: pwolanin commentedComment #77
xjmThanks @cilefen for your continued work here.
This message doesn't tell me what I need to know. When I read this, I think: How did the changes get made to my active configuration? What is the "next import attempt"? Does that mean what I'm trying to do right now on this form, or something else? Does "attempt" mean it's not likely to work? What am I supposed to do?
Also, the comma is ungrammatical and should be removed.
I also find the new UI very overwhelming. I don't know what the "changes to the Active Configuration" are (nor why it's capitalized). It would be better to compare the screenshots for both the previous approach and the current one in your comment rather than updating the issue summary before the suggested approach has consensus or has even been reviewed. Thanks!
Comment #78
xjmI think maybe we should get the help of the usability team here.
Comment #79
cilefen CreditAttribution: cilefen commentedHow do we get the usability team involved?
Comment #80
Bojhan CreditAttribution: Bojhan commentedYou called? We generally use the "Needs usability review" tag.
I think its best to hop on IRC or Skype, to talk this UI over - I have not been able to understand from the comments what considerations need to be made.
Comment #81
xjmWe explain the problem more clearly in the issue summary, for someone who isn't familiar with the problem space and won't be looking at code. (I.e., it needs an explanation of how a site would get into this state and specific steps to follow on an 8.x installation to test both the current functionality and the patch.) Then we ask for a usability review. :)
Thinking about it a bit, a better warning message might be something like: "Your site's configuration has changed since the last configuration import. Importing new configuration (may? will?) overwrite these changes." (Regarding "may" or "will", can/should we detect if the changes since last import are not included in what's staged, and only display the warning if the changes are not in both places? Or is that too fragile?)
Edit: or, what Bojhan said. :) Crossposted.
Comment #82
xjmComment #83
xjmOr maybe:
The second half of the message is only relevant when there is staged configuration, obviously.
Comment #84
cilefen CreditAttribution: cilefen commentedUpdated the summary Problem/Motivation as I understand the issue.
Regarding the warning message—in its current incarnation all changes are indicated, regardless of what's in staging. So, we could either be vague and say "could be overwritten", or improve the patch and say "some will be overwritten" if that is the case.
Comment #85
alexpottLets not do the whole UI thing here. We should just be adding a message that warns the user that the snapshot is different from the active and therefore a config sync with staging might produce unexpected results. We can deal with a the UI in a follow up.
Comment #86
cilefen CreditAttribution: cilefen commentedUpdated the summary as per the new plan.
Comment #87
cilefen CreditAttribution: cilefen commentedComment #88
Bojhan CreditAttribution: Bojhan commentedWhat about "Your current configuration has changed, these changes will be lost on the next synchronization."
Comment #89
cilefen CreditAttribution: cilefen commented@bojhan: that's certainly better.
Comment #90
cilefen CreditAttribution: cilefen commentedComment #91
xjmThat's a comma splice. It should be two separate sentences. :)
Do we want to follow it with a list of just the names of the config objects that have changed? So the site user has a clue where to look. Edit: ie:
Comment #92
cilefen CreditAttribution: cilefen commented@xjm We could do that because it is cryptic to not explain what these changes are. But then we are back to designing a UI, which I think is important, but I agree with @alexpott to make it a separate issue.
Comment #93
xjmNo, I am not saying to add a UI. I am saying simply that the message should include a list of the objects that will have their changes lost. I.e.:
Just in the dsm(), no UI. @alexpott agreed with this suggestion.
Comment #94
cilefen CreditAttribution: cilefen commentedComment #95
alexpottShould use a placeholder.
Comment #96
cilefen CreditAttribution: cilefen commentedComment #97
alexpottI think we should be using % instead of @ here.
Comment #98
cilefen CreditAttribution: cilefen commentedComment #99
Bojhan CreditAttribution: Bojhan commentedWhy are these not bullets?
Comment #100
cilefen CreditAttribution: cilefen commented@Bojhan I am indifferent. If that is the standard should I just file a new patch?
Comment #101
cilefen CreditAttribution: cilefen commentedComment #102
Bojhan CreditAttribution: Bojhan commentedThat is generally the standard.
Comment #103
cilefen CreditAttribution: cilefen commentedComment #104
xjmThat looks great to me. Nice work! The only thing I'm not sure of is the early render of the item list, but I think we're partly limited by how
drupal_set_message()
works there. And an early render in a one-time warning seems acceptable to make the list legible.Comment #105
alexpottThe full stop here is problematic since this text can never appear in the UI. I would remove this assertion. The update of the snapshot after an import is tested elsewhere.
Comment #106
cilefen CreditAttribution: cilefen commentedComment #107
cilefen CreditAttribution: cilefen commentedComment #108
cilefen CreditAttribution: cilefen commentedReroll.
Comment #109
cilefen CreditAttribution: cilefen commented"There are no configuration changes." is a confusing message when this warning appears. I recommend opening another issue to change that text to "There are no configuration changes to import."
Comment #111
cilefen CreditAttribution: cilefen commentedComment #112
cilefen CreditAttribution: cilefen commented#2336353: The message when there is no configuration to synchronize/import is misleading
Comment #113
xjmThe changes from #106 look good; +1 for not duplicating test coverage.
Comment #114
alexpottCommitted fcc5b62 and pushed to 8.0.x. Thanks!
Fixed on commit. The new @param doc was incorrect and the just made everything consistent.
Comment #117
alexpottThis broke head - patch needs to be fixed with changes from #114 and...
Can no longer use array access on $form_state - this needs to be
!$form_state->has('input')
Comment #118
pwolanin CreditAttribution: pwolanin commentedTalking with @cilefen in person. I'll re-roll this today.
Comment #119
pwolanin CreditAttribution: pwolanin commentedshowing the incremental diff to #108, since includes #114 and the fix indicated in #117
Comment #121
pwolanin CreditAttribution: pwolanin commentedI'm not sure why the check on input was there - talking with @cilefen it's not clear why it's there, and it doesn't make sense that you want to show the message AFTER submitting the form.
Removing that check at least that one test passes, but need some evaluation as to whether this is correct.
Comment #123
pwolanin CreditAttribution: pwolanin commentedsilly me - now I see, I forgot the
!
Comment #125
pwolanin CreditAttribution: pwolanin commentedugh. oops. get() gets form values NOT other form state properties. In other words, the suggested fix checked the equivalent of
$form_state['values']['input']
I think this method will work.
Comment #126
cilefen CreditAttribution: cilefen commentedI manually tested and it looks good.
Comment #127
alexpottCommitted 6a6e528 and pushed to 8.0.x. Thanks!
Comment #130
Gil00 CreditAttribution: Gil00 commentedThe warning makes no sense on a development site where the synchronization process can be used intensively to travel in the configuration timeline.
A solution could be to check if the site is configured in dev mode, ie if the include of the file settings.local.php is uncommented in the configuration file settings.php
Another solution would be to add (in the warning area) an option "This is a development site" which remove that kind of warning.
Comment #131
BerdirYou're welcome to open new issues to suggest improvements. This has been closed, there's no use in opening it again.