# Fake gateway pattern (client-repo `QA/fake_gateway.py`) ## Design - stdlib `http.server` only; bind `127.0.0.1`; `--port` default e.g. ``; exit 1 if the port is one of the real ports (``, ``). - Auth like the real dashboard: accept `Authorization: Bearer ` OR `X-Hermes-Session-Token: `, else 401. Fake token constant (e.g. `fake-qa-token`); `GET /` serves an SPA shell embedding it the same way the real dashboard does (`__HERMES_SESSION_TOKEN__="..."`), so the app's token discovery path is exercised. - `/api/status` without auth; minimal `/api/ws` JSON-RPC if the app connects on start. - Response shapes copied from the isolated real dashboard (keep unknown extra keys too, so client parsing is tested for tolerance). Validation errors mirror real codes (empty body → 400, unknown id/board → 404). - `-- demo|empty|error|missing|slow`: demo = rich fake data; empty = one empty board; error = 500; missing = 404 (plugin not installed); slow = delayed responses (loading state). - Out-of-MVP endpoints return 404 so the client can't silently depend on them. - Don't log request bodies. Use a fixed argparse description string (not `__doc__.splitlines()[0]`). ## Smoke-test script skeleton (`QA/test_fake_gateway_.sh`) ```bash set -u; cd "$(dirname "$0")/.." fail=0 check(){ [ "$2" = "$3" ] && echo "OK $1" || { echo "FAIL $1: beklenen=$3 gelen=$2"; fail=1; }; } start(){ python3 QA/fake_gateway.py --port $PORT --kanban "$1" >"${TMPDIR:-/tmp}/fgw-$1.log" 2>&1 & PID=$!; sleep 1.5; } stop(){ kill $PID 2>/dev/null; wait $PID 2>/dev/null; } code(){ curl -s -o /dev/null -w "%{http_code}" "$@"; } # checks: no-auth 401, both auth headers 200, counts per board/column, empty board 0, # unknown 404, POST comment 200 then count+1 (Turkish chars), blank POST 400, out-of-scope 404, # each mode's status code, real-port refusal exit 1 [ $fail = 0 ] && echo "TÜM KONTROLLER GEÇTİ" || exit 1 ``` ## Emulator wiring `adb reverse tcp: tcp:` then point the app at `http://127.0.0.1:`. List AVDs with `~/Library/Android/sdk/emulator/emulator -list-avds`; `adb devices` for running ones.