Clear candidate test cases on interview end
Candidate test cases entered during an interview persisted in sessionStorage across same-tab navigations and reappeared when starting a new interview for the same problem, with the rest of the detail in #336.
The cleanup runs writeStored(candidateCaseStorageKey, "", tabStorage) during endInterview teardown, which web/audio-output.js already implements by removing the key when given an empty value. Clearing during endInterview places the reset at the formal session boundary alongside replay flushing and timer cancellation; leaveRoom is left untouched, which avoids adding undeclared bindings to the synthetic function scope tests/browser/interview-lifecycle.test.js constructs.
The existing tests in tests/browser/candidate-cases.test.js cover parsing, cap enforcement, removal, and persistence across reload within an ongoing interview, but none tested ending an interview and checking session isolation. The new test "ending an interview clears candidate cases from session storage" adds a case, verifies it in sessionStorage, clicks #end to trigger endInterview, and asserts the key becomes null. Run against the parent commit, the test times out waiting for sessionStorage to clear.
Local verification ran ./scripts/test.sh on Windows, where 904 of 1176 tests passed. The 8 failures are known environment limitations: 4 in tests/browser/dom-contract.test.js from Windows drive-letter paths in dynamic import() (#322 / #323), and 4 in tests/browser/compiler-explorer.test.js from local MinGW g++ rejecting -std=c++20. Skipped lanes (including Playwright Chromium tests) are left for Linux CI to confirm. Manual testing in a running CodeTrial instance confirmed that custom test cases are purged upon ending an interview and do not bleed into subsequent sessions.
Closes #336
Summary by cubic
Clears candidate test cases at every interview boundary so custom cases from one session no longer reappear when a candidate starts a new interview for the same problem in the same tab. Closes #336.
- Resets stored and in-memory cases on
endInterview,renderReport, and on a fresh interview load; a page reload preserves cases mid-interview. - Consolidates teardown into a
clearCandidateCaseshelper that also clears the DOM list and marks the case status as ended. - Refuses case additions after the interview leaves the live phase.
- Adds tests for both clear paths, add refusals after the interview ends, post-session isolation, and reload preservation.