Skip to content

Preserve random draws across interview navigation - #280

Closed
Ericko00o wants to merge 1 commit into
sysprog21:mainfrom
Ericko00o:feat/preserve-random-draw
Closed

Ericko00o wants to merge 1 commit into
sysprog21:mainfrom
Ericko00o:feat/preserve-random-draw

Conversation

@Ericko00o

@Ericko00o Ericko00o commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Preserve an explicit random draw and the candidate's difficulty and duration choices when returning from an unfinished interview through Back, Leave, or Done. Capture the draw ticket and lobby snapshot when Start is pressed so picker changes during an awaited sign-in cannot replace the interview's selection. Reapply the captured choices after native browser form restoration. Clearing a topic filter returns to recommendations while retaining the explicit lobby choices.

Save a tab-local snapshot alongside the draw ticket for fresh lobby entries. Only the latest successfully persisted graded HIRE or NO_HIRE report may end that draw. Beginning a new save invalidates previous completion, so pending, rejected, and failed saves cannot reuse a retained older report. Interview URLs without a ticket cannot claim another draw, and unrelated report deletion or account-history merges retain the selection.

When sessionStorage is unavailable, a ticket-specific same-origin localStorage receipt records the current save outcome and must match the persisted report. Receipts from another tab cannot replace this draw's result. Read-only storage cannot establish a current completion and is treated conservatively. Browser Back uses history state when tab storage is blocked; a fresh lobby entry requires available tab storage to restore the snapshot. If neither completion store is usable, retain the draw instead of inferring success from old history.

Validation: all 237 targeted picker, lobby, draw-completion, and interview-lifecycle tests passed without failures or skips. The login-race and newer-failed-save cases failed before the fixes and passed afterward. Formatting, ESLint, commit-message validation, staged checks, and all 49 Git hooks checks passed. The full browser suite reported 1192 passed, 5 failed, and 3 skipped. The required scripts/test.sh gate was run but did not pass: Cargo was unavailable; wire-fixtures and recording-provision-check-tests encountered existing Windows limitations; the five browser failures were four Windows ESM path cases and one unavailable-server face check. Java and two built-server browser cases were skipped, and cargo-audit, actionlint, ruff, and shellcheck were unavailable.

Rebased onto main at 8394d54. This PR contains one navigation commit and preserves upstream source-display, interview retry settings, and voice controls.

Comment thread web/app.js
@jserv

jserv commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

@Ericko00o #256 merged on 2026-10-11, so the prerequisite this draft waits on is in main. Rebase onto main so only the navigation commit remains, then mark the pull request ready for review as your description plans. It and #285 (Strict mode) both edit web/app.js and web/interview.js, so expect a conflict whichever lands second.

@Ericko00o
Ericko00o force-pushed the feat/preserve-random-draw branch from ff67108 to 3bef5c8 Compare October 13, 2026 03:37
@Ericko00o
Ericko00o marked this pull request as ready for review October 13, 2026 03:38
cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv jserv 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.

Rebase latest main branch and resolve conflicts.

An unfinished interview should retain the draw and lobby choices taken
when Start was pressed, even when sign-in delays navigation. Restore
those choices across Back, Leave, and Done without letting later edits
replace the ticket. Only the latest successfully saved graded report
may end a draw; retained older reports cannot prove completion after a
failed save. Clearing a topic returns to recommendations.
@Ericko00o
Ericko00o force-pushed the feat/preserve-random-draw branch from 3bef5c8 to edecbee Compare October 14, 2026 11:01
@jserv
jserv requested review from ColtenOuO and alanhc October 14, 2026 12:19

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Supporting the case where sessionStorage is unavailable brings in a number of extra problems to solve, and handling them is a large part of why this PR has to change so many places.

That case should also be fairly rare.

Would it be better to simply not keep the draw and fall back to recommendations when sessionStorage is unavailable?

As a design trade-off, I think taking on this much extra code to cover that one case will make the feature harder to maintain.

Comment thread web/random-draw.js
Comment on lines +7 to +24
// Same-origin receipts distinguish the current save from retained older rows.
// Ticket-specific keys keep concurrent tabs from replacing each other's result.
function readSaveOutcome(draw) {
try {
const area = globalThis.localStorage;
const value = area.getItem(outcomeKey(draw));
if (!value) return null;
// Read-only storage cannot prove that a later failure invalidated this row.
area.setItem(outcomeKey(draw), value);
const outcome = JSON.parse(value);
if (outcome.id !== draw.id || outcome.problemId !== draw.problemId)
return null;
outcomeDraw = draw;
return outcome;
} catch {
return null;
}
}

@ColtenOuO ColtenOuO Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

That would also remove the localStorage receipts entirely, along with the cross-tab and read-only checks they need.

@jserv

This comment has been minimized.

1 similar comment
@jserv

jserv commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Rebase latest main and resolve conflicts

@Ericko00o

Ericko00o commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank you, @ColtenOuO. Your point about the maintenance cost helped me reconsider whether this feature is worth adding at all.

Preserving a random draw across interview navigation is a small convenience. Returning to the normal recommendations still leaves the core interview flow usable. Even with the sessionStorage-only approach, the additional state and lifecycle handling seem disproportionate to the benefit.

I have decided to close this PR for now rather than ask the maintainers to spend more time reviewing and maintaining it.. If user feedback later shows a clear need for preserving draws, we can revisit it with a smaller design.

Thanks to you and the other reviewers for the thoughtful feedback and time spent on this PR.

@Ericko00o Ericko00o closed this Oct 19, 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.

3 participants