Skip to content

refactor(server): extract preflight checks into dedicated module#1527

Open
yeyitech wants to merge 1 commit intovolcengine:mainfrom
yeyitech:refactor/1436-preflight-module
Open

refactor(server): extract preflight checks into dedicated module#1527
yeyitech wants to merge 1 commit intovolcengine:mainfrom
yeyitech:refactor/1436-preflight-module

Conversation

@yeyitech
Copy link
Copy Markdown
Contributor

Summary

Move the inline Ollama availability check out of openviking/server/bootstrap.py into a new openviking/server/preflight.py module. Bootstrap now calls a single run_preflight_checks(ov_config) entry point which owns env detection, user-facing warnings, and exception swallowing.

This decouples bootstrap from the specifics of any one provider check and makes it trivial to add future preflight checks (vector DB reachability, model provider keys, etc.) without growing bootstrap.py further.

Changes

  • Add openviking/server/preflight.py with run_preflight_checks() and the extracted _check_ollama() helper.
  • Shrink openviking/server/bootstrap.py — the 23-line inline block becomes a single call.
  • Add tests/server/test_preflight.py covering: no-op when Ollama is not configured, success path, failure path (warning emitted), and exception-swallow safety.

Test plan

  • Smoke test via direct import — all 4 scenarios pass (pytest collection in this repo is blocked by an unrelated pytest-asyncio environmental issue; module-level behavior was verified manually).
  • bootstrap.py behavior unchanged for configured/unconfigured Ollama.

Closes #1436

Move the inline Ollama availability check out of bootstrap into a new
openviking/server/preflight.py module. Bootstrap now calls
run_preflight_checks() which owns env detection, user-facing warnings,
and error swallowing.

This unblocks adding future preflight checks (vector DB reachability,
model provider keys) without further growing bootstrap.

Closes volcengine#1436
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1436 - Partially compliant

Compliant requirements:

  • 将环境检测封装成一个独立的模块

Non-compliant requirements:

Requires further human verification:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🏅 Score: 95
🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

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.

考虑将环境检测,封装成一个独立的模块(可以在下次提交),非 blocking

1 participant