Project Config rebuild creates inconsistencies
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
I know this has been mentioned in a few issues, but I wanted to document a good couple of issues that would be great to resolve. Each time we rebuild the project config for projects, we find there are oodles of changes, which kind of freaks me out.
Most are harmless, but the constant level of change means that we can easily overlook potentially incorrect changes or bugs. If there are always harmless changes we get used to just committing everything blindly, which isn't great.
Below are some examples:
Type changes, including integers and booleans. See https://github.com/craftcms/cms/issues/6979
field: 2642eb7b-2a92-4acf-9bb7-68adaf91310f
name: Columns
-sortOrder: 25
+sortOrder: '25'
-required: '0'
+sortOrder: false
settings:
- default: ''
+ default: false
-titleFormat: ''
+titleFormat: null
Array changes, seems to expand serialised arrays sometimes
-childBlocks:
- - card
+childBlocks: '["card"]'
field: 2642eb7b-2a92-4acf-9bb7-68adaf91310f
fieldLayouts:
- -
+ 085c0254-f2ed-48f8-b8cc-915776480da8:
tabs:
-
elements:
-
fieldUid: e2dcbd9e-0478-40ec-886a-b7210d695a22
instructions: null
label: null
enableVersioning: true
handle: news
name: News
previewTargets:
-
- label: 'Primary entry page'
- urlFormat: '{url}'
+ __assoc__:
+ -
+ - label
+ - 'Primary entry page'
+ -
+ - urlFormat
+ - '{url}'
+ -
+ - refresh
+ - '1'
propagationMethod: all
siteSettings:
011ae8e8-6cf1-434b-a64f-bd430fc3354b:
enabledByDefault: true
hasUrls: true
template: news/_entry
uriFormat: 'news/{postDate.year}/{slug}'
User Photos asset volume's field layout keeps getting re-created each time I run rebuild, despite not touching it at all.
userPhotos--a35713a1-7237-49a1-ac3e-0fa1d1b5bded.yaml
fieldLayouts:
- f8017d72-d47a-4715-91de-93ef22515ee4:
+ ea9c4d86-95af-453d-bb31-6e7fe48f7953:
tabs:
-
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
fieldLayouts:
- ea9c4d86-95af-453d-bb31-6e7fe48f7953:
+ b8889af8-68ce-444e-b4d5-1c6d1585d6c9:
tabs:
-
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
This can be pretty consistently reproduced by saving a section or a field, which will trigger any of the above changes to the yaml files. Then, triggering a project config rebuild will trigger more changes - just feels like it's always changing!
There's probably more examples, and I'll add them as I come across them.
Additional info
- Craft version: 3.5.15.1
- PHP version: 7.2
- Database driver & version: MySQL 5.7.30
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by saving a section or field, then rebuilding the project config and comparing the generated YAML. Start with the named userPhotos--a35713a1-7237-49a1-ac3e-0fa1d1b5bded.yaml file and the listed type, array, and field-layout changes; done means repeated rebuilds no longer introduce unintended differences.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100