From 0f812ccc307ea0550511ccced40b65dfb0cdaa91 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 20:11:29 -0400 Subject: fix: world and casino integrity fixes --- internal/behavior/store.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'internal/behavior') diff --git a/internal/behavior/store.go b/internal/behavior/store.go index a558f87..4051836 100644 --- a/internal/behavior/store.go +++ b/internal/behavior/store.go @@ -47,12 +47,24 @@ func BuildRoomIndex(dir string) map[int]string { func WalkYAMLDir(dir string, fn func(path, id string, data []byte) error) error { return filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error { - if err != nil || d.IsDir() || !strings.HasSuffix(d.Name(), ".yaml") { + if err != nil { + // A missing root is an empty tree; any other walk error (for + // example an unreadable directory) must surface instead of + // silently validating nothing. + if os.IsNotExist(err) { + return nil + } + return err + } + if d.IsDir() || !strings.HasSuffix(d.Name(), ".yaml") { return nil } data, readErr := os.ReadFile(path) if readErr != nil { - return nil + if os.IsNotExist(readErr) { + return nil + } + return readErr } id := strings.TrimSuffix(d.Name(), ".yaml") return fn(path, id, data) -- cgit v1.2.3