Skip to content

Remove two interview routes nothing calls - #787

Open
RWong04 wants to merge 1 commit into
sysprog21:mainfrom
RWong04:remove-unused-interview-routes
Open

RWong04 wants to merge 1 commit into
sysprog21:mainfrom
RWong04:remove-unused-interview-routes

Conversation

@RWong04

@RWong04 RWong04 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem and behavior

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

Endpoint Callers What still covers it
GET /api/interviews/{id}/snapshot none; added for a late-joining reader that was never written GET /api/recordings/{id}/events and the template's GET /api/recording/replay serve the same replay_snapshot
POST /api/interviews/{id}/end none; meant for the browser on unload, never sent by any page the 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

After this change both paths fall through to the static fallback, as any
unknown /api/ path already does. 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 sub-route is called from web/peer-*.js except
    POST /api/peer/sessions/{id}/terminate. It ends a running session and keeps
    what was finished, and no page offers that yet. I kept it; should it go too,
    or is a page for it planned?

Approach

Delete both 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.

The removed snapshot test was the only one reaching three 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 contract keeps the body shape
and its Ending section names both webhooks.

Validation

./scripts/test.sh rust on this head, in a Linux arm64 container, passed:

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
skipping cargo-deny: `cargo install cargo-deny` checks dependency licenses and sources

The deleted-410 and quotaExceeded mutations of replay_response each fail
the new unit tests, and pass every other suite.

./scripts/test.sh browser on macOS: 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 two interview API routes 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 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, and deleted plus quota-exceeded get unit tests on replay_response. Refs #582.

Written for commit 51f0b76. Summary will update on new commits.

View guided diff

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

@RWong04
RWong04 force-pushed the remove-unused-interview-routes branch from c1d3a61 to 36dad77 Compare November 19, 2026 16:26
jserv

This comment was marked as resolved.

GET /api/interviews/{id}/snapshot and POST /api/interviews/{id}/end have
no caller outside their own tests; web/, desktop/ and the scripts never
request either. The snapshot route was added for a late-joining reader
that was never written. The same read is still served by
GET /api/recordings/{id}/events and the template's replay read, so the
only thing lost is reading the replay of an interview whose recording
never started, which nothing did. The end route was meant to be sent by
the browser on unload, but no page ever sent it, so a recording ends on
the room_finished webhook and the egress_ended that carries its file,
which also covers a lost room_finished; a lost egress_ended leaves the
row to the sweeper.

Delete both handlers, their route entries, their tests and the contract
text that described them. The snapshot section keeps its reasoning and
the body shape both remaining routes answer with, and Ending names the
two webhooks. replay_snapshot and finish_recording stay, because the
other routes and the webhook still use them.

The removed snapshot test was the only one that reached three answers
of the shared replay response. The expired answer gets a test on the
template route. The deleted answer is reached only by a deletion that
lands between the history route's check and its read, and quotaExceeded
in the body was asserted nowhere else, so both get a unit test on
replay_response itself.

Change-Id: Ic1b1b82e19cb28707bf75310a5a05e01e3321cc5
@RWong04
RWong04 force-pushed the remove-unused-interview-routes branch from 36dad77 to 51f0b76 Compare November 19, 2026 17:14
Comment thread src/web/mod.rs
Comment on lines +1097 to +1110
/// One answer for every replay read, so the two routes that take one cannot
/// drift apart.
///
/// They differ in two things and this takes both: what "no such replay" means
/// to the caller, which is a recording id to one route and a room to another,
/// and the sentence a read error is logged under. Everything else was written
/// out three times, including the two `410` bodies, and those are the retention
/// promise: a copy that said something slightly different would be a third
/// out twice, including the two `410` bodies, and those are the retention
/// promise: a copy that said something slightly different would be a second
/// answer to a question the product gives one answer to. `gone_response` below
/// exists for the same reason on the route ahead of this one.
///
/// A function pointer rather than a closure, because none of the three captures
/// A function pointer rather than a closure, because neither route captures
/// anything: what a route answers here is a constant, and a signature that
/// allowed a captured one would be inviting a fourth thing to differ.
/// allowed a captured one would be inviting a third thing to differ.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Everything else was written out three times" was history and stayed true when the snapshot route went (d446fa1e folded three copies), so "twice" makes it false. The present-tense counts ("the two routes", "neither route", "a third thing") are the shape docs/development.md (Comments that count things) warns about, and this PR is where the last one went stale; naming the routes keeps the comment true, and the new comment in replay_view ("Both routes that read a replay") can name them the same way.

