docs(prds): name the registered step type and hold the vocabulary PRD to the provider set

docs/prds/workflow-step-vocabulary.md named the repository-rules step type
`workflow.diff-rules` while the vocabulary a deployment resolves carries
`gate.diff-rules` (workflow.DiffRulesStepName), so a definition written to
the document's word is refused at save and at run. The same decision's
sibling, docs/prds/runtime-control-plane.md, still claimed "Plugins can add
step types", which this document's closed-set rule contradicts: an
interpreted plugin contributes none, and a step type arrives as a provider
in the compiled-in set.

Correct both documents, and hold the vocabulary PRD to the provider set with
a guard test: every step-type-shaped name the document identifies must
resolve in workflowsteps.Providers(). The test fails on the pre-fix document
("workflow.diff-rules" is contributed by no provider) and passes after.

Refs: archie-core-vwqc, split from archie-core-gcoj (closed as invalidated by
re-verification: the provider set exists and cross-side agreement is already
pinned).
This commit is contained in:
sam committed 2026-10-02 11:05:08 +10:00
1 parent 19520a63e5
commit 1f0cb9f318
4 files changed
+62 -5

No files matched your search

@@ -3,12 +3,14 @@ package workflowsteps
import (
"os"
"path/filepath"
"regexp"
"slices"
"strings"
"testing"
"gopkg.in/yaml.v3"
"github.com/samcharles93/archie-core/internal/domain/stableid"
"github.com/samcharles93/archie-core/internal/domain/workflow"
)
@@ -214,3 +216,55 @@ func TestExampleWorkflowsParse(t *testing.T) {
}
}
}
// documentedSpan matches one inline-code span in the vocabulary PRD, captured
// without its backticks.
var documentedSpan = regexp.MustCompile("`([^`]+)`")
// isDocumentedStepType reports whether a documented token names a workflow step
// type. A step type is a stable identifier that carries a dot: the vocabulary
// names <family>.<word> (bootstrap.apply, gate.diff-rules, agent.run). The
// document's other backticked spans are Go identifiers (StepFactory,
// plugin.Plugin -- uppercase, so not stable identifiers), repository paths
// (slashes, so not stable identifiers) or bead ids (no dot), and none of them
// is mistaken for a step type by this rule.
func isDocumentedStepType(token string) bool {
return strings.Contains(token, ".") && stableid.Valid(token)
}
// TestDocumentedStepVocabularyResolvesInTheProviderSet ties the vocabulary the
// workflow-step-vocabulary PRD names to the vocabulary a deployment resolves.
// That PRD is where an operator or plugin author reads which step types exist,
// so a word it names that no provider contributes describes a step type every
// deployment refuses -- the drift that survived the document's own decision
// (gate.diff-rules is the registered word; the PRD called it
// workflow.diff-rules). The scan must find the vocabulary, not merely pass on
// an empty list.
func TestDocumentedStepVocabularyResolvesInTheProviderSet(t *testing.T) {
t.Parallel()
source, err := os.ReadFile(filepath.Join("..", "..", "..", "docs", "prds", "workflow-step-vocabulary.md"))
if err != nil {
t.Fatalf("read the workflow step vocabulary PRD: %v", err)
}
manager, err := NewManager()
if err != nil {
t.Fatalf("NewManager: %v", err)
}
registered := manager.StepTypes()
documented := 0
for _, match := range documentedSpan.FindAllStringSubmatch(string(source), -1) {
token := match[1]
if !isDocumentedStepType(token) {
continue
}
documented++
if !slices.Contains(registered, token) {
t.Errorf("the vocabulary PRD names step type %q, which no provider contributes: a deployment refuses a definition that uses it", token)
}
}
if documented == 0 {
t.Fatal("the vocabulary PRD named no step type; the scan is not reading the document's vocabulary")
}
}