Files
whisper_web/tests/server-engine.md
T

52 lines
2.2 KiB
Markdown

# Manual verification: server engine (M5, D-013)
The dev environment has no Python package manager and no browser, so — like
`tests/offline.md` and `tests/live.md` — the real-inference path needs a
manual run on a machine with Python ≥ 3.9. Everything protocol- and
HTTP-level is already covered by `bun test` (`tests/transcribe.test.ts`
exercises the real `Bun.spawn` supervisor against
`tests/fixtures/fake_sidecar.py`, plus the degradation paths against the real
`server-py/sidecar.py`).
## 1. Install the sidecar dependencies
```sh
python3 -m pip install -r server-py/requirements.txt
```
## 2. Opt-in automated pass (no browser needed)
```sh
FW_INTEGRATION=1 bun test tests/transcribe.test.ts
```
Runs the real sidecar end to end (spawn → ready handshake → `tiny.en` load →
transcribe → done). First run downloads ~75 MB of weights from the Hub.
- [ ] The `real faster-whisper sidecar` describe block passes.
## 3. In-browser run (both engines, same audio)
1. `bun run dev`, open the app, register/sign in.
2. `GET /api/transcribe/status` (with the session cookie) returns
`{"available": true}` — e.g. check the Network tab.
3. Pick `Whisper Tiny (English)`; transcribe a short clean English clip
(e.g. the JFK "ask not…" sample) **on device**. Note the transcript.
4. Switch the engine toggle to **Server** (visible only while signed in;
requires the M5 UI wiring — until that lands, drive it manually:
`curl -X POST --data-binary @audio.f32 -b "sid=…" \
"http://localhost:3000/api/transcribe?model=onnx-community/whisper-tiny.en"`
where `audio.f32` is raw float32 mono 16 kHz PCM).
5. Transcribe the same clip through the server engine.
- [ ] Segments stream in as JSON lines (not one blob at the end).
- [ ] Both transcripts agree in content (minor punctuation/casing drift
between Transformers.js and faster-whisper is expected).
- [ ] Signed out, the toggle is gone and `POST /api/transcribe` answers 401.
- [ ] Second request on the same model is visibly faster (no reload —
warm-up strategy).
- [ ] `AUTH_ENABLED=false bun run dev`: `/api/transcribe*` answers 404 and
the anonymous browser flow is unaffected.
When this passes, check off the M5 integration item in `WorkBreakdown.md`.