fix: address review #2888 findings (comment clarity, test cleanup)

- Clarify depth-aware short-circuit comment to unambiguously describe
  the relationship between current depth and previous validation depth
- Add comment to MappingValueNode case explaining intentional depth+2
  behavior from parent MappingNode perspective
- Restructure unmarshalYAMLWithDepthLimit doc comment as bullet list
  covering all three safety checks (depth, multi-doc, strict fields)
- Replace t.Error with t.Fatal in TestYAMLEmptyFileRejection to remove
  redundant nil guard on subsequent err.Error() call
This commit is contained in:
claw
2026-05-12 19:06:52 -07:00
parent 629e29806c
commit d8c8a743ed
2 changed files with 18 additions and 11 deletions
+2 -2
View File
@@ -510,9 +510,9 @@ func TestYAMLEmptyFileRejection(t *testing.T) {
_, err := LoadPersona(path)
if err == nil {
t.Error("expected error for empty YAML input, got nil")
t.Fatal("expected error for empty YAML input, got nil")
}
if err != nil && !strings.Contains(err.Error(), "empty YAML document") {
if !strings.Contains(err.Error(), "empty YAML document") {
t.Errorf("expected error containing %q, got: %v", "empty YAML document", err)
}
})