butane/util: emit large MachineConfig integers as decimals - #2312
butcher-pudge-0 wants to merge 2 commits into
Conversation
Preserve JSON numbers as int64 before YAML encoding so sizeMiB and similar fields are not written in scientific notation. Fixes coreos#2309 Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (3)Documentation served via GitHub Pages/Jekyll. Every platform must be documented in supported-platforms.md. The ./test script validates doc consistency.⚙️ CodeRabbit configuration file Files:
- **Naming**: PascalCase exported, camelCase unexported, snake_case filenames📄 CodeRabbit inference engine (AGENTS.md) Files:
- **Formatting**: `gofmt` enforced (CI and `./test`)📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (4)
📝 WalkthroughWalkthroughChangesMachineConfig YAML integer preservation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized encoding change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The implementation addresses issue Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.) Full details: Commit Message ConventionExplanation Both non-merge commits in the PR range conform.
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Closing — starting over from scratch. |
Summary
sizeMiB/startMiBso values >= 1e6 are written as decimals (8389000) instead of scientific notation (8.389e+06).int64before YAML encoding inTranslateBytesYAML.json.Unmarshalintointerface{}otherwise usesfloat64, andyaml.v3then formats those values with scientific notation. MCO/Ignition cannot unmarshal that into*int.Fixes #2309
Fixes: https://redhat.atlassian.net/browse/OCPBUGS-114735
This is an alternative to #2310: that change YAML-unmarshals the intermediate JSON (and is still missing tests and a release note). This PR keeps a JSON decoder with
UseNumber()so integers stay integers, and includes tests plus a release-note entry.Test plan
go test -mod=vendor ./butane/config/util ./butane/config/openshift/v4_18--rawand confirmsizeMiB: 8389000(not8.389e+06)size_mib: 1231872renders assizeMiB: 1231872(not1.231872e+06)Made with Cursor