presseddigital / linkit

Linkit Plugin for Craft 4
Other
28 stars 18 forks source link

Project config YAML files still out of sync even after running `project-config/apply`. #88

Closed mambose closed 3 years ago

mambose commented 3 years ago

Description

Our code deploy pipeline automatically runs ./craft project-config/apply which should sync all project config YAML files but annoyingly when you log into the CMS you are greeted with the Your project config YAML files contain pending changes. warning. Manually clicking the Apply changes only button will fix the issue but the next time ./craft project-config/apply is run the message returns. The changes are all related to linkit plugin see screenshot attached. This issue seems related to #https://github.com/craftcms/cms/issues/5533. I have tried running utils/repair/project-config followed immediately by project-config/rebuild as suggested but it has no effect.

Additional info

Screenshot

docker for mac localhost_admin_utilities_project-config

samhibberd commented 3 years ago

Hey @mambose, thanks for reporting, we are also running into this, although not just with Linkit.

Will try and get to the bottom of it and get a release out of needed.

davidhellmann commented 3 years ago

Same Problem here.

samhibberd commented 3 years ago

We are on the case sorry about this!

peimansh commented 3 years ago

Same problem here.

I think this is related to double-packed associative arrays in the project config. There is a new Craft CLI command named : ./craft utils/repair/project-config In which it repairs the double-packed associative arrays. But then when you run : ./craft project-config/rebuild

Linkit plugin reverts back all the changes which is not in line with latest changes in Craft.

Please fix it.

brandonkelly commented 3 years ago

This was actually happening due to a bug in Craft, which we’ve just fixed in Craft 3.6.11 (https://github.com/craftcms/cms/commit/4d87169c503dbb69fe26219f7fbb82026e8a7220). Please update to that, and then try running the following command:

> php craft project-config/apply --force

If you get an error when running that, run this instead:

> php craft project-config/rebuild
samhibberd commented 3 years ago

Big thanks to @brandonkelly for getting to the bottom of this one!

cristiano-c1 commented 3 years ago

@brandonkelly hi! Not sure this is the right issue, but I think this could be related to this comment.

Currently running: Craft 3.6.12
Php Version: 7.3.18

How I "created" the bug:

I actually have a valid config/project (no __assoc__ in my files) I rename the folder project.legacy, this way, craft will not see the folder anymore. After that I run ./craft project-config/rebuild

Response from the terminal is: No project config files found. Generating them from internal config ... Rebuilding the project config from the current state ... done

Now, if I do a find in folder in the config/project and look for _assoc, the editor list me a lot of files that have been changed from the rebuild

All of them are filled with __assoc__

paths of changed files:

Any hint regarding this??? seems to me that the bug is back...

brandonkelly commented 3 years ago

@cristiano-c1 Nothing is inherently wrong with having __assoc__ keys – those are Craft’s way of keeping track of the order of associative arrays, in cases where the order may be important.

ricricucit commented 3 years ago

Hi @brandonkelly, thanks for the answer (I'm @cristiano-c1's colleague).

We imagined that __assoc__ keys would have been indicators of "corrupted" config files, bc the utils/repair/project-config script was getting rid of all those keys, while repairing.

Are you confirming that this is should not be seen as a "config corruption" indicator?

brandonkelly commented 3 years ago

@ricricucit Correct, they’re expected.