Skip to content
amiel349Public

About

Drone delivery ops platform: Flask, Vue 3 + TS, RabbitMQ, a multithreaded drone simulator, pytest + Playwright automation, and Claude-powered copilot and test triage

Resources

Stars

0 stars

Watchers

2 watching

Forks

Repository files navigation

Skyhaul

CI

A drone delivery operations platform: dispatchers watch a live fleet, send commands, plan missions and handle alerts. The drones are a separate system behind a message contract, so a multithreaded simulator plays their part and can inject faults.

It is built to show three things end to end:

  • Test automation infrastructure (the centrepiece): a layered test pyramid and an end-to-end framework in Python with Playwright and pytest.
  • A full-stack product: Flask services, PostgreSQL, RabbitMQ, Redis, and a Vue 3 + TypeScript UI with a live map.
  • AI-driven development: agents, skills and rules in the repo, with a human approving every merge. AI product features come next.

Live fleet over Tel Aviv, with the selected drone's telemetry and command form

Progress

Milestone Scope Status
M0 Foundations: repo, tooling, CI, security guardrails, agent team Done
M1 Message contracts and the drone simulator, with an MCP server Done
M2 Fleet backend: API, ingestor, PostgreSQL, Redis, realtime Done
M3 Dispatcher UI: live map, commands, missions, alerts, sessions Done
M3b Visitor demo: a private simulation per visitor, fault buttons, idle expiry Done, runs locally
M4 End-to-end test framework In progress
M5 AI copilot ("SkyhaulAI") with evals Planned
M6 AI test intelligence: failure triage Planned
M7 Public demo deployment Planned

M4 so far: an isolated test stack, clients and fixtures, the Playwright layer, a fake drone and a live event listener, the first suites, retries and test quarantine, the CI workflow for the suite with Allure reports and a gate before every upload, and a weekly quarantine bot (tested against a fake GitHub; it has not run in CI yet).

What you can do in the app

  • Watch drones move on a live map, with fading trails (all, the selected drone only, or none) and home points.
  • Send commands (arm, take off, go to, return home, land); commands the drone is sure to refuse are disabled with the reason.
  • Plan a mission by clicking the map, launch it, follow its progress and abort it.
  • Handle alerts: acknowledge, remove one or many, send a drone home from a low-battery alert.
  • As a demo visitor, get a private simulation with no sign-up, and break things: drop a link, reject a command, drain a battery.
A lost link raises an alert Missions with live progress
A drone with a lost link and the alert it raised The missions panel beside the live map

Testing

Every check sits at the lowest layer that can prove it.

Layer What it proves Tool Tests*
Python unit and contract Rules, message contracts, concurrency in the simulator pytest 1,062
Integration Real RabbitMQ, PostgreSQL and Redis pytest, Testcontainers 178
Web unit Stores and logic Vitest 119
Web components One test file per component, in a real browser Vitest browser mode 254
Test infrastructure The E2E framework's own code and CI tools pytest 731
End to end Critical and happy flows on the whole stack pytest, Playwright 34

Coverage gates: CI fails a Python package below its floor (unit tests, source only; floors in scripts/coverage_floors.toml, checked by scripts/check_coverage.py) and a web project below its Vitest thresholds (web/vite.config.ts for unit, web/vitest.browser.config.ts for components). Floors only go up; the ratchet policy is in the floors file. Nothing is uploaded.

* As of 1 December 2026, counted by local runs. CI is set up for all six: the first five in the CI workflow, end to end in the E2E workflow. The canary, a test that fails on purpose, is not counted.

