Skip to content

test(local-inference): make the vm_stat availability test host-independent - #11534

Merged
lalalune merged 1 commit into
developfrom
fix/vmstat-test-host-independent
Jul 2, 2026
Merged

test(local-inference): make the vm_stat availability test host-independent#11534
lalalune merged 1 commit into
developfrom
fix/vmstat-test-host-independent

Conversation

@lalalune

@lalalune lalalune commented Jul 2, 2026

Copy link
Copy Markdown
Member

Follow-up to #11517 (merged). The new "counts macOS reclaimable pages from vm_stat" test asserted freeBytes > ~38 GiB, but readSystemMemory caps the vm_stat reading at the live host's os.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:

FAIL src/services/system-memory.test.ts > readSystemMemory > counts macOS reclaimable pages from vm_stat, not just Pages free
AssertionError: expected 33352902656 to be above 37915672576

Fix: make totalmem injectable (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 pass
  • bun run --cwd plugins/plugin-local-inference typecheck — clean
  • biome check on both files — clean

No runtime behavior change: the default parameter is os.totalmem, identical to the previous hardcoded call.

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a1a50b1e-daa4-413b-97f7-b0168cb1bec2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vmstat-test-host-independent

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalalune
lalalune merged commit eed83b8 into develop Jul 2, 2026
12 of 34 checks passed
@lalalune
lalalune deleted the fix/vmstat-test-host-independent branch July 2, 2026 19:37

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant