Fix: sync plugin name from composer.json on update#436
Draft
simonhamp wants to merge 1 commit into
Draft
Conversation
The name-sync guard only set the name when a plugin had none yet, so webhook (push/release) and admin re-syncs never picked up a renamed package. Update the name whenever composer.json's name differs, keeping the uniqueness guard and ignoring blank names. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a plugin submission was updated (via GitHub
push/releasewebhooks or an admin re-sync), the plugin'snamewas never refreshed from itscomposer.json. If a maintainer renamed their package, the database kept the old name.Cause
In
PluginSyncService::sync(), the name-sync block was guarded by! $plugin->name:That guard only allowed the name to be set when a plugin had no name yet (i.e. at creation time). On every subsequent sync the plugin already had a name, so the block was skipped.
Fix
Update the name whenever
composer.json'snamediffers from the stored value:isset()→! empty()so a blank/missingnamecan't wipe an existing one.Tests
Added three feature tests to
PluginSyncServiceTest:test_sync_updates_name_from_composer_when_name_changes— the core fix.test_sync_sets_name_on_initial_sync_when_plugin_has_no_name— protects the creation flow.test_sync_does_not_overwrite_name_when_taken_by_another_plugin— verifies the uniqueness guard.All sync-related suites pass (55 tests). Pint is clean.
Note
Changing a plugin's
namealso affectsis_official, the Satis package name, and the vendor/package URL. This PR syncs the DB field only; re-registering/renaming the Satis package on rename would be a sensible follow-up.🤖 Generated with Claude Code