Expose stable Interactor constructor metadata - #322
Draft
cowboyd wants to merge 1 commit into
Draft
Conversation
Contributor
Package Changes Through f4af822There are 1 changes which include @interactors/core with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Contributor
|
🚀 Deploy Preview Ready!
|
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.
Motivation
The compiler and future test-runner adapters need a stable way to discover Interactor and matcher constructors at runtime. Inferring that information from private implementation details or callable shape would make those consumers fragile and tightly coupled to core internals.
Approach
Attach frozen, versioned metadata to constructors using globally registered symbols. Expose public metadata readers and type guards, populate cumulative action and filter metadata as Interactors are composed, and brand both built-in and custom matcher constructors.
Alternate Designs
Inspecting function properties or private builder state was considered, but that would couple consumers to implementation details and could incorrectly identify structurally similar functions. A global registry was also avoided because metadata should travel with each constructor and work across duplicate package instances.
Possible Drawbacks or Risks
The metadata shape becomes a compatibility surface. A metadata version and strict readers make incompatible revisions detectable, while package-qualified global symbol keys reduce collision risk.
TODOs and Open Questions
None within this layer of the stack.
Learning
Symbol.for()allows independently loaded copies of@interactors/coreto agree on metadata keys without introducing mutable global registry state.Screenshots
Not applicable; this is a runtime API change.