fix(v3): mapsEqual test helper panics on slice values#5402
Conversation
The mapsEqual helper in build-assets_test.go compared map values with ==, which panics at runtime when a value is a slice. TestPreserveOriginallyEmptyContainers/originally_empty_array_is_preserved triggers exactly that case, taking down the entire internal/commands package test run on every platform and blocking unrelated PRs. Use reflect.DeepEqual for the leaf value comparison so slice values compare correctly. Nested map handling and the nil/empty-tolerant len check are unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR enhances the test file ChangesTest Improvements for Plist Dictionary Sanitization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.1)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a runtime panic in the mapsEqual test helper used by v3/internal/commands tests when map leaf values are slices (e.g. []any{}), by switching the leaf comparison from == to reflect.DeepEqual.
Changes:
- Import
reflectinbuild-assets_test.go. - Replace leaf value comparison
av != bvwith!reflect.DeepEqual(av, bv)inmapsEqual, while preserving the existing nested-map recursion and length checks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…Equal test helper panics on slice values
Summary
mapsEqualinv3/internal/commands/build-assets_test.gocompares leaf values with==, which panics at runtime when the value is a slice ([]any).TestPreserveOriginallyEmptyContainers/originally_empty_array_is_preserveddeliberately puts an empty[]anyinto amap[string]any, hitting that line and panicking — which takes down the entireinternal/commandspackage test run on every OS, blocking unrelated PRs (e.g. fix(v3/examples): update go.sum files for Windows webview2 dependency #5400).reflect.DeepEqual. Nested-map recursion and thelen(a) != len(b)early-out are preserved, so nil-vs-empty semantics are unchanged.Diff
Test plan
go test -count=1 ./v3/internal/commands/...— passes locally (was panicking before).Summary by CodeRabbit