feat(plugin): detect and log mixin collisions across packages (#2245)#2262
Merged
feat(plugin): detect and log mixin collisions across packages (#2245)#2262
Conversation
Closes #2245. PackageLoader now tracks which package registered each method per target and records a collision when another package overwrites it. Cross-system collisions (legacy plugin overwritten by a package) are detected while merging package mixins into the application mixins struct. Packages can acknowledge an intentional override via provides.overrides in package.json; acknowledged overrides log at info level instead of warning. wheels doctor gains a static manifest+CFC scan that surfaces collisions pre-boot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Rename PackageLoader.$methodProviders() public getter to getMethodProviders() so the method name no longer shadows the variables.$methodProviders storage struct on Adobe CF, which keys function declarations in the same variables scope. - Wrap `for (var target in expanded)` in listToArray() — Adobe CF's for...in on a comma-delimited string iterates characters (or errors) rather than list elements, silently zeroing the Doctor scan for packages declaring provides.mixins: "global". - Broaden Doctor's public-function regex: the return type and access modifier are both optional now, catching `public function foo()` and implicit-public `function foo()`. `private` is explicitly filtered. - Skip the cross-system collision warning in Global.$loadPackages when the pre-existing entry has no attributable plugin provider — avoids a misleading "migrate the plugin" recommendation when the prior entry came from something other than a legacy plugin. Co-Authored-By: Claude Opus 4.7 (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.
Summary
PackageLoadernow tracks which package registered each method per target and records a collision when another package or legacy plugin overwrites it — previously silent viaStructAppend.provides.overridesarray inpackage.jsonlets a package declare intentional overrides; acknowledged overrides log at info level instead of warning.Global.cfc.$loadPackagesstitches the runtime collisions (intra-package and cross-system) intoapplication.wheels.mixinCollisionswith asourcetag so the existingplugins.cfmview + debug page surface both kinds.wheels doctorgains a static manifest+CFC scan (regex-based; runtime inPackageLoaderremains authoritative) that surfaces collisions pre-boot.--verbosedump).Test plan
bash tools/test-local.sh— Lucee 7 + SQLite, 3306 pass / 0 fail / 0 error (+6 newPackageLoadermixin-collision specs)bash tools/test-cli-local.sh— 388 pass / 0 fail (+4 newDoctorSpeccollision specs)vendor/wheels/tests/_assets/packages_collision/— isolated from the shared fixtures path so it doesn't pollute other PackageLoader specs.$recordCollisionhelper uses the same patterns already validated for Plugins.cfc.Acceptance against #2245
$sharedHelper→ both load, warning logged, collision listedsource: "cross"with both namesprovides.overrides→acknowledged: true, info log instead of warningwheels doctoroutput