Skip to content

[BOUNTY] feat: add cross-platform fallbacks for memory and load health checks#26

Open
lamguo wants to merge 3 commits into
weilixiong:mainfrom
lamguo:main
Open

[BOUNTY] feat: add cross-platform fallbacks for memory and load health checks#26
lamguo wants to merge 3 commits into
weilixiong:mainfrom
lamguo:main

Conversation

@lamguo

@lamguo lamguo commented Jun 26, 2026

Copy link
Copy Markdown

Summary

Add cross-platform fallbacks for check_memory_usage() and check_load_average() in tools/health_check.py. Previously these functions read Linux-only /proc files, returning generic WARNING on macOS, Windows, and other platforms.

Changes

check_memory_usage() - 4-platform support

Platform Method
Linux /proc/meminfo (unchanged)
macOS sysctl hw.memsize + vm_stat
Windows ctypes.GlobalMemoryStatusEx
POSIX fallback os.sysconf('SC_PHYS_PAGES')

check_load_average()

  • Linux: /proc/loadavg (unchanged)
  • Other: os.getloadavg() with graceful WARNING degradation

Tests

Added test_health_check_fallbacks.py (10 tests covering all platforms)

Testing

  • All 10 unit tests pass
  • Windows validation: memory fallback returns real usage (62.1%)
  • Load reports WARNING on Windows (os.getloadavg unavailable - graceful degradation)
  • Linux code paths untouched; output format unchanged

Checklist

  • Tests pass locally
  • Changes scoped to PR purpose
  • Backward compatible for existing callers

lamguo added 2 commits June 26, 2026 23:05
- check_memory_usage(): Linux /proc/meminfo, macOS sysctl+vm_stat, Windows ctypes, POSIX sysconf

- check_load_average(): Linux /proc/loadavg, other platforms os.getloadavg()

- Add test_health_check_fallbacks.py with 10 tests covering all platforms

- Maintains full backward compatibility for Linux output
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