Skip to content

feat(registry) #25 Give the service ids in the error on duplicate adapter codes - #26

Merged
njoubert-cleverage merged 2 commits into
mainfrom
25
Sep 30, 2026
Merged

njoubert-cleverage merged 2 commits into
mainfrom
25

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #25.

Two adapters with the same code made every cache process fail with Adapter <code> is already defined, without telling which services are in conflict (they usually share the same class).

  • RegisterAdaptersPass (new): registers the services tagged cleverage.cache.adapter in AdapterRegistry with their service id, replaces the generic RegistryCompilerPass
  • AdapterRegistry::addAdapter(): new optional $serviceId argument; on a duplicate code, the message gives the ids of both services (unchanged message when an id is missing)
  • AdapterRegistryTest, RegisterAdaptersPassTest (new)
  • reference/adapter.md: update the note on unique codes

Checked with process-bundle-demo, with a second App\Adapter\MemoryAdapter service tagged cleverage.cache.adapter: demo.cache.set_get now fails with Adapter memory is already defined by service "app.cleverage_cache_process.adapter.memory", cannot register service "app.cleverage_cache_process.adapter.memory_duplicate"; without the duplicate, it still runs successfully.

The CHANGELOG Latest section conflicts with #24: the one merged second needs a rebase.

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

None: the new argument of AdapterRegistry::addAdapter() is optional, only the exception message changes.

🤖 Generated with Claude Code

…pter codes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 90f95c9 into main Sep 30, 2026
17 checks passed
@njoubert-cleverage njoubert-cleverage mentioned this pull request Sep 30, 2026
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Give the service ids in the error on duplicate adapter codes

1 participant