test(local-inference): make the vm_stat availability test host-independent - #11534
Conversation
…ndent The new "counts macOS reclaimable pages" test asserted freeBytes > ~38 GiB, but readSystemMemory caps the vm_stat reading at the live host's os.totalmem() — so the test only passed on machines with more RAM than the capture host (128 GiB M4 Max) and failed on this 32 GiB Linux box and on CI runners. Make totalmem injectable (same pattern as the meminfo/vm_stat readers), pin it to 128 GiB in the test, and add an explicit cap test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
Follow-up to #11517 (merged). The new "counts macOS reclaimable pages from vm_stat" test asserted
freeBytes > ~38 GiB, butreadSystemMemorycaps the vm_stat reading at the live host'sos.totalmem()— so the test only passes on machines with more RAM than the capture host (128 GiB M4 Max). It fails deterministically on this 32 GiB Linux dev box and will fail on standard CI runners:Fix: make
totalmeminjectable (the same pattern the file already uses for the meminfo and vm_stat readers), pin it to 128 GiB in the test so the exact page math is asserted deterministically, and add an explicit cap test (min(available, total)).Verification (local, this branch on top of develop)
vitest run src/services/system-memory.test.ts— 9/9 passbun run --cwd plugins/plugin-local-inference typecheck— cleanbiome checkon both files — cleanNo runtime behavior change: the default parameter is
os.totalmem, identical to the previous hardcoded call.🤖 Generated with Claude Code