Repository navigation
feat(web): add gbench-web UI, plugin API, and Cloud Run support (0.6.0) - #21
Open
lucianommartins wants to merge 1 commit into
Open
lucianommartins wants to merge 1 commit into
lucianommartins wants to merge 1 commit into
Conversation
- Backend (gbench/web/): add FastAPI server, SQLite WAL job queue with GPU UUID, server port, and Docker subnet leasing, file-backed logs (.gbench_web_logs/), SSE streaming with Last-Event-ID resume, crash-recovery state inference, fail-closed redact_tree() GCS sync, and gbench-web / python -m gbench.web entry points. - Plugin contract (gbench/web/protocols.py): add PLUGIN_API_VERSION = 1 protocols (AuthProvider, StateStore, JobExecutor, SubmissionPolicy, LogStreamProvider, ArtifactStore, CatalogExtension) loaded explicitly via GBENCH_WEB_PLUGIN (gbench.web.plugins entry-point group) and exposed via GET /api/capabilities. - Security and hosted mode: refuse non-loopback bind (0.0.0.0) by default unless an external AuthProvider is loaded or both GBENCH_WEB_AUTH_TOKEN (>= 32 chars, env-only, never logged, stripped from child subprocesses) and GBENCH_WEB_ALLOWED_HOSTS (rejecting bare * and single-label wildcards) are set; enforce HttpOnly SameSite=Strict cookies (__Host-gbench_session + Secure + HSTS under GBENCH_WEB_TLS_ENABLED=true), X-GBench-CSRF, Origin/Sec-Fetch-Site checks, a 20 req/min POST /api/auth/session rate limiter, SSRF/path validation, and --remote-only (GBENCH_WEB_REMOTE_ONLY) with vllm/GPU detection returning HTTP 422 on 0-GPU hosts. - Frontend (web/ -> gbench/web/static/): add React 19 + TypeScript + Vite SPA with Composer (/submit), Queue and Live Telemetry (/queue), Results Explorer (/runs, /runs/:runId), and Compare (/compare); auto-switch to Remote Endpoint mode when local serving is unavailable; commit built assets in gbench/web/static/ so pip install works without Node.js. - Packaging and container: bump version to 0.6.0 across pyproject.toml, gbench/__init__.py, gbench/web/__init__.py, web/package.json, web/package-lock.json, and uv.lock; add [web] optional extra (fastapi, starlette, uvicorn, google-cloud-storage); add multi-stage Node 22 + python:3.12-slim deploy/Dockerfile (non-root user gbench, GBENCH_WEB_REMOTE_ONLY=true, installs .[web] and transformers without torch or vllm), deploy/Dockerfile.dockerignore, deploy/.env.example, and ignore rules in .gitignore. - Docs and tests: add docs/web-ui.md, docs/cloud-run.md (parameterized .env setup, IAM/Secret Manager/GCS/optional IAP steps, verification, and teardown), and 167 tests under tests/web/; update README.md, CONTRIBUTING.md, docs/installation.md, docs/environment-variables.md, docs/deployment.md, docs/eval-suites.md, and tests/test_dependency_policy.py (including [web] and 3-segment google.cloud.<subpkg> matching); remove obsolete section 8 from docs/evals_roadmap.md. Signed-off-by: Luciano Martins <lucianommartins@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
gbench-web(gbench/web/), an optional local and containerized Web UI, managed job queue, live log viewer, and results explorer for gBench, and bumps the package version from0.5.0.post1to0.6.0. Coregbenchrunners andgbench/cli.pyare untouched (onlygbench/__init__.pyversion and the newgbench/web/subpackage are added undergbench/).The feature installs via
pip install -e ".[web]"(addingfastapi,starlette,uvicorn, andgoogle-cloud-storage). Compiled SPA assets undergbench/web/static/(~2.3 MB) are committed sopip installworks without Node.js.What Changed
gbench/web/): FastAPI app, SQLite WAL job queue with GPU UUID,GBENCH_SERVER_PORT, and Docker network pool leasing, file-backed logs (.gbench_web_logs/), SSE streaming withLast-Event-IDcursor resume, crash-recovery progress andsummary.jsonexit inference, fail-closedredact_tree()private GCS sync, andgbench-web/python -m gbench.webentry points.gbench/web/protocols.py):PLUGIN_API_VERSION = 1protocols (AuthProvider,StateStore,JobExecutor,SubmissionPolicy,LogStreamProvider,ArtifactStore,CatalogExtension), loaded only when explicitly requested viaGBENCH_WEB_PLUGIN(gbench.web.pluginsentry-point group) and reported byGET /api/capabilities.gbench/web/security.py,gbench/web/app.py,gbench/web/cli_contract.py):127.0.0.1,localhost,::1) with a one-time bootstrap token printed to stdout (never written to disk).--host 0.0.0.0unless either an externalAuthProvider(requires_loopback_bind = False) is active or both env-onlyGBENCH_WEB_AUTH_TOKEN(>= 32chars, never logged, stripped from child subprocesses) andGBENCH_WEB_ALLOWED_HOSTS(rejecting bare*and single-label wildcards) are configured.HttpOnly; SameSite=Strictcookies (__Host-gbench_session,Secure, and HSTS whenGBENCH_WEB_TLS_ENABLED=true),X-GBench-CSRFdouble-submit tokens,OriginandSec-Fetch-Sitechecks (honoringX-Forwarded-Proto: https), a dedicated20 req/minrate limiter onPOST /api/auth/sessionwith stale-bucket eviction, SSRF checks, and path containment.--remote-only(GBENCH_WEB_REMOTE_ONLY) and automatic localvllm/GPU detection; rejects non-remote jobs with HTTP422onPOST /api/jobs,POST /api/jobs/{job_id}/clone, andPOST /api/jobs/preflightbefore policy evaluation.web/and committedgbench/web/static/): React 19 + TypeScript + Vite + Tailwind SPA with Composer (/submit), Queue and Live Telemetry (/queue), Results Explorer (/runs,/runs/:runIdwith tabbed serving/throughput/stress charts, Golden Set, Agentic Quality, and lazysample_traces), and Compare (/compare). Auto-switches Tier 1 to Remote Endpoint mode and showsRemote-only modein the header when local serving is unavailable.deploy/,pyproject.toml,uv.lock,.gitignore): Multi-stagenode:22-slim+python:3.12-slimdeploy/Dockerfilerunning as non-root usergbenchwithGBENCH_WEB_REMOTE_ONLY=true, installing.[web]plustransformers(withouttorchorvllm) for--remote-endpoint--tokenizersizing. Addsdeploy/Dockerfile.dockerignore,deploy/.env.example, and ignore patterns for.env.*,*.tfvars.json,*.tfplan,**/.gbench_web.sqlite3*, and**/.gbench_web_logs/. Single unforkeduv.lockresolve (279 packages).docs/web-ui.mdanddocs/cloud-run.md(parameterized.envworkflow, deployer IAM roles, API enablement, Artifact Registry, Secret Manager, GCS, optional IAP setup, verification, and cleanup). UpdatesREADME.md,CONTRIBUTING.md(frontend rebuild rule forgbench/web/static/),docs/installation.md,docs/environment-variables.md,docs/deployment.md, anddocs/eval-suites.md. Removes obsolete section 8 fromdocs/evals_roadmap.md.tests/web/,tests/test_dependency_policy.py): Adds 167 tests covering API routes, queue leasing, log streaming, crash recovery, GCS sync/redaction, security controls, plugin protocols, hosted token mode, and remote-only mode. Updatestests/test_dependency_policy.pyto include thewebextra and 3-segmentgoogle.cloud.<subpkg>matching (google.cloud.storage->google-cloud-storage).Verification
ruff check gbench/web tests/web: passed (0errors).npm --prefix web run lint && npm --prefix web run build(Node 22): passed; rebuiltgbench/web/static/with no stale duplicate hashed bundles.pytest tests/web/:167 passed.pytest tests/test_dependency_policy.py -k "not test_the_python_legs_match_requires_python_and_the_classifiers":19 passed, 1 deselected(the single deselected test is pre-existing onmaind3e4283, where.github/workflows/test.ymllists Python3.11/3.12whilepyproject.tomlincludes classifier3.13).pytest tests/test_repo_gates_and_shared_docs.py tests/test_roadmap_deregistration_and_base_hooks.py: passed, with zero broken relative links or#8-web-dashboardreferences.pip install --no-deps --no-build-isolation -e .),gbench-web, andpython -m gbench.web --helpall report0.6.0.127.0.0.1:8765) and refusal of--host 0.0.0.0(exit2).docker build -f deploy/Dockerfile) verified default0.0.0.0refusal without env config, loopback run with bind-mountedresults/via--user "$(id -u):$(id -g)", and hosted token mode (200on/api/healthand matching*.run.appHost,403on untrustedHost,401unauthenticated/api/jobs,200+Set-Cookie+csrf_tokenonPOST /api/auth/session, token omitted from stdout).roles/run.invoker, HTTP302redirect for unauthenticatedcurl, zero secret output in startup logs, HTTPS session gate withRemote-only modeUI auto-switching, and clean teardown of temporary test resources.Contributor Notes
web/src/orweb/build config/assets change, runnpm --prefix web run lint && npm --prefix web run buildbefore committing sogbench/web/static/stays in sync (ViteemptyOutDir: trueremoves stale hashed files automatically).--max-instances 1unless supplying an externalStateStoreandAuthProviderviaGBENCH_WEB_PLUGIN.