Skip to content

Make recording history reachable from the lobby - #782

Open
ZuoTso wants to merge 1 commit into
sysprog21:mainfrom
ZuoTso:fix/773-recording-navigation
Open

ZuoTso wants to merge 1 commit into
sysprog21:mainfrom
ZuoTso:fix/773-recording-navigation

Conversation

@ZuoTso

@ZuoTso ZuoTso commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Expose recordingAvailable in /api/session based on the active recorder.
  • Show Your recordings beside Interview progress only when the session confirms availability, without waiting for saved reports.
  • Add Back to lobby navigation to Replay.
  • Preserve existing recording authorization, consent, and retention behavior.

Tests

  • Browser tests: 3,661 passed, 0 failed.
  • Rust web tests: 231 passed, 0 failed, 2 ignored.
  • ./scripts/test.sh rust passed.
  • Full gate remains blocked by an existing ShellCheck SC2319 warning in scripts/git-post-commit.sh.

Screenshots captured from the actual CodeTrial UI using Playwright with mocked session data.

螢幕擷取畫面 2026-11-23 234355 螢幕擷取畫面 2026-11-23 234415

Close #773


Summary by cubic

Makes recording history reachable from the lobby and adds a return path from Replay, so recordings aren't buried behind saved-report loading or a direct URL visit. Closes #773.

  • /api/session reports recordingAvailable only for signed-in sessions with an active recorder and a verified email; the signed-out response omits the field.
  • The lobby shows Your recordings next to Interview progress as soon as the session confirms availability, without waiting for saved reports, and hides it again on sign-out or session loss.
  • The link is inert while report deletion or sign-out is pending, so users can't navigate mid-operation.
  • Replay now has a Back to lobby link, reachable by click or keyboard even when opened directly.
  • Existing recording authorization, consent, and 24-hour retention behavior is unchanged.

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

jserv

This comment was marked as outdated.

@yunhsuan0510 yunhsuan0510 left a comment

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.

Reviewed PR #782 at 2e0cca4. git diff --check upstream/main...HEAD passed. node --test tests/browser/lobby.test.js tests/browser/history.test.js: 9 passed, 367 skipped because Playwright Chromium is unavailable. cargo test --test web session_reports_recording_availability_for_signed_in_accounts -- --exact --nocapture could not execute the httparse build script; Windows App Control blocked it (OS error 4551).

Comment thread src/web/auth.rs Resolved
Comment thread tests/web/routes.rs Resolved

@yunhsuan0510 yunhsuan0510 left a comment

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.

Additional verified finding on the current PR head. The relevant route test could not execute here: cargo test --test web task_mode_opens_the_default_task_at_the_home_address_for_a_guest -- --exact --nocapture was blocked when Windows App Control prevented the httparse build script (OS error 4551). The route implementation and that test explicitly define the redirect behavior cited in the inline comment.

Comment thread web/replay.html Resolved
@jserv

jserv commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Add screenshots to the pull request description to illustrate your work, as @ColtenOuO suggests. Example: #349

@Jonathas2127 Jonathas2127 left a comment

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.

Reviewed 2e0cca4 against #773. On WSL with Node 22.22.1 and Playwright 1.65.0, git diff --check HEAD^ HEAD passed and node --test --test-name-pattern='recording history|replay can return' tests/browser/lobby.test.js reported 5 passed and 0 skipped.

Two additional Chromium checks passed: both history actions fit at 320 px and were reachable in the expected Tab order, and successful session rechecks for the same account changed the link from visible to hidden and back to visible. The Rust integration tests were blocked during the WebRTC build because clang++ was unavailable.

Comment thread tests/browser/lobby.test.js Resolved
Comment thread tests/browser/lobby.test.js Resolved
@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from 2e0cca4 to ccfcc9e Compare November 20, 2026 12:49
jserv

This comment was marked as outdated.

@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from ccfcc9e to d1af6ad Compare November 20, 2026 19:48
@jserv
jserv dismissed their stale review November 20, 2026 19:50

No merge conflicts at the current head.

Comment thread web/app.js
renderSequelSuggestion();
hideRecentPerformance();
nodes.historyHeader.hidden = false;
nodes.deleteReports.hidden = false;

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.

Delete saved reports now starts hidden in web/index.html, so this line is the only thing that brings it back when /api/reports fails on a fresh load, and no test fails if it is dropped: the error-path tests check the progress message, never the button. The new case recording history opens while saved reports are still loading already reloads the lobby with /api/reports failing and checks only the link there; asserting deleteReports.isVisible() beside that check would pin this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f0bf3858. Extended the existing test to assert that Delete saved reports becomes visible after the /api/reports failure is handled.

@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from d1af6ad to f0bf385 Compare November 22, 2026 11:28
jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as outdated.

@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from f0bf385 to 3297995 Compare November 23, 2026 14:49
@jserv
jserv dismissed their stale review November 23, 2026 14:58

No merge conflicts at the current head.

