Let candidates save named session setups
Problem and behavior
Candidates who switch between practice formats currently have to reconfigure
the lobby each time because CodeTrial preserves only the most recently used
settings.
This change lets candidates save multiple browser-local session setups under
different names. Selecting a saved setup immediately restores its session
length, interview format, and editor options without changing the selected
problem, difficulty filters, or optional interview context.
Candidates can also update an existing setup by saving under the same name and
delete setups they no longer need. Saved setups remain available after
reloading the lobby.
Approach
Store all named setups as individual records under one local storage key.
The implementation reuses selectedEditorOptions and saveEditorOptions
instead of maintaining a separate editor-option list. Missing fields are left
unchanged when applying an older setup, while fields unknown to the current
version are preserved when records are rewritten.
Save and delete operations re-read storage inside a Web Lock so simultaneous
changes from different lobby tabs do not overwrite each other.
At the time this pull request was opened, #584 and #590 were still open and
were therefore not included. If a saved setup does not contain a control added
later, applying it keeps that control's current value.
Screenshots
Lobby
Save setups
Select setups
Validation
- Ran
node --test tests/browser/lobby.test.js: 281 tests passed. - Verified saving, selecting, updating, deleting, and reloading named setups.
- Verified simultaneous saves from two tabs preserve both records.
- Verified malformed and unavailable browser storage does not prevent the
lobby from working. - Verified older setups retain current values for missing controls and preserve
fields added by newer versions. - Verified a saved duration remains valid when the server recording limit is
below the offered durations. - Ran ESLint, Prettier, and
git diff --check. - Completed the required interactive review for this large change.
- Did not exercise a live interview or external AI provider.
Close #591
Summary by cubic
Lets candidates save named session setups in their browser and restore them later, instead of reconfiguring session length, interview format, and editor options each time.
- Updating a setup replaces its settings; deleting it removes it from the browser.
- Applying a setup leaves the selected problem, difficulty filters, and optional interview context unchanged.
- Older setups keep current values for settings they don't include, and changes from other lobby tabs are preserved.