diff --git a/internal/daemon/workflow_identity.go b/internal/daemon/workflow_identity.go index adc9ae072..b7318414f 100644 --- a/internal/daemon/workflow_identity.go +++ b/internal/daemon/workflow_identity.go @@ -60,12 +60,11 @@ func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task) // declaredIdentity resolves a workflow's declared identity to the ID it is // authorized as and the name the task carries while it runs: a configured // identity's name, or empty for the root identity of a single-identity -// install. RootRef names the instance root, whose name differs per install, -// so the shipped workflows can declare it. +// install. func (d *Daemon) declaredIdentity(ctx context.Context, task *workflow.Task, ref string) (identity.IdentityID, string, error) { var id identity.IdentityID var name string - if ref == workflow.RootRef || identity.IdentityID(ref) == d.RootIdentityID || identity.StableID(ref) == d.RootIdentityID { + if identity.IdentityID(ref) == d.RootIdentityID || identity.StableID(ref) == d.RootIdentityID { id = d.RootIdentityID } else { id, name = identity.IdentityID(ref), ref diff --git a/internal/daemon/workflow_identity_test.go b/internal/daemon/workflow_identity_test.go index 080fd2ec3..2bd9e047a 100644 --- a/internal/daemon/workflow_identity_test.go +++ b/internal/daemon/workflow_identity_test.go @@ -108,7 +108,6 @@ func TestWorkflowIdentity(t *testing.T) { {"refused execution is parked", deploy, "", runAllowed{"root": true}, "", true, []identity.IdentityID{"id-deployer"}, false}, {"called workflow runs as its own identity, not its caller's", callee, "id-deployer", runAllowed{"id-deployer": true, "id-bot": true}, "id-bot", false, nil, false}, {"caller refused the called workflow is parked", callee, "id-deployer", runAllowed{"id-bot": true}, "", true, []identity.IdentityID{"id-deployer"}, false}, - {"workflow naming the root runs as the root", "id: deploy\nidentity: root\n", "id-bot", runAllowed{"root": true, "id-bot": true}, "", false, nil, false}, {"no declared identity is refused", "id: deploy\n", "id-bot", runAllowed{"root": true, "id-bot": true}, "", true, nil, false}, {"unconfigured identity is parked", "id: deploy\nidentity: ghost\n", "", runAllowed{"root": true}, "", true, nil, false}, {"disabled workflow is parked", deploy, "id-bot", runAllowed{"id-bot": true, "id-deployer": true}, "", true, nil, true}, diff --git a/internal/domain/workflow/definition.go b/internal/domain/workflow/definition.go index b533079a7..e0c60ac26 100644 --- a/internal/domain/workflow/definition.go +++ b/internal/domain/workflow/definition.go @@ -69,11 +69,6 @@ type SwitchStep struct { Cases map[string][]StepRecord `yaml:"cases" json:"cases"` } -// RootRef is the identity a workflow declares to run as the instance root. -// Nothing ships with it; stored copies that still name it keep running as -// the root until edited. -const RootRef = "root" - const switchDefault = "default" // RetryPolicy is how often a failed step runs again, and how long it waits diff --git a/internal/infrastructure/staterpc/identity_start_test.go b/internal/infrastructure/staterpc/identity_start_test.go index 6f046c0c6..f4543204b 100644 --- a/internal/infrastructure/staterpc/identity_start_test.go +++ b/internal/infrastructure/staterpc/identity_start_test.go @@ -81,7 +81,6 @@ func TestCredentialUsesPinnedExecutionIdentity(t *testing.T) { denied bool }{ {"id: x\nidentity: execution-agent\n", "execution-agent", false}, - {"id: x\nidentity: root\n", "", false}, {"id: x\n", "", true}, } { task := &task.Task{Identity: "requester", WorkflowDefinitionYAML: tt.definition} diff --git a/internal/infrastructure/staterpc/task_grants.go b/internal/infrastructure/staterpc/task_grants.go index cf5cb2b4f..e5d881d3b 100644 --- a/internal/infrastructure/staterpc/task_grants.go +++ b/internal/infrastructure/staterpc/task_grants.go @@ -20,7 +20,6 @@ import ( "github.com/samcharles93/archie-core/internal/domain/identity" "github.com/samcharles93/archie-core/internal/domain/presence" "github.com/samcharles93/archie-core/internal/domain/storecontract" - "github.com/samcharles93/archie-core/internal/domain/workflow" "github.com/samcharles93/archie-core/internal/domain/workflow/task" "github.com/samcharles93/archie-core/internal/events" "github.com/samcharles93/archie-core/internal/infrastructure/rpctls" @@ -356,9 +355,6 @@ func executionReference(t *task.Task) (string, error) { if iface.Identity == "" { return "", fmt.Errorf("pinned workflow declares no execution identity") } - if iface.Identity == workflow.RootRef { - return "", nil - } return iface.Identity, nil }