What the end-to-end framework does

  • Isolated stack: its own Compose project, ports, database and generated secrets, so it cannot touch development data.
  • Simple tests: one injected skyhaul object with signed-in actors (skyhaul.dispatcher.api, skyhaul.dispatcher.ui), built by composition. Pages, panels and widgets each keep their locators in a separate class.
  • Parallel and isolated: each test owns its drones in a namespace of its own.
  • Fast and exact data: a fake drone publishes contract-valid telemetry and answers commands as a test scripts it (accept, refuse, delay or silence), through the real broker, ingestor and API. A few real_sim tests prove real flight with the simulator.
  • Live events: tests wait for the server's Socket.IO events on their own drones instead of polling.
  • Safe artifacts: on failure it keeps a trace, video, screenshot and logs, including the API and ingestor lines of that test's requests. Traces and logs are scrubbed of secrets and checked; what cannot be proven clean is not attached.
  • Gated uploads: CI uploads only what one tool has checked again, file by file, with the stack's own secrets and gitleaks, traces opened. If one file fails, nothing is uploaded.
  • In CI: the suite runs on a fresh stack with 4 workers; tests quarantined as flaky run in a separate job that cannot block a merge. Reports are made by a checksum-pinned Allure tool, with trend history.
  • Honest about flakiness: a test that passes only on retry is reported as flaky. A weekly bot reads those results and proposes quarantine changes in a pull request that a person merges: it can only add a test or move it from flaky to skip. Only a person removes or relaxes an entry, after investigating.
courier = skyhaul.drones.fake()
alerts = skyhaul.dispatcher.ui.fleet.open().alerts
alerts.filter_by_drone(courier.id)
alert = skyhaul.drones.raise_alert(courier, "GEOFENCE_BREACH")
row = alerts.row(alert.id)
row.acknowledge()
expect(row.locators.acknowledged_note).to_be_visible()

Run the end-to-end tests

make e2e-setup    # once, and after a Playwright update: install the browser
make e2e-up       # start the isolated stack (web UI on http://127.0.0.1:28080); run again after changing web/ or services/
make e2e          # API and browser tests on 4 workers
make e2e-down     # stop it
Option Effect
WORKERS=8 Number of parallel workers
ARGS="-k mission" Run some tests only
HEADED=1 SLOWMO=300 WORKERS=1 Watch the browser
ARGS="-m real_sim" Only the tests that fly the real simulator
E2E_RETRIES=1 Up to 3 attempts per test; a fail-then-pass is reported as flaky
FRESH=1 Delete the E2E database and secrets first

make e2e-flaky runs only the quarantined flaky tests, make e2e CANARY=1 ARGS="-k canary" runs a test that fails on purpose to show what a failure leaves, and make test-infra tests the framework itself. The E2E stack can run beside the development stack, but running one at a time uses less of your machine. Guide: tests/README.md. Design: docs/architecture/m4-e2e.md and ADR 0021.

Architecture

Dashed lines are planned.

flowchart LR
  UI[Dispatcher UI<br/>Vue 3 + TS] -- REST / Socket.IO --> API[Fleet API<br/>Flask]
  API -- commands --> MQ[(RabbitMQ)]
  MQ -- commands --> SIM[Drone simulator<br/>multithreaded]
  SIM -- telemetry --> MQ
  MQ -- telemetry --> ING[Telemetry ingestor]
  ING --> PG[(PostgreSQL)]
  ING --> RD[(Redis)]
  RD -- pub/sub --> API
  API --> PG
  API -- control API --> SIM
  PW[E2E tests<br/>pytest + Playwright] --> UI
  PW --> API
  PW -- faults --> SIM
  MCP[MCP server] -- control API --> SIM
  UI -.-> COP[AI copilot]
  COP -.-> API
Loading

Quick start

Requirements: Docker, uv, Node 26, pnpm, gitleaks, pre-commit.

make setup   # dependencies and git hooks
make env     # .env with generated secrets
make up      # local stack on 127.0.0.1
make check   # lint, types, tests, coverage gates, secret scan

make up runs two one-shots before the API and the ingestor start: migrate (Alembic, as the schema owner skyhaul_owner) and broker-init (creates the broker users skyhaul_api and skyhaul_ingestor and declares the whole RabbitMQ topology). Every service then connects with its own least-privilege Postgres role and broker user (ADR 0013). The API serves REST on 127.0.0.1:8000/api/v1 and Socket.IO namespace /fleet on the same port; clients pass the access token as auth: {token}.

