Skip to content

fix: addAPI extensions should be late bound - #14

Merged
vic merged 1 commit into
mainfrom
vic/jj-change-ootoktvsmsnt
Jun 30, 2025
Merged

vic merged 1 commit into
mainfrom
vic/jj-change-ootoktvsmsnt

Conversation

@vic

@vic vic commented Jun 30, 2025

Copy link
Copy Markdown
Member

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 AI review requested due to automatic review settings June 30, 2025 08:00

Copilot AI 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.

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
@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.

2 participants