fix: preserve slot_position and slot_width in YAML serialization#1564
Conversation
slot_position (half-width device placement) and slot_width (half-width device type flag) were accidentally stripped from YAML output in dd25f4c when the YAML editor panel feature was added. This caused two half-width devices placed side-by-side to serialize identically, losing their left/right distinction and crashing on reload with each_key_duplicate. Restores the fix originally introduced in 3661eba. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
📝 WalkthroughWalkthroughThis change updates YAML serialization logic to conditionally include Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
CodeAnt AI finished reviewing your PR. |
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI Incremental review completed. |
|
Thanks for your contribution, @lorenzowood ! |
User description
Summary
slot_position(half-width device left/right placement) andslot_width(half-width device type flag) were accidentally stripped from YAML output in dd25f4c when the YAML editor panel feature was addedeach_key_duplicateRoot cause
dd25f4c("feat: add YAML editor panel") removed both fields fromorderPlacedDeviceFields()andorderDeviceTypeFields()inyaml.ts, and rewrote the round-trip test to assert they were absent — incorrectly labelling them as "deprecated NetBox fields".slot_positionis Rackula's own placement field; it was never deprecated.Changes
src/lib/utils/yaml.ts— restoreslot_positioninorderPlacedDeviceFields()andslot_widthinorderDeviceTypeFields()src/tests/yaml-roundtrip.test.ts— replace the incorrect test with one that verifies both fields survive a full save/load round-trip for a pair of side-by-side half-width devicesTest plan
npm run test:run -- yaml-roundtrippasses🤖 Generated with Claude Code
CodeAnt-AI Description
Preserve half-width device placement in YAML save and load
What Changed
Impact
✅ Correct half-width device placement✅ Fewer layout reload errors✅ Safer YAML save and restore🔄 Retrigger CodeAnt AI Review
Details
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.