Resolve workflow owner by deployment registry#390
Conversation
…tkit/cre-cli into adjust-workflow-owner-logic
| workflow.UserWorkflowSettings.WorkflowOwnerAddress = ownerAddr | ||
| workflow.UserWorkflowSettings.WorkflowOwnerType = ownerType |
There was a problem hiding this comment.
Have you considered not making this part of settings at all? What if we added a dynamic runtimeContext.ResolveOwner(<params like registry and whatever else we might need>)?
There was a problem hiding this comment.
This is closer to to what we will need as a final solution. I think we are going to have to break the settings down into smaller components and load on request. Will share details offline
| ownerAddress, ownerType, err := GetWorkflowOwner(v) | ||
| if err != nil { | ||
| return WorkflowSettings{}, err | ||
| if deploymentRegistry == "" { |
There was a problem hiding this comment.
Can deploymentRegistry still be empty here?
There was a problem hiding this comment.
Yes, to maintain backwards compatibility, we must account for an empty deploymentRegistry else this would be a breaking change to current projects. If it is not set, getSetting returns an empty string
There was a problem hiding this comment.
Ok, I thought we load registry before making this call?
| if workflow.UserWorkflowSettings.DeploymentRegistry == "" { | ||
| return nil | ||
| } | ||
| if resolved == nil { | ||
| return fmt.Errorf("resolved registry is required to finalize workflow owner") | ||
| } |
There was a problem hiding this comment.
Do we need to check for both?
There was a problem hiding this comment.
Short answer is yes. If DeploymentRegistry is "" then we should early return as this step is not needed. If resolved is nil then settings are in a broken state and cannot proceed.
When user-workflow.deployment-registry is set, workflow owner is no longer resolved during the first settings load (which required a local key even for off-chain registries). Owner is filled after the registry is resolved: off-chain uses the session-derived owner with type ORG_DERIVED; on-chain still uses GetWorkflowOwner. Derived owner is normalized once when credentials are validated (FormatWorkflowOwnerAddress). Per-command 0x prefix handling in workflow handlers is removed. Tests and workflow fixture YAMLs added/updated.