Repository navigation
fix(runtime): align local defaults with cloud - #956
Conversation
📝 WalkthroughWalkthroughThe change lowers the default VM memory from 2048 MiB to 1024 MiB, centralizes runtime default lookups, applies them during Krun VM configuration, and updates lifecycle expectations. ChangesVM default configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
2c8df38 to
09b5135
Compare
09b5135 to
d9e8ed8
Compare
📦 BoxLite review — looks good ·
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/boxlite/src/vmm/krun/engine.rs (1)
242-250: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract resolved VM config values into locals to avoid duplicate
unwrap_orcalls.
config.cpus.unwrap_or(DEFAULT_CPUS)andconfig.memory_mib.unwrap_or(DEFAULT_MEMORY_MIB)are each evaluated twice — once for logging and once forset_vm_config. Extracting them into local variables improves clarity and ensures the logged values are guaranteed identical to what's passed to the FFI.♻️ Proposed refactor
let mut ctx = KrunContext::create()?; + let cpus = config.cpus.unwrap_or(DEFAULT_CPUS); + let memory_mib = config.memory_mib.unwrap_or(DEFAULT_MEMORY_MIB); + tracing::debug!( - cpus = config.cpus.unwrap_or(DEFAULT_CPUS), - memory_mib = config.memory_mib.unwrap_or(DEFAULT_MEMORY_MIB), + cpus = cpus, + memory_mib = memory_mib, "Setting VM config" ); - ctx.set_vm_config( - config.cpus.unwrap_or(DEFAULT_CPUS), - config.memory_mib.unwrap_or(DEFAULT_MEMORY_MIB), - )?; + ctx.set_vm_config(cpus, memory_mib)?;🤖 Prompt for 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. In `@src/boxlite/src/vmm/krun/engine.rs` around lines 242 - 250, In the VM configuration setup around ctx.set_vm_config, resolve config.cpus and config.memory_mib once into local variables using the existing defaults, then reuse those locals in both tracing::debug! and set_vm_config. Keep the logged values identical to the values passed to the FFI.
🤖 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.
Nitpick comments:
In `@src/boxlite/src/vmm/krun/engine.rs`:
- Around line 242-250: In the VM configuration setup around ctx.set_vm_config,
resolve config.cpus and config.memory_mib once into local variables using the
existing defaults, then reuse those locals in both tracing::debug! and
set_vm_config. Keep the logged values identical to the values passed to the FFI.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f4a82f15-bc89-4ed9-852d-79729fc980ee
📒 Files selected for processing (5)
sdks/python/boxlite/constants.pysrc/boxlite/src/runtime/constants.rssrc/boxlite/src/runtime/types.rssrc/boxlite/src/vmm/krun/engine.rssrc/boxlite/tests/lifecycle.rs
Align local runtime and Python SDK default CPU/memory metadata with the cloud create defaults.
Test plan:
Summary by CodeRabbit
Improvements
Tests