Suggested change
/// One answer for every replay read, so the two routes that take one cannot
/// drift apart.
///
/// They differ in two things and this takes both: what "no such replay" means
/// to the caller, which is a recording id to one route and a room to another,
/// and the sentence a read error is logged under. Everything else was written
/// out three times, including the two `410` bodies, and those are the retention
/// promise: a copy that said something slightly different would be a third
/// out twice, including the two `410` bodies, and those are the retention
/// promise: a copy that said something slightly different would be a second
/// answer to a question the product gives one answer to. `gone_response` below
/// exists for the same reason on the route ahead of this one.
///
/// A function pointer rather than a closure, because none of the three captures
/// A function pointer rather than a closure, because neither route captures
/// anything: what a route answers here is a constant, and a signature that
/// allowed a captured one would be inviting a fourth thing to differ.
/// allowed a captured one would be inviting a third thing to differ.
/// One answer for every replay read, so the history events route and the
/// template's replay read cannot drift apart.
///
/// They differ in two things and this takes both: what "no such replay" means
/// to the caller, which is a recording id to one route and a room to another,
/// and the sentence a read error is logged under. Everything else was written
/// out three times before the fold, including the two `410` bodies, and those
/// are the retention promise: a copy that said something slightly different
/// would be a second answer to a question the product gives one answer to.
/// `gone_response` below exists for the same reason on the route ahead of this
/// one.
///
/// A function pointer rather than a closure, because no route captures
/// anything: what a route answers here is a constant, and a signature that
/// allowed a captured one would be inviting another thing to differ.

Comment on lines +755 to +756
The history route and the template's replay read below are the two routes that
serve it, both answering `{"seq", "quotaExceeded", "events": [...]}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The history route" has no single referent here: The history routes section below lists three, and only GET /api/recordings/{id}/events answers this body (GET /api/recordings/{id} answers a recording's state). Naming the route also drops the count, which goes stale the next time a reader is added or removed.

Suggested change
The history route and the template's replay read below are the two routes that
serve it, both answering `{"seq", "quotaExceeded", "events": [...]}`;
`GET /api/recordings/{id}/events` and the template's replay read, both below,
serve it, answering `{"seq", "quotaExceeded", "events": [...]}`;

@jserv

jserv commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Remove POST /api/peer/sessions/{id}/terminate in this pull request too, and check these against it, since it is an action in the shared peer::action table and not a route of its own:

  • src/accounts/peer/rounds.rs: drop "terminate" from the version-check list and from the "cancel" | "terminate" arm, which then only handles "cancel" and no longer needs the if action == "cancel" branch. An unknown action must be refused like any other, so add one assertion that terminate is.
  • finalizing stays: the hard-deadline path in src/accounts/peer.rs still writes it, so retention.rs, discovery.rs and src/web/peer/sweeper.rs keep their finalizing lists unchanged.
  • tests/unit/accounts/peer_settlement.rs: remove "terminate" from the loop in ending_a_session_preserves_sealed_rounds_and_seals_unfinished_ones, and drop or rewrite cancel_and_terminate_close_the_session_differently, since there is no second ending left to compare. The deadline case covers finalizing.
  • tests/web/peer_artifacts.rs: the advice test ends the session through terminate. Switch it to cancel and confirm the visibility assertions still hold for a cancelled row, or end it by the deadline if they do not.
  • docs/peer-interviews.md: "terminate the session to stop the interview" in the artifacts section should say cancel, and the manual checklist item "Terminate an active session and confirm LiveKit room deletion" should say cancel.
  • docs/recording-contract.md: "session termination stops the interview" in the peer section should name cancel the same way.

Then update the description: the open question is answered, and terminate joins the table of removed endpoints with "none; no page offers it" as its caller entry. After that run grep -rn "terminate" docs src tests web and confirm what is left is unrelated (unterminated, TLS termination).

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.

2 participants