Skip to content

Remove interview endpoints 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. Three 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
POST /api/peer/sessions/{id}/terminate none; no page offers it cancel 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.

Written for commit de0e1e2. 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.

@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 Resolved
Comment thread docs/recording-contract.md Resolved
@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).

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.

POST /api/peer/sessions/{id}/terminate has no caller either: no page
offers it. It is an action in the shared peer action table rather than
a route, so it leaves the version-check list and the cancel arm, which
now only cancels. The hard-deadline path still writes finalizing, so the
finalizing lists elsewhere stay as they are.

Delete the handlers, their route entries, their tests and the contract
text that described them. The snapshot section keeps its reasoning and
the body shape the history events route and the template's replay read
answer with, and Ending names the webhooks. replay_snapshot and
finish_recording stay, because the other routes and the webhook still
use them. The peer docs and the advice test end a session by cancel.

The removed snapshot test was the only one that reached the expired,
deleted and quota 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. The settlement test asserts
that terminate is refused like any unknown action.

Change-Id: I4edfd4efba497059ca77c4b4e342c6a4b13a883c
@RWong04
RWong04 force-pushed the remove-unused-interview-routes branch from 51f0b76 to de0e1e2 Compare November 20, 2026 01:37
@RWong04 RWong04 changed the title Remove two interview routes nothing calls Remove interview endpoints nothing calls Nov 20, 2026
@RWong04

RWong04 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Removed in de0e1e2. terminate is refused as invalid_action with the version unchanged (cancel_closes_the_session_and_terminate_is_no_longer_an_action), the advice test ends by cancel and its assertions hold, and the peer docs and the recording contract say cancel. finalizing and its lists stay for the hard deadline. The description lists terminate as removed. The grep leaves only unrelated hits; I also renamed a_terminated_session_and_its_paired_lobby_entry_are_pruned to a_finalizing_session_…, since it sets finalizing directly.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 8 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/web/mod.rs">

<violation number="1" location="src/web/mod.rs:1106">
P3: This doc comment says `gone_response` is "below", but it is defined in `src/web/recordings/mod.rs`, not later in this file. Name the module so the reference resolves, e.g. "`recordings::gone_response`".</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

View guided diff | Re-trigger cubic

Comment thread src/web/mod.rs
/// 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This doc comment says gone_response is "below", but it is defined in src/web/recordings/mod.rs, not later in this file. Name the module so the reference resolves, e.g. "recordings::gone_response".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/web/mod.rs, line 1106:

<comment>This doc comment says `gone_response` is "below", but it is defined in `src/web/recordings/mod.rs`, not later in this file. Name the module so the reference resolves, e.g. "`recordings::gone_response`".</comment>

<file context>
@@ -1094,20 +1094,21 @@ fn forwarded_client(headers: &header::HeaderMap, peer: SocketAddr, hops: u32) ->
+/// 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.
 ///
</file context>
Suggested change
/// `gone_response` below exists for the same reason on the route ahead of this
/// `recordings::gone_response` exists for the same reason on the route ahead of this

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