Repository navigation
fix: addAPI extensions should be late bound - #14
Merged
Merged
Conversation
instead of always keeping a reference to when the extensions were added.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR changes the API extension mechanism to defer (“late–bind”) invocation of added extensions until API lookup time, rather than executing them immediately when addAPI is called.
- Introduces
boundAPIto map and invoke extension functions at lookup time - Updates
addAPIto merge raw API entries instead of early binding - Adds a test in
checkmate.nixto verify that extensions truly bind late
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| default.nix | Added boundAPI and swapped out early‐binding logic in addAPI for a simple merge of api |
| checkmate.nix | Added a test case "test API extensions are late bound" to validate deferred extension binding |
Comments suppressed due to low confidence (3)
default.nix:91
- [nitpick] Consider adding a comment explaining the purpose of
boundAPI(deferring execution of API extensions) to improve maintainability and clarify why late binding is needed.
boundAPI = builtins.mapAttrs (_: g: g (self f)) __config.api;
default.nix:105
- To prevent runtime issues, consider validating that each merged
apientry is a function or document the expected structure ofapientries.
addAPI = api: self (c: mapAttr (f c) "api" (a: a // api));
default.nix:91
- [nitpick] If this block is invoked frequently, consider caching or memoizing
boundAPIto avoid repeatedmapAttrscalls for better performance.
boundAPI = builtins.mapAttrs (_: g: g (self f)) __config.api;
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.
instead of always keeping a reference to when the extensions were added.