Skip to content

refactor(cli): share RAM environment detection#1950

Open
duyua9 wants to merge 1 commit intovolcengine:mainfrom
duyua9:fix/cli-ram-environment-devc
Open

refactor(cli): share RAM environment detection#1950
duyua9 wants to merge 1 commit intovolcengine:mainfrom
duyua9:fix/cli-ram-environment-devc

Conversation

@duyua9
Copy link
Copy Markdown
Contributor

@duyua9 duyua9 commented May 9, 2026

Description

Move the setup wizard's RAM detection into a reusable CLI environment helper. This keeps the existing openviking-server init RAM-tier recommendations unchanged while making the detection logic available to future environment/doctor checks.

Related Issue

Related to #1436

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Added openviking_cli.utils.environment.get_system_ram_gb().
  • Updated setup_wizard.py to reuse the shared helper for RAM-tier model recommendations.
  • Added focused tests for sysconf detection, Windows fallback detection, and failure fallback.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Commands run:

python3 -m pytest -o addopts='' --confcutdir=tests/cli tests/cli/test_environment.py tests/cli/test_setup_wizard.py::TestRAMRecommendations -q
git diff --check

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A

Additional Notes

Full pytest collection was not run because this local environment is missing optional dependencies required by the repository-level test conftest. The scoped CLI tests above avoid that global conftest and cover the changed helper directly.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

1436 - Fully compliant

Compliant requirements:

  • Moved RAM detection to a reusable openviking_cli.utils.environment module
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ Recommended focus areas for review

Overly Broad Exception Catch

The Windows fallback uses except Exception: which could suppress unexpected errors. While this preserves existing behavior, it hinders debugging if new failure modes arise.

except Exception:
    pass

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

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

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant