Files
archie/internal/app/controlplane/definitions.go
T
sam 56f7295a3c feat(workflow): own the step vocabulary in a family manager registered at each composition root
archie-core-fwmp. Every call site hardcoded workflow.BuiltinStepRegistry(), so
the step vocabulary a workflow definition may name was closed to the six shipped
workflows and archie-agent could compile only what the control plane happened to
validate against the same literal.

internal/domain/workflow.Manager is the family owner (ARCHITECTURE.md#plugin-
engine-rule-strict invariant 2): a constructed, injected value with no
package-level registry and no init()-time registration. Register validates at
the producer and atomically -- nil or unnamed provider, malformed provider or
step-type identifier, a step type with no factory, a duplicate claim, a provider
declaring one type twice, and a contribution shadowing a shipped stage are each
refused, and a refused contribution applies nothing. Registry() hands back a
copy, so the closed set is a property of the manager rather than a convention.

internal/infrastructure/workflowsteps is the one package both composition roots
import: it holds the compiled-in provider set and builds the manager. archied
registers it in RunStateStore (the validating side) and in openStateStoreAdapter
(the daemon's client), archie-agent in productionWorkerDependencies (the
executing side), and archie-messaging at its own root, each before the first
resolution.

The five hardcoded sites now resolve the injected manager instead: the State
Store's workflow-definitions validate closure and encodeWorkflowDefinitions, the
control-plane client's read and write paths, and CompilePinnedWorkflow's shipped
-definition and pinned compiles (one resolution per package).

step_vocabulary_agreement_test.go registers a provider through the production
Manager and drives all three sides with it; breaking any one of the six
resolution points back to the builtin registry fails that side's assertion.
2026-09-21 19:42:24 +10:00

29 lines
1.6 KiB
Go

package controlplane
import (
pb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/workflow"
)
const (
objectSchema = `{"type":"object"}`
arraySchema = `{"type":"array"}`
)
func builtinDefinitions(steps workflow.StepRegistry) []Definition {
definitions := []Definition{workflowDefinition(), workflowDefinitionsDefinition(steps), personaDefinition(), scheduleDefinition()}
definitions = append(definitions, modelDefinitions()...)
definitions = append(definitions, operationalDefinitions()...)
return definitions
}
func domainManagedDescriptors() []*pb.ResourceDescriptor {
const stateService = "state.v1.StateStoreService"
return []*pb.ResourceDescriptor{
{Kind: "identities", Title: "Identities", ApplyMode: "domain-managed", QueryService: stateService + "/ListIdentities,GetIdentity", CommandService: stateService + "/CreateIdentity,RenameIdentity,SuspendIdentity,ReactivateIdentity,RetireIdentity"},
{Kind: "capture-events", Title: "Captured events", ApplyMode: "domain-managed", QueryService: stateService + "/StreamCaptures", CommandService: stateService + "/InsertCapture"},
{Kind: "capture-mappings", Title: "Capture mappings", ApplyMode: "domain-managed", QueryService: stateService + "/ListMappings", CommandService: stateService + "/InsertMapping,UpdateMapping,DeleteMapping"},
{Kind: "capture-bindings", Title: "Capture bindings", ApplyMode: "domain-managed", QueryService: stateService + "/ListBindings", CommandService: stateService + "/InsertBinding,UpdateBinding,DeleteBinding"},
}
}