5
54
Fork
You've already forked blue
4

WIP: feat: Promote serializers to metacommands #263

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

This PR promotes our serializers to meta-commands.

The new interface allows chaining serialization actions through the CLI arguments, for example:

$ blue ,serialize commands configuration ui

The PR is marked as WIP because there is a FIXME that I'm not sure how to address, which is that the procedure serialize-configuration needs to be run with the context stored in the .blue-store, this was done automatically when the procedure was a normal command, but now that it's a procedure invoked by a meta-command, the context needs to be injected.

@old, do you know how we can do that?

This PR promotes our serializers to meta-commands. The new interface allows chaining serialization actions through the CLI arguments, for example: ``` $ blue ,serialize commands configuration ui ``` The PR is marked as WIP because there is a FIXME that I'm not sure how to address, which is that the procedure [serialize-configuration](https://codeberg.org/lapislazuli/blue/src/promote-serializers-to-metacommands/blue/ui/entrypoints/serialize.scm#L153) needs to be run with the context stored in the `.blue-store`, this was done automatically when the procedure was a normal command, but now that it's a procedure invoked by a meta-command, the context needs to be injected. @old, do you know how we can do that?
pastor added this to the alpha milestone 2026年03月08日 16:16:05 +01:00
pastor force-pushed promote-serializers-to-metacommands from 757336209b
Some checks are pending
ci/woodpecker/pr/arch Pipeline is pending
ci/woodpecker/pr/debian Pipeline is pending
ci/woodpecker/pr/fedora Pipeline is pending
ci/woodpecker/pr/ubuntu Pipeline is pending
to 3838cd95b7
Some checks failed
ci/woodpecker/pr/arch Pipeline failed
ci/woodpecker/pr/debian Pipeline was successful
ci/woodpecker/pr/fedora Pipeline was successful
ci/woodpecker/pr/ubuntu Pipeline was successful
2026年03月08日 16:16:59 +01:00
Compare
Owner
Copy link

The serializer command could takes the first argument at the store. So you always need one. We can do the same for other variables as well (srcdir, builddir) and blueprint file.

What do you think? We could also act like the UI does.

The serializer command could takes the first argument at the store. So you always need one. We can do the same for other variables as well (srcdir, builddir) and blueprint file. What do you think? We could also act like the UI does.
Author
Owner
Copy link

Hum, I don't understand what you mean.

Hum, I don't understand what you mean.
Owner
Copy link

We have commands that are ran in a context. This context is:

  • User blueprint (inputs)
  • Source-directory (transitive inputs from blueprint)
  • Build-directory (outputs for users)
  • The store-directory (outputs of blue)

For the autocomplete engine, We need the blueprint (optional) and a store directory for compiling the blueprint (faster invocations).

Right now, the autocomplete engine create a cache entry at ~/.cache/blue/path-to-blueprint/.blue-store.

For the serialization command, things are different. The users project needed to be loaded. I don't think it makes sens to call the serialization command outside of a project. But it's perfectly fine to do so for the autocomplete.

So the stories are different here and I would like to understand better why the serialization command has to be a meta-command. What is the problem this will solve in practice? That way, I think I would figure out a good solution like for the autocomplete engine.

We have commands that are ran in a context. This context is: - User blueprint (inputs) - Source-directory (transitive inputs from blueprint) - Build-directory (outputs for users) - The store-directory (outputs of blue) For the autocomplete engine, We need the blueprint (optional) and a store directory for compiling the blueprint (faster invocations). Right now, the autocomplete engine create a cache entry at `~/.cache/blue/path-to-blueprint/.blue-store`. For the serialization command, things are different. The users project **needed** to be loaded. I don't think it makes sens to call the serialization command outside of a project. But it's perfectly fine to do so for the autocomplete. So the stories are different here and I would like to understand better why the serialization command has to be a meta-command. What is the problem this will solve in practice? That way, I think I would figure out a good solution like for the autocomplete engine.
Author
Owner
Copy link

@old wrote in #263 (comment):

So the stories are different here and I would like to understand better why the serialization command has to be a meta-command. What is the problem this will solve in practice? That way, I think I would figure out a good solution like for the autocomplete engine.

Well, we had a discussion about this in one of our meetings. The thing is that we want serialization to not break if the user introduces a syntax error in their blueprint because that would break external UIs, so we would like to have some kind of smoother fallback to the known information.

