Skip to content

Enforce lowercase usernames, per-field validation, and InfoTip requirements - #229

Merged
deathbyknowledge merged 5 commits into
mainfrom
feat/onboarding-lowercase-validation
Jul 30, 2026
Merged

Enforce lowercase usernames, per-field validation, and InfoTip requirements#229
deathbyknowledge merged 5 commits into
mainfrom
feat/onboarding-lowercase-validation

Conversation

@ka-wah

@ka-wah ka-wah commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves the onboarding and login username experience with lowercase enforcement, real-time per-field validation, and cleaner requirements display.

Changes

Lowercase enforcement

  • Onboarding username, agent name, and login username fields now auto-lowercase on every keystroke — typing Hank shows hank instantly

Per-field validation errors

  • Each username field independently shows its own error status/message in real-time (red border + error text below the field)
  • Both fields can show errors simultaneously, making it clear which one(s) fail
  • validateSetupDetails now checks the raw (untrimmed) value against isValidUsername, so leading/trailing spaces are properly rejected instead of silently passing after trim

Requirements as InfoTip

  • Username format requirements moved from static description text below the field to a hoverable circle-with-? InfoTip next to the field label (shown on hover/focus)

Review stage formatting

  • Account summary on step 3 reformatted to kawah - friend4 (agent) instead of kawah · agent friend4

Login username clear fix

  • Removed an effect that reset the login username field back to the snapshot value when the user cleared it, allowing proper backspace-to-empty

Files changed

  • web/src/app/features/session/setup/AccountDetails.tsx
  • web/src/app/features/session/LoginScreen.tsx
  • web/src/app/features/session/sessionDomain.ts
  • web/src/app/features/session/setup/ReviewStage.tsx
  • web/src/app/features/session/useSessionScreensState.ts

ka-wah added 2 commits July 29, 2026 14:49
…ip for requirements

- Onboarding + login username fields auto-lowercase input on every keystroke
- Per-field real-time validation: each username field shows its own error
  status/message independently, so it's clear which field(s) fail
- Username format requirements moved from description text to InfoTip
  (circle-with-? icon) next to the field label, shown on hover/focus
- validateSetupDetails now checks raw (untrimmed) value against
  isValidUsername so leading/trailing spaces are properly rejected
- Review stage account summary reformatted: 'kawah - friend4 (agent)'
  instead of 'kawah · agent friend4'
Remove the effect that reset loginUsername back to snapshot.username
whenever the field was cleared, allowing proper backspace-to-empty.

This comment was marked as low quality.

@ka-wah

ka-wah commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86ab5b54f5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return { message: "Username is required.", step };
}
if (!isValidUsername(username)) {
if (!isValidUsername(rawUsername)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce username rules at the setup syscall

This check rejects padded names only in the web wizard. buildSetupPayload/SessionService.setup still trim before sending, and gateway/src/kernel/sys/setup.ts trims in readRequiredString/readOptionalString before applying USERNAME_RE, so direct sys.setup/SDK callers can still submit " alice " or " friday " and get silently-created alice/friday while the UI rejects the same input. Because username format is setup syscall semantics, enforce or normalize it at that boundary instead of only this caller.

AGENTS.md reference: AGENTS.md:L22-L26

Useful? React with 👍 / 👎.

setLoginUsername(snapshot.username);
}
}, [loginUsername, snapshot.username]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Keep the login username in sync after setup

After a first-boot setup, this hook has been mounted since the pre-setup snapshot, so loginUsername was initialized as empty and this deletion removes the only path that copied the newly-created snapshot.username into the login form. If the session later locks without a full reload, the login screen no longer pre-fills the account that was just created; consider tracking whether the user has edited/cleared the field before suppressing snapshot updates.

Useful? React with 👍 / 👎.

…ill after setup

- Validate raw (untrimmed) username/agentName against USERNAME_RE in
  parseSetupIdentity/parseSetupAgentName so padded names are rejected at
  the setup syscall, not only in the web wizard
- Add loginUsernameTouched flag so login field syncs from snapshot.username
  after first-boot setup, but stops syncing once user manually edits
@ka-wah

ka-wah commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0146d49907

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +100 to +102
if (!loginUsernameTouched && snapshot.username) {
setLoginUsername(snapshot.username);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Mark login username edits as touched

When snapshot.username changes after the user has typed or cleared the login field, this effect still overwrites the field because loginUsernameTouched is initialized to false and is never set to true in the returned onUsername handler. The new guard therefore does not actually mean “the user hasn't manually edited,” so session updates during setup/lock/reconnect can replace in-progress login input; set the touched flag when handling username edits before relying on it here.

Useful? React with 👍 / 👎.

const usernameValue = draft.account.username;
const usernameInvalid = usernameValue.length > 0 && !isValidUsername(usernameValue);
const agentValue = draft.account.agentName;
const agentInvalid = agentValue.length > 0 && !isValidUsername(agentValue);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Keep optional agent validation consistent

If the optional personal-agent field contains only spaces, this marks the field invalid because agentValue.length > 0, but validateSetupDetails trims the same value, treats it as blank, and allows the user to advance while buildSetupPayload omits the agent name. That leaves a red error visible on a form that can still submit successfully; base the inline invalid state on the same trimmed value, or make submit validation block whitespace-only input too.

Useful? React with 👍 / 👎.

…ation with submit

- Set loginUsernameTouched=true in onUsername handler so the snapshot
  sync effect stops overwriting user input after manual edits
- Use trimmed agentValue for the inline invalid check so whitespace-only
  input doesn't show a red error while submit treats it as blank
@ka-wah

ka-wah commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: fc8c243990

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@deathbyknowledge
deathbyknowledge merged commit c3898b5 into main Jul 30, 2026
6 checks passed
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