@ZuoTso
ZuoTso requested a review from jserv November 24, 2026 02:57
// Keep focus on the link until the sign-out handler disables it.
await page.locator("#logout").evaluate((button) => button.click());
assert.equal((await requested).method(), "POST");
assert.equal(await link.getAttribute("inert"), "");

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.

Nothing in the suite fails if nodes.logout.disabled = logoutPending; is dropped from syncLobbyControls: the if (logoutPending) return guard still stops a second request, so every assertion in this test holds while Sign out stays clickable for the whole held request. Before this change the click handler disabled the button itself, and no test in tests/browser/ checks it either way. Asserting it beside the inert check pins the move:

Suggested change
assert.equal(await link.getAttribute("inert"), "");
assert.equal(await link.getAttribute("inert"), "");
assert.equal(await page.locator("#logout").isDisabled(), true);

jserv

This comment was marked as resolved.

Comment thread web/app.js
nodes.sequelSuggestionPick.disabled =
!historyReady || starting || accountBusy || deletingReports;
nodes.siblingSuggestionPick.disabled = nodes.sequelSuggestionPick.disabled;
nodes.logout.disabled = logoutPending;

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.

While /api/logout is pending, the new logoutPending flag makes Your recordings inert but leaves Start interview and Delete saved reports enabled because accountUpdatePending() does not check it; holding the logout response in Chromium reproduced both enabled controls.

These account-dependent actions can race session invalidation. Include logoutPending in the shared account-busy guard and cover the held-logout state with a browser regression test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Coordinating all account-dependent actions during sign-out is beyond the intended scope of #773. I'd prefer to keep this PR focused on recording history navigation. Could you open a separate issue to track this?

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 flag is introduced by this pull request and applied to one control only, so a held sign-out leaves Start interview and Delete saved reports live while Your recordings is already locked. Please add logoutPending to accountUpdatePending() so the account-busy guard covers it, and add a browser test that holds the /api/logout response and checks that Start and Delete are disabled. Since reportDeletesBlocked() reads the same guard, the row delete buttons follow without another change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added logoutPending to accountUpdatePending(). Browser tests verify that Start interview, bulk deletion, and individual report deletion are disabled while /api/logout is pending.

If the logout request never settles, these controls remain disabled. As agreed, timeout and recovery handling are deferred to #864.

Comment thread web/app.js Resolved
@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from 3297995 to f2b2249 Compare November 24, 2026 18:20
@ZuoTso
ZuoTso requested a review from jserv November 25, 2026 09:32
Comment thread web/app.js
moveFocusOut(nodes.sessionHeading, nodes.recordingHistory);
nodes.recordingHistory.hidden = true;
}
nodes.historyHeader.hidden = nodes.deleteReports.hidden;

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.

No test fails if this line is dropped. With no saved reports the header exists only to hold Your recordings, so during a held session recheck (a back/forward restore) the link goes hidden while Interview progress stays on screen with no control beside it. The restore test asserts the link is hidden while /api/session is held but never the header, and the other header assertions run after the check has settled and showProgress has rewritten it. Asserting #history-header is hidden beside the link check in restoring the lobby moves focus before hiding the recording history link pins it.

@jserv

jserv commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open.

Addressed at the current head; reply with what changed and resolve:

Checked at f2b2249.

Comment thread web/index.html
<div id="history-header" class="history-header" hidden>
<h2 id="progress-title">Interview progress</h2>
<a
id="recording-history"

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.

.history-header lays out with justify-content: space-between, and the link is now a third child between the title and Delete saved reports. With the button shown the link sits in the middle of the row; with no saved reports the button is hidden and the link jumps to the right edge. It moves every time a report is saved or deleted, and it is closer to the title than to the other action it belongs with.

Pin it beside the button instead, so both actions stay at the end whatever is visible:

#recording-history {
  margin-left: auto;
}

With margin-left: auto the link takes the free space and the button follows it, and with the button hidden the link stays at the right edge as it does now.

@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from f2b2249 to 06af6fe Compare November 26, 2026 08:52
Comment thread tests/browser/lobby.test.js Resolved
await back.waitFor();
assert.equal(await back.getAttribute("href"), "/index.html");
await more.waitFor();
assert.equal(await rows.count(), 20);

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.

Could we also test the error path? Have GET /api/recordings return 500, wait for the error message, then verify that Tab focuses “Back to lobby” and Enter returns to the lobby.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Back to lobby is a native HTML link independent of the recordings API, and the existing test already verifies keyboard navigation. Is there a specific risk that the current tests do not cover?

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

Recording history is undiscoverable even when the server can serve it.
Limit the entry point to signed-in users with an active recorder, so
deployments without recording do not advertise an unavailable feature.
Replay also needs a direct return path when opened independently.

Close sysprog21#773

Change-Id: I95232d7460c76b201727b584f29b9150dc81b0f2
@ZuoTso
ZuoTso force-pushed the fix/773-recording-navigation branch from 06af6fe to 9e001f1 Compare November 26, 2026 10:01
@jserv
jserv dismissed their stale review November 26, 2026 10:07

No merge conflicts at the current head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recording history is not discoverable from the lobby

6 participants