Skip to content

refactor: split endpoint routes and extract app and CLI assembly - #196

Merged
hlin99 merged 2 commits into
mainfrom
refactor/endpoint-routes-app-cli
Oct 29, 2026
Merged

hlin99 merged 2 commits into
mainfrom
refactor/endpoint-routes-app-cli

Conversation

@hlin99

@hlin99 hlin99 commented Oct 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Split routes into logical endpoint modules, keeping URL aliases and OPTIONS handlers together.
  • Share completion execution and helpers in xpyd/completion_handler.py without reverse runtime imports.
  • Extract CLI/configuration handling into xpyd/cli.py and FastAPI assembly/lifecycle into xpyd/app.py, preserving xpyd.proxy:main.
  • Move instance status routing into routes/status.py and document module boundaries.

Validation

  • 362 targeted tests passed for completion handling, CLI, routes, discovery, scheduling contracts, metrics, tokenizer loading, and source launchers.
  • 9 new application/route cases passed, including simulated proxy-first startup, discovery, partial node loss, reconnection, status output, heartbeats, custom handlers, and ZMQ lifecycle ordering.
  • Verified all 41 HTTP method/path registrations and unchanged extracted completion, generator, Proxy, runtime-construction, and CLI-helper logic.
  • Ruff, isort, Black, Flake8/bugbear, and whitespace checks passed.
  • Lifecycle checks used simulated backends; no model/GPU services were started.

Signed-off-by: Tony Lin <tony.lin@intel.com>
Comment thread xpyd/app.py Fixed
Comment thread xpyd/completion_handler.py Fixed
Comment thread xpyd/proxy.py Fixed
Comment thread xpyd/proxy.py Fixed
Comment thread xpyd/proxy.py Fixed
Comment thread tests/unit/test_app.py Fixed
Remove runtime-invisible TYPE_CHECKING imports of Proxy from xpyd.app and
xpyd.completion_handler so the module graph stays acyclic; annotations
remain forward references. Also make the subprocess program string in the
app test explicit to silence implicit string concatenation.

Signed-off-by: Tony Lin <tony.lin@intel.com>
@hlin99
hlin99 merged commit 502bd3b into main Oct 29, 2026
24 checks passed
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.

2 participants