Files
aiturk-mobil/app/src/test/java
M57andronia ad87cd1054 feat(#533): make /fork work via chat (session.branch) (#565)
* feat(#533): add session.branch (fork a conversation) to mobile

The gateway already supports session.branch (tui_gateway/server.py), but
the mobile had no client surface. This adds:
- WsMethods.SESSION_BRANCH = "session.branch"
- A Branch (CallSplit) action on each session card that forks it via the
  session.branch WS RPC with the source session_id (and optional name).
- branchedSessionId state -> SessionsScreen navigates to the freshly
  forked session on success; RpcError -> toast; spinner while branching.
- SessionsViewModelTest (4 tests): forwards session_id, forwards name,
  sets branchedSessionId on success, toast+no-branch on RpcError, and
  consumeBranchedSession clears the pending id.

Verified against the live gateway contract: session.branch expects
{session_id, name?} and returns {session_id, title, parent}. Local
testDebugUnitTest: 4/4 pass, ktlint clean.

* refactor(#533): make /fork work via chat instead of a session-menu button

Per review feedback: the session.branch surface belongs in the chat
composer, not the session list menu.

- SlashCommandDispatcher: /fork and /branch -> new SlashResult.SessionBranch.
- ChatViewModel: handles SessionBranch by sending session.branch with the
  active runtime session id (optional arg = branch title), and on the RPC
  result switches the current session to the new forked one (mirrors the
  SESSION_CREATE handler). This fixes /fork, which previously fell through to
  command.dispatch and 4018'd (backend only knows session.branch).
- Removed the Branch (CallSplit) button + navigation LaunchedEffect from
  SessionsScreen/SessionsViewModel (reverted those two files to main) and
  dropped the now-unused sessions_action_branch string.
- Tests: deleted SessionsViewModelTest (branch-only); added /fork -> SessionBranch
  to SlashCommandDispatcherTest and two ChatViewModel tests asserting /fork
  sends session.branch with the session id + optional name.

Local testDebugUnitTest: SlashCommandDispatcherTest 8/8, ChatViewModelTest 50/50,
0 failures. ktlint clean.

---------

Co-authored-by: ronia <ronia@m57>
2026-07-12 18:34:07 +03:00
..