Run the app locally

make setup   # once: Python and web dependencies
make env     # once: .env with generated secrets
make up      # API, ingestor, Postgres, RabbitMQ, Redis
make sim     # drone simulator
make seed    # 3 drones over Tel Aviv, sent on patrol missions
make web     # the UI on http://localhost:5173; keeps running, use its own terminal
make down    # stop the stack (your data is kept)

To get a login, add your own local admin to the git-ignored .env.dev before make up (local use only; with no password set, no admin is created):

[email protected]
DEV_ADMIN_PASSWORD=choose-a-local-password

The map's area is set in contracts/geo/demo-area.v1.json.

The visitor demo is off by default. To try it locally, add these two lines to the git-ignored .env.dev, then run make up and make sim:

SANDBOX_ENABLED=true
SANDBOX_SIM_URL=http://drone-sim:8100

Open the UI in a private window to arrive as a visitor; staff sign in at /login. Do not run the demo simulator profile at the same time as make sim.

make up first runs two one-shot jobs: database migrations and the RabbitMQ setup. Every service then connects with its own least-privilege database role and broker user (ADR 0013).

Upgrading a stack from before M2 realtime (#29): existing stacks need make down -v once, that is docker compose down -v (run it as make down-volumes: plain make down -v is make's own version flag). The Postgres roles come from an init script that runs only on a fresh volume, and .env needs the new keys (DB_OWNER_PASSWORD, DB_API_PASSWORD, DB_INGESTOR_PASSWORD, AMQP_API_PASSWORD, AMQP_INGESTOR_PASSWORD). Once:

make down-volumes     # docker compose down -v: drops the local database volume (works with an old .env)
rm .env && make env   # new secrets for every key; or add the new keys to .env with your own random values
make up

Use the simulator from Claude Code

The repo's .mcp.json registers the skyhaul-sim MCP server (services/mcp_sim/, stdio). It holds only ${VAR} references; the server reads its secrets from the environment Claude Code starts in, and never reads .env.

  1. make env once, then make sim (RabbitMQ and the simulator with its control API on 127.0.0.1:8100). Add SIM_DEBUG_TAP=1 to .env to also watch telemetry in the RabbitMQ management UI (queue debug.telemetry).
  2. Start Claude Code in the repo with only the three variables the server needs:
    export $(grep -E '^(SIM_CONTROL_TOKEN|RABBITMQ_USER|RABBITMQ_PASSWORD)=' .env | xargs) && claude
    Don't source all of .env (or use a direnv dotenv): that would also export ANTHROPIC_API_KEY, which Claude Code itself may use instead of your own login. Optional: SIM_CONTROL_URL, RABBITMQ_HOST, RABBITMQ_PORT (defaults http://127.0.0.1:8100, 127.0.0.1, 5672).
  3. Approve the project server, and check /mcp lists skyhaul-sim. Without the variables the server still starts, and every tool answers "not configured: set ...".
  4. Try: "Spawn 5 drones in dev. ARM dev-d001, take it off to 20 m, send it with GOTO to 32.001, 34.8 at 20 m, then read its POSITION telemetry for 10 seconds."

Tools: spawn_drones, list_drones, get_drone, inject_fault, clear_faults, reset_namespace (control API), and send_command, read_telemetry (RabbitMQ, through the Codec, like a ground station). See ADR 0007.

How it's built

Development uses a team of Claude Code subagents defined in .claude/agents/ (product, architect, backend, frontend, automation, QA and security) and project skills in .claude/skills/, such as the rules for end-to-end tests, component tests and choosing a test layer. A human approves the work and merges every PR. See CLAUDE.md for the workflow and docs/adr/ for design decisions.

License

MIT

About

Drone delivery ops platform: Flask, Vue 3 + TS, RabbitMQ, a multithreaded drone simulator, pytest + Playwright automation, and Claude-powered copilot and test triage

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages