Make CreateSessionRequest.name non-nullable #159

Closed
opened 2025-12-27 15:31:04 +00:00 by rwachters · 0 comments
rwachters commented 2025-12-27 15:31:04 +00:00 (Migrated from github.com)

Description

Make CreateSessionRequest.name non-nullable so the client must always provide a session name. This removes the server's default "New Chat" behavior and ensures all naming decisions happen client-side. The UI dialog will keep the name field optional, with the ViewModel providing "New Chat" as the default.

Steps

  1. Update CreateSessionRequest to make name non-nullable (String instead of String?)
  2. Modify server-side SessionService.createSession and SessionServiceImpl.createSession to accept name: String (non-nullable), remove the default "New Chat" fallback, and keep validation to reject blank names
  3. Update client-side API interfaces SessionApi.createSession, KtorSessionApiClient.createSession, SessionRepository.createSession, and DefaultSessionRepository.createSession to require name: String
  4. Modify SessionListViewModel.createNewSession to default to "New Chat" when initialName is null or blank, ensuring a non-null, non-blank name is always passed to the repository
  5. Keep NewSessionDialog UI unchanged with "(optional)" label - the ViewModel handles the default
  6. Update all tests in SessionRoutesTest.kt, SessionServiceImplTest.kt, and KtorSessionApiClientTest.kt to remove null-name test cases and ensure all requests provide valid names

Implementation Notes

  • The UI dialog keeps the name field optional (with "(optional)" label)
  • The ViewModel provides "New Chat" as the default when name is blank/null
  • Server-side validation for blank names is retained
## Description Make `CreateSessionRequest.name` non-nullable so the client must always provide a session name. This removes the server's default "New Chat" behavior and ensures all naming decisions happen client-side. The UI dialog will keep the name field optional, with the ViewModel providing "New Chat" as the default. ## Steps 1. Update `CreateSessionRequest` to make `name` non-nullable (`String` instead of `String?`) 2. Modify server-side `SessionService.createSession` and `SessionServiceImpl.createSession` to accept `name: String` (non-nullable), remove the default "New Chat" fallback, and keep validation to reject blank names 3. Update client-side API interfaces `SessionApi.createSession`, `KtorSessionApiClient.createSession`, `SessionRepository.createSession`, and `DefaultSessionRepository.createSession` to require `name: String` 4. Modify `SessionListViewModel.createNewSession` to default to "New Chat" when `initialName` is null or blank, ensuring a non-null, non-blank name is always passed to the repository 5. Keep `NewSessionDialog` UI unchanged with "(optional)" label - the ViewModel handles the default 6. Update all tests in `SessionRoutesTest.kt`, `SessionServiceImplTest.kt`, and `KtorSessionApiClientTest.kt` to remove null-name test cases and ensure all requests provide valid names ## Implementation Notes - The UI dialog keeps the name field optional (with "(optional)" label) - The ViewModel provides "New Chat" as the default when name is blank/null - Server-side validation for blank names is retained
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Torvian.eu/chatbot#159
No description provided.