Skip to content

fix: addAPI extensions should be late bound #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged

Conversation

vic
Copy link
Owner

@vic vic commented Jun 30, 2025

instead of always keeping a reference to when the extensions were added.

instead of always keeping a reference to when the extensions
were added.
@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 08:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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 boundAPI to map and invoke extension functions at lookup time
  • Updates addAPI to merge raw API entries instead of early binding
  • Adds a test in checkmate.nix to 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 api entry is a function or document the expected structure of api entries.
            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 boundAPI to avoid repeated mapAttrs calls for better performance.
            boundAPI = builtins.mapAttrs (_: g: g (self f)) __config.api;

@vic vic merged commit e5a363c into main Jun 30, 2025
1 check passed
@vic vic deleted the vic/jj-change-ootoktvsmsnt branch June 30, 2025 08:04
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.

1 participant