Fix MapConsistency test: normalize custom_tribes key order to match gen-maps output 🧪 - #4809
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesCustom tribe normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/MapConsistency.test.ts`:
- Around line 76-80: The helper that reconstructs custom tribe entries must
validate each entry before accessing properties. Add a runtime guard ensuring
the entry is a non-null object with a valid string name and, when present, valid
coordinates; reject invalid entries by throwing or returning an error, while
preserving the existing name-first reconstruction for valid entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 618e6ae9-2891-44ad-8a2e-180e83d3b2af
📒 Files selected for processing (1)
tests/MapConsistency.test.ts
Description:
The
info.json metadata matches the generated Maps.gen.tstest in MapConsistency was comparing custom_tribes viaJSON.stringify, which is key-order-sensitive. Info.json files store tribes as{"coordinates":[...],"name":"..."}while the gen-maps codegen always outputs{name: "...", coordinates: [...]}(name first). ThenormalizeCustomTribesfunction passed through raw objects without reordering keys, causing semantically identical data to fail the string comparison.This fix explicitly reconstructs custom tribe objects in
normalizeCustomTribeswith consistent key ordering (namefirst, thencoordinates) to match the gen-maps output format.Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
FloPinguin