Remove interview endpoints nothing calls

RW
2m ago
+177-331

Problem and behavior

#582 asked for a review of the API endpoints and the removal of any that serve no purpose. Three have no caller outside their own tests:

EndpointCallersWhat still covers it
GET /api/interviews/{id}/snapshotnone; added for a late-joining reader that was never writtenGET /api/recordings/{id}/events and the template's GET /api/recording/replay serve the same replay_snapshot
POST /api/interviews/{id}/endnone; meant for the browser on unload, never sent by any pagethe room_finished webhook and the egress_ended that carries the file, which also covers a lost room_finished; a lost egress_ended leaves the row to the sweeper
POST /api/peer/sessions/{id}/terminatenone; no page offers itcancel ends a session early; the hard deadline still ends one as finalizing

After this change the two interview paths fall through to the static fallback, as any unknown /api/ path already does, and terminate is refused as invalid_action like any unknown peer action. The one read lost is the replay of an interview whose recording never started, which nothing requested.

Every other endpoint has a caller:

  • Pages and scripts: token, token/release, task-sets (unlock, task, attempts), task-reviews, observer-token, login (GET link, POST form), session, github device and poll, logout, update, interviews, consent, recording (GET and POST), events, recordings (list, detail, events), reports (GET, POST, both DELETEs), setup and setup/offer, runtime-config.js.
  • Outside services: /api/callback (GitHub OAuth redirect) and /api/recording/webhook (LiveKit).
  • /healthz has only test callers. It stays: only the full app answers it, the setup server does not, and a deployment's health check would use it.
  • /api/peer/*: every other sub-route and action is called from web/peer-*.js.

Approach

Delete the handlers, their route entries, their tests and the contract text that described them. replay_snapshot and finish_recording stay because the other routes and the webhook use them. terminate was an action in the shared peer action table, so it leaves the version-check list and the cancel arm; the finalizing lists stay because the hard-deadline path still writes that status.

The removed snapshot test was the only one reaching the expired, deleted and quota answers of the shared replay_response. The expired 410 now has a test on the template route. The deleted 410 is reachable only when a deletion lands between the history route's check and its read, so it and the quotaExceeded field get unit tests on replay_response in tests/unit/web.rs. The settlement test asserts that terminate is refused, the advice test in tests/web/peer_artifacts.rs ends its session by cancel, and the peer docs name cancel.

Validation

./scripts/test.sh rust on this head, in a Linux arm64 container, passed. It skipped cargo-deny (not installed) and three browser tests (no Playwright browser in the container).

Each new test fails against the mutation it pins and passes otherwise: the deleted 410 answered as a missing replay, quotaExceeded inverted or forced false, terminate added back to the cancel arm, and cancel writing finalizing.

./scripts/test.sh browser on macOS, on the head before the terminate removal (which touches no browser code): 3555 passed, 33 skipped, 2 failed, neither touched by this diff. media-probe fails the same way on main here (receiver-stats-unavailable), and the strict-selection cached-attempt test passed three of three runs alone.

Not run: cargo-deny.


Summary by cubic

Removes the three API endpoints nothing calls, so unknown /api/ paths uniformly fall through to the static fallback.

  • GET /api/interviews/{id}/snapshot was added for a late-joining reader that was never written; the same read stays on GET /api/recordings/{id}/events and the template's replay read.
  • POST /api/interviews/{id}/end was meant for browser unload but no page sends it; recordings still end via the room_finished webhook, then egress_ended, then the sweeper.
  • The terminate peer session action was never offered by any page; cancel remains and still closes the session, and the hard-deadline path still writes finalizing.

The only read lost is the replay of an interview whose recording never started, which nothing requested. The removed snapshot test was the only coverage of the expired, deleted, and quota-exceeded replay answers; expired coverage moves to the template route, deleted and quota-exceeded get unit tests on replay_response, and the settlement test now asserts terminate is refused as an invalid action. Refs #582.