Characterize plugin registry load order and lookup contract#16004
Characterize plugin registry load order and lookup contract#16004jamesfredley wants to merge 1 commit into
Conversation
Assisted-by: opencode:gpt-5.6-sol
There was a problem hiding this comment.
Pull request overview
Adds a new characterization-style Spock spec to pin down the publicly observable GrailsPluginManager registry behavior around plugin load order vs topological order, including determinism across repeated builds, deduplication, and consistent lookup identity across name/class-name/version APIs. This helps protect expected behavior ahead of future plugin discovery/registry optimizations.
Changes:
- Introduces
DefaultGrailsPluginManagerRegistryContractSpecto assert deterministic plugin discovery load order and deterministic topological registry order for the same dependency graph. - Adds coverage for duplicate-registration deduplication and consistent lookup resolution (
getGrailsPlugin,getGrailsPluginForClassName, versioned lookup) returning the same instance.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def tailPlugins = manager.getAllPlugins().findAll { it.name == 'registryOrderingTail' } | ||
| def expectedTailPlugin = tailPlugins.first() | ||
| def pluginByName = manager.getGrailsPlugin('registryOrderingTail') |
|
To make the selection safe and avoid Here is the suggested update for the test: when:
def tailPlugins = manager.getAllPlugins().findAll { it.name == 'registryOrderingTail' }
def expectedTailPlugin = tailPlugins ? tailPlugins.first() : null
def pluginByName = manager.getGrailsPlugin('registryOrderingTail')This change ensures that grails-core/src/test/groovy/grails/plugins/DefaultGrailsPluginManagerRegistryContractSpec.groovy |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16004 +/- ##
==================================================
+ Coverage 51.1168% 51.1200% +0.0031%
- Complexity 17597 17601 +4
==================================================
Files 2041 2041
Lines 95493 95493
Branches 16587 16587
==================================================
+ Hits 48813 48816 +3
+ Misses 39394 39391 -3
Partials 7286 7286 🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 44d5cfa Learn more about TestLens at testlens.app. |
Summary
loadPlugins()/getPluginsInLoadOrder()and thegetAllPlugins()topological orderScope note
Test-only; no production changes. Exercises only public
GrailsPluginManagerAPIs and deliberately does not duplicate the existingGrailsPluginSorterSpecsorter coverage - it characterizes end-to-end manager registry output instead.Verification
This is an AI-generated starting point pinning the plugin-registry/load-order contract.