Skip to content

ManifestRegistrar#finalize! avoids duplicates - #295

Merged
timriley merged 4 commits into
mainfrom
manifest-dupes
Jul 24, 2026
Merged

ManifestRegistrar#finalize! avoids duplicates#295
timriley merged 4 commits into
mainfrom
manifest-dupes

Conversation

@alassek

@alassek alassek commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This resolves a subtlety introduced by the fix in #286

Container#finalize! processes providers first, before moving on to manifest registrations.

If a class injects something defined by a manifest file, and this class is instantiated within a provider, this eager-loads the manifest key before finalize! reaches the ManifestRegistrar.

Moving ManifestRegistrar#call to use load instead of require introduced the possibility of double-registering a key.

This resolves a subtlety introduced by the fix in #286

`Container#finalize!` processes providers first, before moving on to
manifest registrations.

If a class injects something defined by a manifest file, and this class
is instantiated within a provider, this eager-loads the manifest key
before `finalize!` reaches the ManifestRegistrar.

Moving `ManifestRegistrar#call` to use `load` instead of `require`
introduced the possibility of double-registering a key.
@alassek

alassek commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Rubocop failures are not related to this changeset.

This avoids us having to iterate over the entire container.
@timriley

Copy link
Copy Markdown
Member

Thanks for picking this up, @alassek! I pushed a little tweak that I think should make it more efficient — how does that seem to you?

@alassek

alassek commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@timriley that's a better solution, thanks!

@timriley
timriley merged commit 9bbe32e into main Jul 24, 2026
7 of 8 checks passed
@timriley
timriley deleted the manifest-dupes branch July 24, 2026 23:06
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.

2 participants