Skip to content

fix: make sure prototypes can be used for reregistration#1284

Merged
jakobmoellerdev merged 5 commits into
open-component-model:mainfrom
jakobmoellerdev:runtime-prototype-scheme-uniqueness
Dec 4, 2025
Merged

fix: make sure prototypes can be used for reregistration#1284
jakobmoellerdev merged 5 commits into
open-component-model:mainfrom
jakobmoellerdev:runtime-prototype-scheme-uniqueness

Conversation

@jakobmoellerdev

Copy link
Copy Markdown
Member

What this PR does / why we need it

Previously, in the scheme we did not store by Prototype but by type. Because the scheme did not key by Prototype, one could register multiple defaults with the same underlying prototype value. However, this is incorrect. Instead there should be only one prototype instance at any given time in a scheme. If there are multiple registrations happening in succession, the prototype should still stay atomic, and all calls should instead only append to the aliases

Which issue(s) this PR fixes

was discovered as part of scheme debugging in e25a7d0

Previously, in the scheme we did not store by Prototype but by type. Because the scheme did not key by Prototype, one could register multiple defaults with the same underlying prototype value. However, this is incorrect. Instead there should be only one prototype instance at any given time in a scheme. If there are multiple registrations happening in succession, the prototype should still stay atomic, and all calls should instead only append to the aliases

Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
@jakobmoellerdev jakobmoellerdev force-pushed the runtime-prototype-scheme-uniqueness branch from 5814660 to 0f323fd Compare November 28, 2025 16:38
Replaces the previous implementation of bidirectional mapping with a new `ListMap` structure for more efficient and compact internal handling. Adjusts all related methods to use stable pair index-based lookups. Updates impacted registry logic to utilize the new API.

Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review November 28, 2025 16:59
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner November 28, 2025 16:59
@Skarlso Skarlso self-assigned this Dec 2, 2025

@Skarlso Skarlso left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a few interesting things, but I need to write some tests unless you can confirm my understanding. :D

Comment thread bindings/go/runtime/internal/bimap/bimap.go
Comment thread bindings/go/runtime/registry.go
Comment thread bindings/go/runtime/registry.go
Comment thread bindings/go/runtime/internal/bimap/bimap.go
Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
Comment thread bindings/go/runtime/internal/bimap/bimap.go
Comment thread bindings/go/runtime/internal/bimap/bimap.go
Signed-off-by: Jakob Möller <contact@jakob-moeller.com>
@Skarlso

Skarlso commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Thanks for adding the tests!

@jakobmoellerdev jakobmoellerdev enabled auto-merge (squash) December 4, 2025 12:56
@jakobmoellerdev jakobmoellerdev merged commit cb295d4 into open-component-model:main Dec 4, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants