Skip to content

P2 tiny test server on the mac - #46

Open
RooRoo6080 wants to merge 3 commits into
mainfrom
4-p2-tiny-test-server-on-the-mac
Open

RooRoo6080 wants to merge 3 commits into
mainfrom
4-p2-tiny-test-server-on-the-mac

Conversation

@RooRoo6080

@RooRoo6080 RooRoo6080 commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Implements the lightweight FastAPI WebSocket tone server (Issue #4 / P2) to allow testing iOS
streaming connections from a local Mac.

Key Changes

  • FastAPI WebSocket Server: Added endpoints (/healthz, /v1/session) in handling the full
    session lifecycle (session_start, caption_text, session_error, session_end).
  • Tone Backend Stub: Implemented MockToneBackend in tone.py behind a generic backend interface,
    returning simulated tone tags asynchronously without storing audio or blocking captions.
  • Resilient Connection Handling: Emits structured session_error frames rather than abruptly
    closing the WebSocket connection on unprocessable input.
  • CLI & Logging / Observability: Added a -v/--verbose flag in main.py to stream events to
    stdout and log NDJSON session traces into gitignored logs/.
  • Schema Update: Updated schemas/events.schema.json to v1.1.0 (added session_error),
    updated schema validation tests.
    • May require minor changes in other parts of the project, but I believe this logging will be very helpful in the long run. Version changes, but rest of schema stays the same.
  • Test Suite: Added unit and integration tests covering CLI invocation, WebSocket flows, mock
    tone emissions, error handling, and file logging (server/tests/test_server.py,
    server/tests/test_cli.py, server/tests/test_observability.py).

Tl;dr, to test:

  1. uv run --directory server python -m app, add --verbose if you'd like
  2. Connect to server using Postman, etc: ws://<local-ip-or-localhost>:8000/ws/session?session_id=demo
  3. Sample skeleton message to send:
{
    "type": "tone_request",
    "session_id": "demo",
    "schema_version": "1.1",
    "caption_id": "3f1c2a9e-8b7d-4c6e-9a01-2b3c4d5e6f70",
    "t_start": 1.0,
    "t_end": 1.1,
    "sample_rate": 16000,
    "audio_b64": "AAABAAIA"
}

@RooRoo6080 RooRoo6080 linked an issue Oct 6, 2026 that may be closed by this pull request
@RooRoo6080
RooRoo6080 added this pull request to stack #48 October 6, 2026 07:04
@RooRoo6080 RooRoo6080 changed the title 4 p2 tiny test server on the mac #4 P2 tiny test server on the mac Oct 6, 2026
@RooRoo6080 RooRoo6080 changed the title #4 P2 tiny test server on the mac P2 tiny test server on the mac Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2. Tiny test server on the Mac

1 participant