prefect server in zig

add backend matrix testing reminder + full CI matrix

- CLAUDE.md: add "before pushing new features" section requiring
full backend matrix tests (sqlite/postgres + memory/redis)
- CI: test all backend combinations via Nix packages:
- sqlite + memory broker (via test scripts)
- sqlite + redis broker (native redis-server)
- postgres + memory broker (native postgres via initdb)
- uses postgres and redis from nixpkgs, no Docker needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+91 -1
+81 -1
.tangled/workflows/ci.yml
··· 7 7 dependencies: 8 8 nixpkgs: 9 9 - zig 10 + - curl 11 + - bash 12 + - postgresql 13 + - redis 10 14 11 15 steps: 12 16 - name: check formatting ··· 17 21 command: | 18 22 zig build 19 23 20 - - name: run tests 24 + - name: run unit tests 21 25 command: | 22 26 zig build test --summary all 27 + 28 + - name: test sqlite + memory broker 29 + command: | 30 + ./scripts/test-db-backends sqlite 31 + ./scripts/test-broker-backends memory 32 + 33 + - name: test redis broker 34 + command: | 35 + mkdir -p /tmp/redis 36 + redis-server --daemonize yes --dir /tmp/redis --port 6379 37 + sleep 1 38 + 39 + export PREFECT_BROKER_BACKEND=redis 40 + export PREFECT_REDIS_URL=redis://localhost:6379 41 + 42 + ./zig-out/bin/prefect-server & 43 + SERVER_PID=$! 44 + sleep 2 45 + 46 + # basic smoke test 47 + curl -sf http://localhost:4200/api/health | grep -q ok 48 + curl -sf -X POST http://localhost:4200/api/flows/ \ 49 + -H "Content-Type: application/json" \ 50 + -d '{"name": "ci-redis-test"}' | grep -q id 51 + 52 + kill $SERVER_PID 2>/dev/null || true 53 + redis-cli shutdown nosave 2>/dev/null || true 54 + echo "redis broker test passed" 55 + 56 + - name: test postgres backend 57 + command: | 58 + # init postgres 59 + export PGDATA=/tmp/pgdata 60 + mkdir -p $PGDATA 61 + initdb -D $PGDATA --no-locale --encoding=UTF8 62 + echo "unix_socket_directories = '/tmp'" >> $PGDATA/postgresql.conf 63 + echo "listen_addresses = ''" >> $PGDATA/postgresql.conf 64 + pg_ctl -D $PGDATA -l /tmp/pg.log start 65 + sleep 2 66 + createdb prefect_test 67 + 68 + # run server with postgres 69 + export PREFECT_DATABASE_BACKEND=postgres 70 + export PREFECT_DATABASE_URL="postgresql:///prefect_test?host=/tmp" 71 + 72 + ./zig-out/bin/prefect-server & 73 + SERVER_PID=$! 74 + sleep 3 75 + 76 + # api tests 77 + curl -sf http://localhost:4200/api/health | grep -q ok 78 + echo "health check passed" 79 + 80 + FLOW=$(curl -sf -X POST http://localhost:4200/api/flows/ \ 81 + -H "Content-Type: application/json" \ 82 + -d '{"name": "ci-postgres-test"}') 83 + echo "$FLOW" | grep -q id 84 + FLOW_ID=$(echo "$FLOW" | grep -o '"id":"[^"]*"' | cut -d'"' -f4) 85 + echo "flow creation passed: $FLOW_ID" 86 + 87 + RUN=$(curl -sf -X POST http://localhost:4200/api/flow_runs/ \ 88 + -H "Content-Type: application/json" \ 89 + -d "{\"flow_id\": \"$FLOW_ID\", \"name\": \"ci-run\"}") 90 + echo "$RUN" | grep -q id 91 + RUN_ID=$(echo "$RUN" | grep -o '"id":"[^"]*"' | head -1 | cut -d'"' -f4) 92 + echo "flow run creation passed: $RUN_ID" 93 + 94 + # state transition 95 + curl -sf -X POST "http://localhost:4200/api/flow_runs/$RUN_ID/set_state" \ 96 + -H "Content-Type: application/json" \ 97 + -d '{"state": {"type": "RUNNING", "name": "Running"}}' | grep -q RUNNING 98 + echo "state transition passed" 99 + 100 + kill $SERVER_PID 2>/dev/null || true 101 + pg_ctl -D $PGDATA stop 2>/dev/null || true 102 + echo "postgres backend test passed"
+10
CLAUDE.md
··· 21 21 - `scripts/test-api-sequence` - functional tests (correctness) 22 22 - `scripts/benchmark` - performance benchmark (throughput, latency, memory) 23 23 24 + ### before pushing new features 25 + 26 + **always run the full backend matrix:** 27 + ```bash 28 + ./scripts/test-db-backends all # sqlite + postgres 29 + ./scripts/test-broker-backends all # memory + redis (needs: just services-up) 30 + ``` 31 + 32 + this catches integration issues that unit tests miss. 33 + 24 34 ## env vars 25 35 26 36 - `PREFECT_SERVER_LOGGING_LEVEL`: DEBUG, INFO, WARNING, ERROR