Skip to content

Submit the GitHub username with Enter - #122

Merged
jserv merged 2 commits into
sysprog21:mainfrom
Suzu1Dev:fix/f23-lobby-login-enter
Sep 27, 2026
Merged

jserv merged 2 commits into
sysprog21:mainfrom
Suzu1Dev:fix/f23-lobby-login-enter

Conversation

@Suzu1Dev

@Suzu1Dev Suzu1Dev commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

The lobby username field required moving focus to Use GitHub before submitting. Let Enter invoke the existing button action while leaving composition Enter to the input method. Reusing the button preserves its disabled state while a request is pending.

Testing: ./scripts/test.sh passes on cb4e88a, including all 653 browser tests with 0 skipped. All optional local tool checks ran. The added Chromium tests cover ordinary Enter, composition followed by a committed username, and repeated Enter during a pending request. Removing the handler or the composition guard makes the corresponding regression test fail.


Summary by cubic

Allows pressing Enter in the GitHub username field to submit the login, reusing the guarded button action so the disabled state still applies while a request is pending; composition Enter (IME) stays with the input method.

This also keeps the lobby's interview setup intact while account changes settle. Login, Start, history refreshes, and report deletion now share one state lock, an uncertain login result can be retried without recording a duplicate session, and header sign-in no longer races Start into a lost interview selection. Account reads and login requests are bounded to ten seconds and fall back without leaving controls stuck.

  • Adds Chromium coverage for ordinary Enter, composition Enter, repeated Enter during a pending request, login timeouts, and preserved interview choices.

Written for commit 836ae24. Summary will update on new commits.

Review in cubic

The lobby username field required moving focus to Use GitHub before
submitting. Route Enter through the same guarded button action, while
leaving composition Enter available for text input.
Comment thread web/app.js Resolved
Comment thread web/app.js Resolved
Comment thread web/app.js
nodes.githubLogin.addEventListener("keydown", (event) => {
if (event.key !== "Enter" || event.isComposing) return;
event.preventDefault();
nodes.loginLink.click();

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 handler this reaches clears disabled after recordGitHubLogin(true) returns, and that return happens once window.location.reload() is queued but before the new document commits, so the button is armed again for the whole unload. A held Enter repeats at the key rate and lands another /api/login in that window, which the server may rate limit. The pending test presses Enter only while the request is in flight, never after it resolves, so it does not cover this. Leave disabled set on success and clear it only on the failure return.

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.

Successful header sign-in now updates the account and history without reloading. Login and Start stay blocked through the refresh, and queued events targeting the hidden login button cannot send another POST. An explicit HTTP rejection permits retry; a timeout or connection failure with an unknown POST outcome instead offers a GET-only account check before another login is allowed.

Comment thread web/app.js
nodes.githubLogin.addEventListener("keydown", (event) => {
if (event.key !== "Enter" || event.isComposing) return;
event.preventDefault();
nodes.loginLink.click();

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.

Reusing #login-link also inherits its recordGitHubLogin(true), so Enter reloads the lobby. A candidate who picked a problem, set a duration, moved the difficulty filters, or loaded a job description and resume loses all of it to one keypress in the header field, where before it took a deliberate press of Use GitHub. The description sells the reuse as preserving the disabled state and does not mention that it also preserves the reload. The start path records a login without reloading, via recordGitHubLogin(false); as a follow-up, doing the same here and refreshing the account row in place would keep the candidate's work on screen.

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.

Implemented the in-place refresh. Enter and button tests preserve the manually selected problem, difficulty, duration, profile, round plan, loaded JD/resume selections and document consent, then verify what reaches Start. Account-check failure offers a GET-only retry. The server duration cap still applies, and a changed practice weakness withdraws consent to share the previous text.

Comment thread tests/browser/lobby.test.js Resolved
Header sign-in could race Start and discard the candidate's interview
setup. Keep that setup on screen while account changes settle, and make
an uncertain login result recoverable without silently recording a
second session.

Bound account reads and login requests to ten seconds and cover the
transition, IME confirmation and preserved choices with browser tests.
@jserv
jserv requested review from ColtenOuO and alanhc September 27, 2026 09:24

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

LGTM, Great work!

@jserv
jserv merged commit 792f68b into sysprog21:main Sep 27, 2026
6 checks passed
@jserv

jserv commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Thank @Suzu1Dev for contributing!

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