@old wrote in https://codeberg.org/lapislazuli/blue/pulls/263#issuecomment-11427964: > So the stories are different here and I would like to understand better why the serialization command has to be a meta-command. What is the problem this will solve in practice? That way, I think I would figure out a good solution like for the autocomplete engine. Well, we had a discussion about this in one of our meetings. The thing is that we want serialization to not break if the user introduces a syntax error in their blueprint because that would break external UIs, so we would like to have some kind of smoother fallback to the known information.
Author
Owner
Copy link

Also external UI should work whether you are or not in a project. So the information about built-in commands should be serialized despite errors in the user blueprint or even if there is no blueprint.

Also external UI should work whether you are or not in a project. So the information about built-in commands should be serialized despite errors in the user blueprint or even if there is no blueprint.
Owner
Copy link

And why is separating stdout and stderr not an option here? The UI is already doing all of this. It will load an empty blueprint, use the store etc.

If the problem is just mangling of error and output, it is easy to fix this.

And why is separating stdout and stderr not an option here? The UI is already doing all of this. It will load an empty blueprint, use the store etc. If the problem is just mangling of error and output, it is easy to fix this.
Author
Owner
Copy link

Do you propose that UIs ignore a non-zero exit status and still parse the output? It seems a bit unclean for when there could be a real fatal error that the UI want to notice and avoid executing. I guess we could have different exit codes.

Do you propose that UIs ignore a non-zero exit status and still parse the output? It seems a bit unclean for when there could be a real fatal error that the UI want to notice and avoid executing. I guess we could have different exit codes.
Owner
Copy link

The serialize command should not emit an error (status wise). In which case is this happening? Currently, if the blueprint failed to get loaded, an error is indeed returned, I think. But we could add an an option to tell the UI to fallback to the default blueprint and continue.

So, the serialize command should always be successful, but you could still separate stdout/stderr for the data and the logs. If the serialize command failed, then that's another story.

The serialize command should not emit an error (status wise). In which case is this happening? Currently, if the blueprint failed to get loaded, an error is indeed returned, I think. But we could add an an option to tell the UI to fallback to the default blueprint and continue. So, the serialize command should always be successful, but you could still separate stdout/stderr for the data and the logs. If the serialize command failed, then that's another story.
Author
Owner
Copy link

@old wrote in #263 (comment):

The serialize command should not emit an error (status wise). In which case is this happening? Currently, if the blueprint failed to get loaded, an error is indeed returned, I think. But we could add an an option to tell the UI to fallback to the default blueprint and continue.

Well, that's the point. That we don't want to break UIs when the user makes a mistake in the blueprint, we should definitely fallback to something so the UIs do not choke.

So, the serialize command should always be successful, but you could still separate stdout/stderr for the data and the logs. If the serialize command failed, then that's another story.

Well, another point we discussed is that we want this to be fast. So if a metacomand can avoid loading some Guile modules to speed-up startup, that's also a nice bonus. Did you meant that since for serializing the data we need to load the configuration, we cannot save much startup time by making the serializers metacommands?

@old wrote in https://codeberg.org/lapislazuli/blue/pulls/263#issuecomment-11514874: > The serialize command should not emit an error (status wise). In which case is this happening? Currently, if the blueprint failed to get loaded, an error is indeed returned, I think. But we could add an an option to tell the UI to fallback to the default blueprint and continue. Well, that's the point. That we don't want to break UIs when the user makes a mistake in the blueprint, we should definitely fallback to something so the UIs do not choke. > So, the serialize command should always be successful, but you could still separate stdout/stderr for the data and the logs. If the serialize command failed, then that's another story. Well, another point we discussed is that we want this to be fast. So if a metacomand can avoid loading some Guile modules to speed-up startup, that's also a nice bonus. Did you meant that since for serializing the data we need to load the configuration, we cannot save much startup time by making the serializers metacommands?
Some checks failed
ci/woodpecker/pr/arch Pipeline failed
ci/woodpecker/pr/debian Pipeline was successful
ci/woodpecker/pr/fedora Pipeline was successful
ci/woodpecker/pr/ubuntu Pipeline was successful
This pull request has changes conflicting with the target branch.
  • blue/ui/entrypoints/serialize.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 promote-serializers-to-metacommands:promote-serializers-to-metacommands
git switch promote-serializers-to-metacommands
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!263
Reference in a new issue
lapislazuli/blue
No description provided.
Delete branch "promote-serializers-to-metacommands"

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?