Skip to content

Conversation

@tarcisiozf
Copy link

TICKET: DEVSVCS-2981

Refactoring and modularization:

  • Replaces the internal workflowArtifact struct with the new shared artifact.Artifact type throughout the deploy and register code, and updates test code accordingly.
  • Refactors the workflow compilation logic to use the new build package for resolving build parameters and compiling workflows, removing duplicated code and simplifying the Compile method.
  • Refactors artifact preparation to use the new artifact.Builder and artifact.Inputs, replacing custom logic for reading and encoding binaries and configs.

New features:

  • Adds a new workflow id subcommand that builds the workflow and prints its computed ID, using the shared artifact and build logic. (cmd/workflow/id/id.go)

General improvements:

  • Fix potential memory leak by closing brotli.NewWriter
  • Improve error messages when Anvil fails

@tarcisiozf tarcisiozf requested a review from a team as a code owner January 5, 2026 20:56
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

👋 tarcisiozf, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

func ShouldSkipGetOwner(cmd *cobra.Command) bool {
switch cmd.Name() {
case "help":
case "help", "id":
Copy link
Collaborator

Choose a reason for hiding this comment

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

id generation command requires owner - owner address is part of inputs to workflow ID generation.

Copy link
Author

Choose a reason for hiding this comment

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

The whole idea behind of this feature is to be able to verify a workflow deployed by others. Since it's a external owner address this field is not required in the local config, and this is why there is an option flag to also overwrite owner address via CLI instead of changing config, so the user has both options.

@anirudhwarrier anirudhwarrier requested review from anirudhwarrier and timothyF95 and removed request for Atrax1 January 6, 2026 06:05
}

// optional owner flag overrides the owner from settings
cmd.Flags().String("owner", "", "Workflow owner address")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this flag needed? Not a pattern in other commands.

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't work for me without the flag. Do you have a demo?

Copy link
Contributor

@timothyF95 timothyF95 left a comment

Choose a reason for hiding this comment

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

I like this feature.
Some items will need adjusting. In particular I would like to address the handling of the workflow owner.

}

var defaultOutputPath = "./binary.wasm.br.b64"
const defaultOutputPath = "./binary.wasm.br.b64"
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is now shared we should move it to the constants package:

./internal/constants/constants.go

var excludedCommands = map[string]struct{}{
"cre logout": {},
"cre logout": {},
"cre workflow generate-id": {},
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed. We want to enforce auth validation

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offline and it was decided to keep as is without validating auth

func (h *handler) Execute() error {
h.displayWorkflowDetails()

if !h.validated {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -0,0 +1,165 @@
package build
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍 I think later we should integrate this into the flow for both sim and deploy

@@ -0,0 +1,36 @@
//go:build wasip1

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we reuse the testdata from deploy cmd or hoist into an internal package to be shared?

func ShouldSkipGetOwner(cmd *cobra.Command) bool {
switch cmd.Name() {
case "help":
case "help", "generate-id":
Copy link
Contributor

Choose a reason for hiding this comment

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

This is correct but I don't like that we have to do it.

func New(ctx *runtime.Context) *cobra.Command {
cmd := &cobra.Command{
Use: "generate-id <workflow-folder-path>",
Short: "Display the workflow ID",
Copy link
Contributor

Choose a reason for hiding this comment

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

Could add a long desc explaining a little more on what it does

}

// optional owner flag overrides the owner from settings
cmd.Flags().String("owner", "", "Workflow owner address")
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't work for me without the flag. Do you have a demo?

@@ -0,0 +1,132 @@
package generate_id
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have unit tests for input validation

./generate_id_test.go

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.

3 participants