5
54
Fork
You've already forked blue
4

WIP: fix: Auto-configuration not recursing to childs #291

Draft
pastor wants to merge 2 commits from instance-walker into main
pull from: instance-walker
merge into: lapislazuli:main
lapislazuli:main
lapislazuli:pipeline-operators
lapislazuli:documentation
lapislazuli:shadow-fields
lapislazuli:blue-shell
lapislazuli:promote-serializers-to-metacommands

This instance-walker helper is similar to #290.

This PR tries to make sure that configurations from referenced buildables in some of the top-level buildables are properly detected. Still we need to think of a good way to resolve the getter issue with delayed computation of instance-walker, after all, at the configuration detection step, we don't have a computational context yet.

Example of such buildable:

(info
 (inputs (guile-texinfo
 (inputs (info)))))

Here the configuration should detect that we need an automatic configuration from info as well as an automatic one from guile-texinfo.
@old, any ideas?

This `instance-walker` helper is similar to #290. This PR tries to make sure that configurations from referenced buildables in some of the top-level buildables are properly detected. Still we need to think of a good way to resolve the getter issue with delayed computation of `instance-walker`, after all, at the configuration detection step, we don't have a computational context yet. Example of such buildable: ```scheme (info (inputs (guile-texinfo (inputs (info))))) ``` Here the configuration should detect that we need an automatic configuration from `info` as well as an automatic one from `guile-texinfo`. @old, any ideas?
pastor added this to the alpha milestone 2026年06月11日 09:54:42 +02:00
* blue/types.scm (walk-instance): New procedure.
Example:
```scheme
(run-with-states '((srcdir "/tmp")
 (builddir "/tmp/build")
 (MAKEINFO "makeinfo"))
 (remove not
 (walk-instance (lambda (thing result)
 (and (buildable? thing)
 (ask-build-configurations thing)))
 '()
 (info (inputs (guile-texinfo
 (requirements (info))
 (level 99)))))))
```
[WIP] fix: Auto-configuration not recursing to childs
Some checks failed
ci/woodpecker/pr/arch Pipeline failed
ci/woodpecker/pr/debian Pipeline failed
ci/woodpecker/pr/ubuntu Pipeline failed
ci/woodpecker/pr/fedora Pipeline failed
ccdaa3b802
@ -64,2 +64,4 @@
instance->hyperlink
;; Helpers.
walk-instance
Owner
Copy link

fold-instance

`fold-instance`
@ -879,0 +892,4 @@
(let ((instance-slots (class-slots (class-of instance))))
(fold (lambda (slot result)
(let* ((getter (slot-definition-getter slot))
;; FIXME: what about delayed computations? Ideally we would
Owner
Copy link

You can have a delayed instance. #%~(copy-file ...)

Also, we don't recurse into list/vector here? What if we have a list that has instances in it? which is the case for inputs.

You can have a delayed instance. `#%~(copy-file ...)` Also, we don't recurse into list/vector here? What if we have a list that has instances in it? which is the case for `inputs`.
Author
Owner
Copy link

@old wrote in #291 (comment):

You can have a delayed instance. #%~(copy-file ...)

In that case it's fine to just ignore it. This procedure really was to make sure we can retrieve all referenced buildable configuration. For this use case, if it's a delayed instance, it should not be relevant as it is by definition only resolved after configuring.

Also, we don't recurse into list/vector here? What if we have a list that has instances in it? which is the case for inputs.

Yes, that's a mistake, I was just playing around with this and shadow-fields and I only implemented that deeper recursion there.

@old wrote in https://codeberg.org/lapislazuli/blue/pulls/291#issuecomment-17576429: > You can have a delayed instance. `#%~(copy-file ...)` In that case it's fine to just ignore it. This procedure really was to make sure we can retrieve all referenced buildable configuration. For this use case, if it's a delayed instance, it should not be relevant as it is by definition only resolved after configuring. > Also, we don't recurse into list/vector here? What if we have a list that has instances in it? which is the case for `inputs`. Yes, that's a mistake, I was just playing around with this and [shadow-fields](https://codeberg.org/lapislazuli/blue/pulls/290) and I only implemented that deeper recursion there.
@ -45,2 +45,4 @@
(type (list-of? testable?)))))
;;; FIXME: since `instance-walker' is using the raw getters, we are triggering
;;; computation asks when there is not yet a state.
Owner
Copy link

This is a fairly expensive operation to recursive walk every object to auto-detect the configuration. We better find a way to cache the result somehow.

This is a fairly expensive operation to recursive walk every object to auto-detect the configuration. We better find a way to cache the result somehow.
Author
Owner
Copy link

Well, we need to find a way anyways. Otherwise once you start to do some more complex things in BLUE you start to see the cracks like this case, one would assume that auto-configuration happens for all buildables not only top-level ones. But it's fine, nothing we cannot fix with a bit of thinking.

Well, we need to find a way anyways. Otherwise once you start to do some more complex things in BLUE you start to see the cracks like this case, one would assume that auto-configuration happens for all buildables not only top-level ones. But it's fine, nothing we cannot fix with a bit of thinking.
Owner
Copy link

I agree. But we need to discuss delayed computation

I agree. But we need to discuss delayed computation
Some checks failed
ci/woodpecker/pr/arch Pipeline failed
ci/woodpecker/pr/debian Pipeline failed
ci/woodpecker/pr/ubuntu Pipeline failed
ci/woodpecker/pr/fedora Pipeline failed
This pull request has changes conflicting with the target branch.
  • blue/types.scm
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin instance-walker:instance-walker
git switch instance-walker
Sign in to join this conversation.
No reviewers
old
Labels
Clear labels
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
discussion
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
optimization
question
More information is needed
upstream
Related to an upstream repository, already reported there
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
question
More information is needed
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lapislazuli/blue!291
Reference in a new issue
lapislazuli/blue
No description provided.
Delete branch "instance-walker"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?