Publish curated ITWorx_MCP_Hub source from 6c7434368ce2a594005983c5a6601a31a639e7f1
This commit is contained in:
1 parent
77946d62c4
commit
6d40ab975c
86 files changed
+6784
-1478
No files matched your search
+29
-4
@@ -11,8 +11,10 @@ authorization, and the real policy engine -- not a mocked frontend:
|
||||
-> fake ContextForge (in-process MockTransport; nothing the
|
||||
browser talks to directly, so no real HTTP needed here)
|
||||
|
||||
Each subcommand below blocks running one of these processes; Playwright's
|
||||
`webServer` config (apps/web/playwright.config.ts) starts all three and
|
||||
The worker readiness dependency is an explicit offline fixture; worker reconciliation
|
||||
is validated by separate integration tests. Each subcommand below blocks running
|
||||
one of these processes; Playwright's
|
||||
`webServer` config (apps/web/playwright.config.ts) starts all four and
|
||||
waits for each to answer its readiness probe before running any test.
|
||||
|
||||
Persona switching: `OIDCSettings`/the real `/auth/login` route were left
|
||||
@@ -37,6 +39,7 @@ if str(ROOT) not in sys.path:
|
||||
|
||||
import httpx # noqa: E402
|
||||
import uvicorn # noqa: E402
|
||||
from fastapi import FastAPI # noqa: E402
|
||||
|
||||
from services.control_api.auth.config import OIDCSettings # noqa: E402
|
||||
from services.control_api.auth.fake_provider import FakeOIDCProvider # noqa: E402
|
||||
@@ -124,13 +127,29 @@ def run_control_api(port: int, oidc_port: int, web_port: int) -> None:
|
||||
uvicorn.run(app, host="127.0.0.1", port=port, log_level="warning")
|
||||
|
||||
|
||||
def run_web(port: int, control_port: int, dist_root: Path) -> None:
|
||||
def worker_readiness_fixture() -> FastAPI:
|
||||
"""Offline readiness dependency; worker reconciliation has separate integration tests."""
|
||||
app = FastAPI()
|
||||
|
||||
@app.get("/health/ready")
|
||||
def ready() -> dict[str, str]:
|
||||
return {"status": "ready", "component": "e2e-worker-fixture"}
|
||||
|
||||
return app
|
||||
|
||||
|
||||
def run_worker(port: int) -> None:
|
||||
uvicorn.run(worker_readiness_fixture(), host="127.0.0.1", port=port, log_level="warning")
|
||||
|
||||
|
||||
def run_web(port: int, control_port: int, worker_port: int, dist_root: Path) -> None:
|
||||
if not (dist_root / "index.html").is_file():
|
||||
raise SystemExit(
|
||||
f"{dist_root} has no built frontend; "
|
||||
"run `pnpm --filter @itworx-mcp-hub/web build` first"
|
||||
)
|
||||
os.environ["HUB_CONTROL_URL"] = f"http://127.0.0.1:{control_port}"
|
||||
os.environ["HUB_WORKER_URL"] = f"http://127.0.0.1:{worker_port}"
|
||||
os.environ["HUB_WEB_ROOT"] = str(dist_root)
|
||||
tls = generate_local_tls_material(STATE_DIR / "tls-web")
|
||||
uvicorn.run(
|
||||
@@ -158,15 +177,21 @@ def main() -> None:
|
||||
web_parser = sub.add_parser("web")
|
||||
web_parser.add_argument("--port", type=int, required=True)
|
||||
web_parser.add_argument("--control-port", type=int, required=True)
|
||||
web_parser.add_argument("--worker-port", type=int, required=True)
|
||||
web_parser.add_argument("--dist", type=Path, required=True)
|
||||
|
||||
worker_parser = sub.add_parser("worker")
|
||||
worker_parser.add_argument("--port", type=int, required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.command == "oidc":
|
||||
run_oidc(args.port)
|
||||
elif args.command == "control-api":
|
||||
run_control_api(args.port, args.oidc_port, args.web_port)
|
||||
elif args.command == "web":
|
||||
run_web(args.port, args.control_port, args.dist)
|
||||
run_web(args.port, args.control_port, args.worker_port, args.dist)
|
||||
elif args.command == "worker":
|
||||
run_worker(args.port)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user