UUID is regenerated every time a pattern is saved

Created on 19 July 2017, almost 8 years ago
Updated 1 August 2024, 9 months ago

I'm seeing what feels like an oddity around UUIDs for pathauto pattern configurations, resulting in complexity around our config/code versioning workflow.

Repeatability

Every time a pattern is saved.

Steps to reproduce:

  1. Create a pathauto pattern
  2. Export configuration (drush config-export or via GUI)
  3. "Edit" the pattern and save, with or without changes
  4. Export configuration again

Expected result

UUID visible in the export steps remains consistent.

Actual result

The UUID is different, and is regenerated each time the pattern is saved.

Notes

This may be expected behaviour but it's causing us some workflow and config sync issues. (Although once we've stabilised our patterns it won't be an ongoing problem.)

We've been working around it in the meantime by generating UUIDs in production and manually replacing them in our local code before committing, but I'm worried this may have unintended consequences.

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom jrsouth

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Pipeline finished with Failed
    10 months ago
    Total: 166s
    #202829
  • Pipeline finished with Failed
    10 months ago
    Total: 166s
    #202837
  • Pipeline finished with Success
    10 months ago
    Total: 175s
    #202843
  • Assigned to codebymikey
  • Status changed to Needs review 10 months ago
  • Added change to \Drupal\pathauto\Entity\PathautoPattern::addSelectionCondition() which persists the UUID if the configuration includes a uuid property saving the need to regenerate a unique UUID everytime.

  • Status changed to Needs work 9 months ago
  • 🇨🇭Switzerland berdir Switzerland

    This looks good at first glance, but it's a non-trivial amount of code to the form handling, would be great to make sure we have tests covering this. There is \Drupal\Tests\pathauto\FunctionalJavascript\PathautoUiTest::testPatternsWorkflow, where we add, edit and delete patterns, but we have little coverage for the conditions, specifically nothing about removing them.

    So, would be good to extend that by removing the bundle condition and then also once save a pattern and ensure nothing on the config entity changes (load config entity, toArray(), save in UI without changes, then load again and compare)

Production build 0.71.5 2024