Skip to content

packages: detect and log mixin collisions across packages #2245

@bpamiri

Description

@bpamiri

v4.1 Theme A — P2 (mixin collision detection)

When multiple packages (or a package + a legacy plugin) define the same method name, the current PackageLoader silently overwrites via `StructAppend`. The scaffold for collision tracking exists but is dead — `Plugins.cfc` has a `mixinCollisions` array that is never populated.

Evidence

Fix

  • In PackageLoader's mixin injection path, check for existing key before overwrite; if present, record `{target, method, firstPackage, secondPackage}` into an application-level `mixinCollisions` list.
  • Same for Plugins.cfc's legacy path — populate its existing `mixinCollisions` array.
  • Log each collision at load time (warn level) with a clear message: `Method X provided by package A is being overwritten by package B. Explicit conflict resolution recommended.`
  • Expose via `wheels doctor` output — "X mixin collisions detected" with a `--verbose` dump.
  • Optional: allow manifest to declare `provides.overrides: ["existingMethod"]` to acknowledge intentional override and suppress the warning.

Acceptance

  • Two packages both providing `processRequest()` → both load, warning logged, collision listed in `wheels doctor`.
  • Tests cover: single package (no warnings), package + legacy plugin collision, package + package collision, acknowledged override (no warning).

Refs: GA audit P2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions