Skip to main content

WUP Browser Dashboard — FastAPI backend for WUP regression watcher

Project description

wupbro

FastAPI backend + minimal HTML dashboard for the WUP regression watcher.

Architecture

┌──────────────────────┐   POST /events    ┌──────────────────────┐
│  WUP agent (shell)   │ ───────────────▶  │  wupbro (FastAPI)   │
│  - file watcher      │                   │  - /events (sink)    │
│  - testql runner     │                   │  - /drivers/*        │
│  - visual diff       │                   │  - /dashboard (UI)   │
└──────────────────────┘                   └──────────────────────┘
                                                      │
                                                      ▼
                                            ┌─────────────────┐
                                            │ Browser UI      │
                                            │ (auto-refresh)  │
                                            └─────────────────┘

Endpoints

Path Method Purpose
/events POST Receive event from a WUP agent
/events GET List recent events (filter by type/service)
/events/stats GET Aggregate counts by type
/events DELETE Clear store (admin/debug)
/drivers/dom-diff/capture POST One-shot Playwright DOM snapshot + diff
/drivers/browserless/screenshot POST Proxy to a browserless/chrome container
/drivers/anomaly/report POST Record numeric anomaly as ANOMALY event
/drivers/health GET Driver capability discovery
/, /dashboard GET HTML dashboard
/healthz GET Liveness probe
/openapi.json, /docs GET OpenAPI spec + Swagger UI

Event types

REGRESSION, PASS, ANOMALY, VISUAL_DIFF, HEALTH_TRANSITION.

Schema (Pydantic):

{
  "type": "REGRESSION",
  "service": "users-web",
  "file": "app/users/routes.py",
  "endpoint": "/api/users",
  "status": "fail",
  "stage": "quick",
  "reason": "TestQL exit code 1",
  "timestamp": 1730000000
}

Extra fields are preserved via model_config = {"extra": "allow"}.

Run

# Install
pip install -e wupbro/

# Dev server (auto-reload)
wupbro --reload --port 8000

# Or directly
uvicorn wupbro.main:app --host 0.0.0.0 --port 8000 --reload

Dashboard: http://localhost:8000/

OpenAPI docs: http://localhost:8000/docs

Configure WUP agent to send events

In your wup.yaml:

web:
  enabled: true
  endpoint: "http://localhost:8000"
  endpoint_env: "WUPBRO_ENDPOINT"   # fallback if endpoint is empty
  timeout_s: 2.0                     # short — must not block watcher
  api_key: ""                        # optional bearer token

Or via environment variable:

export WUPBRO_ENDPOINT=http://localhost:8000
wup watch . --mode testql

The agent will POST events fire-and-forget on:

  • service health transitions (up ↔ down)
  • regressions (when TestQL fails)
  • visual DOM diffs (when significant changes detected)

Browserless integration

docker run -d --name browserless -p 3000:3000 browserless/chrome
export BROWSERLESS_URL=http://localhost:3000
wup-web

Then:

curl -X POST http://localhost:8000/drivers/browserless/screenshot \
  -H "Content-Type: application/json" \
  -d '{"url": "http://example.com", "full_page": true}'

Storage

Events are kept in an in-memory ring buffer (capacity 1000) and persisted to .wupbro/events.jsonl for restart durability.

Tests

PYTHONPATH=wupbro python3 -m pytest wupbro/tests/ -v

17 tests covering events router, drivers (anomaly, browserless, dom-diff, health), dashboard HTML, OpenAPI schema.

License

Licensed under Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wupbro-0.1.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wupbro-0.1.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file wupbro-0.1.2.tar.gz.

File metadata

  • Download URL: wupbro-0.1.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wupbro-0.1.2.tar.gz
Algorithm Hash digest
SHA256 24d8114df54663bfd2e91ac1261098e27537eea7550472cac89f3b6dd3432d1e
MD5 bedf69341d150b1727d5521bfafb838c
BLAKE2b-256 4196b3c1ee24d4cc3f5f239bc5fec32d0865e59a2bc3d2940bab1dfc3079f23a

See more details on using hashes here.

File details

Details for the file wupbro-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: wupbro-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for wupbro-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ed8e919fea7fd2c4c6a4a8cedf0279d6e4a1a195c5c2cd5645c990e5790eab1
MD5 9bf154abbf7f5bfc08e41df32a5cd3a6
BLAKE2b-256 93826d8c9c644155a8004638d1cf5004847cc11842e6e120364221a6f12ba809

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page