Skip to content

feat(health_check): add cross-platform fallbacks for memory and load checks (fixes #1) - #58

Open
Fuhua-GIF wants to merge 68 commits into
weilixiong:mainfrom
Fuhua-GIF:feat/cross-platform-health-check
Open

feat(health_check): add cross-platform fallbacks for memory and load checks (fixes #1)#58
Fuhua-GIF wants to merge 68 commits into
weilixiong:mainfrom
Fuhua-GIF:feat/cross-platform-health-check

Conversation

@Fuhua-GIF

Copy link
Copy Markdown

Summary

Adds cross-platform fallbacks for check_memory_usage() and check_load_average() in tools/health_check.py, as requested in #1.

Changes

  • Updated tools/health_check.py:

    • check_memory_usage(): Keeps /proc/meminfo on Linux; falls back to psutil, then Windows GlobalMemoryStatusEx, then macOS sysctl+vm_stat, then generic warning
    • check_load_average(): Keeps /proc/loadavg on Linux; falls back to os.getloadavg() (macOS/Unix), then psutil.getloadavg(), then Windows CPU% proxy, then generic warning
    • All fallbacks return the same (status, detail, value) tuple format for backward compatibility
    • Linux behavior is unchanged
  • Added tests/test_health_check_fallback.py: 5 tests covering:

    1. Memory check returns valid tuple
    2. Load check returns valid tuple
    3. Memory fallback works when /proc/meminfo is missing
    4. Load fallback works when /proc/loadavg is missing
    5. Backward compatibility (output format preserved)

Fallback Behavior

Platform Memory Check Load Check
Linux /proc/meminfo (unchanged) /proc/loadavg (unchanged)
macOS sysctl + vm_stat os.getloadavg()
Windows GlobalMemoryStatusEx (ctypes) psutil.cpu_percent() or warning
Other psutil if available os.getloadavg() if available

Checklist

  • check_memory_usage() keeps /proc/meminfo on Linux, has non-Linux fallback
  • check_load_average() keeps /proc/loadavg on Linux, falls back to os.getloadavg()
  • Focused tests added simulating missing /proc files
  • JSON and text output remain backward compatible
  • PR description explains fallback behavior and validation

Fixes #1

lobster-trap and others added 30 commits June 16, 2026 11:25
Merges external bounty submission for issue Saiaaax#1. Structural review confirmed source changes, tests, issue closure, and required diagnostic bundle. Local Java execution was unavailable in this runner; submitted diagnostic JSON reports the affected compliance module as PASS.
Merged after owner review for fork bounty issue Saiaaax#2. The PR removes ComplianceAuditor class-load network I/O, adds explicit override loading with tests, and includes diagnostic/build-807b0396.json plus diagnostic/build-807b0396.logd. Local Java execution could not be rerun in this environment because no Java runtime is installed; submitted diagnostic metadata reports the affected compliance module as PASS.
Merged after owner review for fork bounty issue Saiaaax#9. The focused package test ok  	github.com/tent-of-trials/market/analytics	(cached) passes locally, the diff check is clean, and the PR includes diagnostic/build-968e5b08.json plus diagnostic/build-968e5b08.logd with the market module reported as PASS.
Merged after owner review for fork bounty issue Saiaaax#19. The PR includes diagnostic/build-c55f8a6d.json plus split diagnostic/build-c55f8a6d-part001.logd through part006.logd. The submitted diagnostic metadata failed because that runner lacked Ruby, so I reran validation locally in an isolated temporary GEM_HOME with the service dependencies installed: , , and  all passed; the test run reported 5 runs, 10 assertions, 0 failures.
Merged after owner review for fork bounty issue Saiaaax#3. The PR includes source changes, a focused Java regression test, diagnostic/build-acbafcb1.json, and diagnostic/build-acbafcb1.logd. Local Java execution could not be rerun in this environment because no Java runtime is installed; the submitted diagnostic metadata reports the affected compliance module as PASS.
Merged after owner review for fork bounty issue Saiaaax#6. Focused validation passed in a sparse checkout with cd market && go test ./gateway. The PR includes diagnostic/build-54fd6e7a.json and diagnostic/build-54fd6e7a.logd with the market module reported as PASS.
Merged after owner review for fork bounty issue Saiaaax#5. Focused validation passed in a sparse checkout with cd market && go test ./ws. The PR includes diagnostic/build-f994d258.json and diagnostic/build-f994d258.logd with the market module reported as PASS.
Merged after owner review for fork bounty issue Saiaaax#8. Focused validation passed in a sparse checkout with cd market && go test ./analytics. The PR includes diagnostic/build-d8fc4651.json and diagnostic/build-d8fc4651.logd with the market module reported as PASS. Fixes Saiaaax#8.
jaxassistant55 and others added 29 commits June 20, 2026 19:11
…ualization-14

Virtualize large order book rendering
Generate structured compliance report payloads
…-base-url

Require explicit API base URL outside development
# Conflicts:
#	frontend/package.json
…le-flight

Fix auth refresh single-flight
…webhook-18-validated

Load log watchdog Slack webhook from configuration
…ion-dry-run-20

Add legacy migration dry-run restore validation
…hutdown-15

Define logger post-shutdown behavior
…t-all-16

Implement connector wait-all timeout handling
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.

[$50 BOUNTY] [Python] Add cross-platform health check fallbacks

8 participants