Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.4.4]: Project config conflicts due to inconsistency between lowercase / uppercase file naming [edit] #15774

Open
davidwebca opened this issue Sep 21, 2024 · 1 comment
Labels

Comments

@davidwebca
Copy link
Contributor

davidwebca commented Sep 21, 2024

What happened?

Description

I've noticed there's an entry type that won't sync up its fields when I apply config changes on the remote staging server after adding fields locally.

I narrowed it down to the fact that I added a tab to hide some options in my fields. When added, the entry type is never able to re-sync, it never detects the changes made locally anymore after that. I've made some tests and that's what it comes down to (see steps below).

Edit: Files saved on Ubuntu generated a copy of the same YML file with the lower-case name of the entry type instead of the upper-case file name and after that, Craft wouldn't pick up the correct uppercase file anymore, only the lower-case one.

Steps to reproduce

1. Create a section with an entry type and add some fields - I don't think the type of fields is relevant, though I haven't tested this exhaustively.
2. Commit the project configs changes and deploy on a staging environment
3. Apply with the command line on this staging environment.
4. Changes are applied, fun, all is good.
5. Add a tab on the local environment, add some fields in the tab.
6. Commit the project config changes and deploy on the same staging environment.
7. Apply with the command line on this staging environment.
8. No changes are applied, even though they are in the "tabs" yaml attribute in the project config file of the entry type.
9. Afterwards, changing back to remove the tabs and remove some fields will never work again on the staging environment as if everything was desynced and undetectable.
10. Re-building the configs entirely on the local environment doesn't change a thing, the bug persists.

  1. Create a section and entry type with uppercase in handle name on a local MacOS environment
  2. The YML files are generated with the uppercase entry type name (PostArticle--d950f9f7-4c8b-4eae-8be4-00ecb355aff9.yml)
  3. Upload and sync with project-config/apply on the remote Ubuntu environment
  4. Rebuild the configs with project-config/rebuild on the remote Ubuntu environment
  5. Notice the duplicate file created (postarticle--d950f9f7-4c8b-4eae-8be4-00ecb355aff9.yml).
  6. Now, only the new file will get considered and the changes uploaded to the PostArticle--d950f9f7-4c8b-4eae-8be4-00ecb355aff9.yml file will never get picked up because the environment thinks its not the same file.

Expected behavior

The newly added and changed fields and tabs should be applied.

Craft should normalize the file names to always use lowercase in its file names to avoid conflicts between environments and file storage systems.

Actual behavior

Once a tab is added to an entry type, other environments will never receive the changes again.

A duplicate config file gets created and prevents the previous correct one to ever get re-synced again.

Craft CMS version

5.4.4

PHP version

8.2.18

Operating system and version

MacOS locally (Sequoia) - Staging remote is Ubuntu

Database type and version

MySQL 8.3.0

Image driver and version

Imagick 3.7.0

Installed plugins and versions

Name                   Handle                 Package Name                    Version                 Installed  Enabled
---------------------  ---------------------  ------------------------------  ----------------------  ---------  -------
CKEditor               ckeditor               craftcms/ckeditor               4.2.0                   Yes        Yes
Colorit                colorit                presseddigital/colorit          dev-master              Yes        Yes
Entry GPS Coordinates  entry-gps-coordinates  nthmedia/entry-gps-coordinates  dev-master              Yes        Yes
Field Manager          field-manager          verbb/field-manager             4.0.2                   Yes        Yes
Formie                 formie                 verbb/formie                    3.0.7                   Yes        Yes
Hyper                  hyper                  verbb/hyper                     2.0.5                   Yes        Yes
Icon Picker            icon-picker            verbb/icon-picker               3.0.1                   Yes        Yes
Navigation             navigation             verbb/navigation                3.0.4                   Yes        Yes
oEmbed                 oembed                 wrav/oembed                     dev-feature/gql-params  Yes        Yes
Route Map              route-map              nystudio107/craft-routemap      dev-craft-5             Yes        Yes
SEOmatic               seomatic               nystudio107/craft-seomatic      5.1.3                   Yes        Yes
Control Panel Nav      cp-nav                 verbb/cp-nav                    5.0.2                   No         No
@davidwebca davidwebca added the bug label Sep 21, 2024
@davidwebca
Copy link
Contributor Author

Update: Unrelated to the tabs in the end. I'll rename the bug as it could be something you'd like to take a look into: the bug comes from a rebuild on the remote (Ubuntu). I rebuilt the config files on the remote at one point because it had some things I wanted to pull down and the rebuild caused (without me realizing at the time) to have multiple duplicates of the same files, but with lowercase names. Ex.: PostArticle--d950f9f7-4c8b-4eae-8be4-00ecb355aff9.yml had a duplicate file beside it called postarticle--d950f9f7-4c8b-4eae-8be4-00ecb355aff9.yml.

I know there are differences in case sensitivity handling between MacOS nowadays and other platforms, but I'm quite surprised that Craft didn't detect the existing file and just created a new one beside it, and then never re-considered the real ones I was uploading and prioritizing the ones it had created itself on the remote. That explains why the changes I was trying to reapply would never appear (Craft wasn't loading the proper file altogether).

@davidwebca davidwebca changed the title [5.4.4]: Adding a tab de-syncs the project config YML files [5.4.4]: Project config conflicts due to inconsistency between lowercase / uppercase file naming [edit] Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant