aboutsummaryrefslogtreecommitdiff
path: root/internal/validate
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-05 17:31:50 -0400
committerhistoria <[not public]>2026-10-05 17:31:50 -0400
commit516fd29da423432ef6dfded21a984f1d15dcab1a (patch)
treeeb2dabe325a1335dedac28a93453df643ef986f2 /internal/validate
parente42952469dadfb3535633c66c881050ac128703c (diff)
downloadthehouseoficarus-516fd29da423432ef6dfded21a984f1d15dcab1a.tar.gz
fix: slop casino and economy fixes
Diffstat (limited to 'internal/validate')
-rw-r--r--internal/validate/checks.go11
-rw-r--r--internal/validate/correct_audit_fixes_test.go33
2 files changed, 44 insertions, 0 deletions
diff --git a/internal/validate/checks.go b/internal/validate/checks.go
index 82f746f..d3fa111 100644
--- a/internal/validate/checks.go
+++ b/internal/validate/checks.go
@@ -1643,6 +1643,17 @@ func validateTalkConfig(prefix string, cfg *behavior.TalkConfig, itemIDs map[str
if cfg == nil {
return issues
}
+ // A talk config with nodes but no "start" node is dead content: the
+ // runtime prints "This person has nothing to say."
+ if len(cfg.Nodes) > 0 {
+ if _, ok := cfg.Nodes["start"]; !ok {
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "reference",
+ Message: fmt.Sprintf("%s: talk config has nodes but no \"start\" node", prefix),
+ })
+ }
+ }
for nodeID, node := range cfg.Nodes {
nodePrefix := fmt.Sprintf("%s: node %q", prefix, nodeID)
if node.Action != nil {
diff --git a/internal/validate/correct_audit_fixes_test.go b/internal/validate/correct_audit_fixes_test.go
new file mode 100644
index 0000000..8ed6f52
--- /dev/null
+++ b/internal/validate/correct_audit_fixes_test.go
@@ -0,0 +1,33 @@
+package validate
+
+import (
+ "strings"
+ "testing"
+
+ "thehouseoficarus/internal/behavior"
+)
+
+// Regression: a talk config with nodes but no "start" node is dead content at
+// runtime; validation must report it.
+func TestValidateTalkConfigRequiresStartNode(t *testing.T) {
+ cfg := &behavior.TalkConfig{Nodes: map[string]behavior.TalkNode{
+ "greet": {Messages: []string{"hi"}},
+ }}
+ issues := validateTalkConfig("test", cfg, nil, nil, nil, nil)
+ found := false
+ for _, iss := range issues {
+ if strings.Contains(iss.Message, "start") {
+ found = true
+ }
+ }
+ if !found {
+ t.Fatalf("missing start node not reported: %+v", issues)
+ }
+
+ clean := &behavior.TalkConfig{Nodes: map[string]behavior.TalkNode{"start": {}}}
+ for _, iss := range validateTalkConfig("test", clean, nil, nil, nil, nil) {
+ if strings.Contains(iss.Message, "start") {
+ t.Fatalf("start node wrongly reported: %+v", iss)
+ }
+ }
+}