Skip to content

Let candidates save named session setups - #597

Open
domin67 wants to merge 1 commit into
sysprog21:mainfrom
domin67:session-presets
Open

domin67 wants to merge 1 commit into
sysprog21:mainfrom
domin67:session-presets

Conversation

@domin67

@domin67 domin67 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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

Screenshot 2026-11-06 193152

Save setups

Screenshot 2026-11-06 193235

Select setups

Screenshot 2026-11-06 193308

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 saves from other lobby tabs are merged via Web Locks without overwriting each other.
  • Unavailable or malformed browser storage and a server length cap below the offered durations are handled without breaking the lobby.

Written for commit 655afd9. 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 resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

@jserv

jserv commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

@jserv

jserv commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

The interactive-review check changed in #610: the explained label no longer passes it, and this pull request is over the large-change thresholds, so its next run needs a signed record of the interactive review.

  1. Once: set up a signing key, as "Before your first large change" in CONTRIBUTING.md lists.
  2. Rebase this branch onto main; the pre-push hook that signs and sends the record is there.
  3. Run /codetrial-review on the branch and push. If the branch did not change, send the record with sh scripts/git-pre-push.sh --publish-review <fork-remote> [<branch>], then close and reopen this pull request.

Each refusal and its fix: https://github.com/sysprog21/codetrial/blob/main/docs/large-change-explanation.md#troubleshooting

@jserv jserv removed the explained label Nov 7, 2026
jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

Comment thread web/styles.css Outdated
}

.session-panel .setup-heading > div {
padding-right: 4.5rem;

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.

This padding is what fails the two one-screen lobby tests in gates (browser 1/3) (body height 811 against 800): at 1280x800 the session column is 373px wide, so it wraps "Set up your session" onto a second line, and the taller heading grows the whole setup row and pushes the footer off screen. Dropping it alone restores 800, but then the title runs under the "Saved setups" button, which is 133px wide, so 72px of padding never cleared it anyway. Move the trigger out of the heading row to a place that takes no new line at this width, for example beside the Session length label.

@domin67 domin67 Nov 17, 2026 •

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.

現在「Session length」和「Saved setups」已放進 .session-length-heading 所以元素都移到上方,所以子元素的 margin 要清掉
把position從absolute改成flex 讓Session length和Saved setups可以正常排列
確保標題不會被按鈕蓋住
把css 裡的檔案改成
.session-length-heading {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 0.75rem;
margin-top: 1.25rem;
}
.session-length-heading .setting-label,
.session-presets-trigger {
margin: 0;
}

@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 the current branch onto the upstream default branch and resolve any conflicts. Run /codetrial-review in AI agents (use $codetrial-review in Codex) and resolve all identified issues. Rework the series into minimal, logically coherent commits, squash closely related commits, and ensure all commit messages follow the project’s rules.

@jserv

jserv commented Nov 15, 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.

Not addressed at the current head:

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

Checked at 9650d18.

Candidates who switch between practice formats currently have to
reconfigure the lobby each time. Preserve multiple browser-local
setups and restore them without changing the selected problem,
difficulty filters, or optional interview context.

Cover saving, updating, deleting, reloading, and compatibility with
controls added after a setup was saved.

Close sysprog21#591

Change-Id: I40d4cc78525d421b4bbdf26b343e54266cf4b48d
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.

Let candidates save and switch between named session setups

2 participants