From ec703a39738fefb60817f5659f76f8e683f8d301 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 5 Oct 2026 17:39:06 -0400 Subject: fix: admin undo/redo failure, video poker cabinet ids, room ref behavior --- internal/validate/checks.go | 11 +++++++++++ internal/validate/correct_audit_fixes_test.go | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'internal/validate') diff --git a/internal/validate/checks.go b/internal/validate/checks.go index d3fa111..2030225 100644 --- a/internal/validate/checks.go +++ b/internal/validate/checks.go @@ -1624,6 +1624,17 @@ func validateGather(prefix string, cfg *behavior.GatherConfig, itemIDs map[strin prefix, label, len(cfg.Tools)), }) } + if d.Weight <= 0 { + label := d.ItemID + if label == "" { + label = "" + } + issues = append(issues, Issue{ + Level: "WARN", + Type: "semantic", + Message: fmt.Sprintf("%s: drop %q has weight %d; it can never be selected", prefix, label, d.Weight), + }) + } } return issues diff --git a/internal/validate/correct_audit_fixes_test.go b/internal/validate/correct_audit_fixes_test.go index 8ed6f52..f11dd3f 100644 --- a/internal/validate/correct_audit_fixes_test.go +++ b/internal/validate/correct_audit_fixes_test.go @@ -31,3 +31,19 @@ func TestValidateTalkConfigRequiresStartNode(t *testing.T) { } } } + +// Regression: a gather drop with weight <= 0 can never be selected (the +// weighted roll has zero total); it must be flagged. +func TestValidateGatherWarnsOnWeightlessDrop(t *testing.T) { + cfg := &behavior.GatherConfig{Drops: []behavior.DropEntry{{ItemID: "ore", Weight: 0}}} + issues := validateGather("test", cfg, map[string]bool{"ore": true}, map[string]bool{}) + found := false + for _, iss := range issues { + if strings.Contains(iss.Message, "weight") { + found = true + } + } + if !found { + t.Fatalf("weightless drop not warned: %+v", issues) + } +} -- cgit v1.2.3