Skip to content

Remove unauthorized Chat UI, fix API paths, add real e2e conversation test #30

Description

@rowan-stein

User Request

Three critical fixes are required:

  1. Delete /agents/chat UI — This page was never requested. Only /agents/threads should exist as a UI route. Remove all related code: routes, pages, components, sidebar entry, API modules, hooks, types, mock data, and e2e tests for the chat page.

  2. Fix API path — The gateway is exposed at /api, not /apiv2. All API calls must use /api. (Already fixed in PR fix(api): switch gateway to /api #23, but verify no remnants remain.)

  3. Add a real e2e conversation test — A minimal but complete end-to-end test proving the chat actually works:

    • User A signs in
    • User B signs in
    • User B sends a message to User A (via ChatGateway)
    • User A can read this message
    • User A replies back
    • User B receives the reply

    This test must exercise the real ChatGateway ConnectRPC API (/api/agynio.api.gateway.v1.ChatGateway/*), not mocks.

Specification

1. Remove /agents/chat feature

Files to delete:

  • src/pages/AgentsChat.tsx
  • src/features/chat/ChatPage.tsx
  • src/features/chat/ChatConversation.tsx
  • src/features/chat/ChatInput.tsx
  • src/features/chat/ChatList.tsx
  • src/features/chat/ChatMessageItem.tsx
  • src/features/chat/sortByTimestamp.ts
  • src/api/modules/chat.ts
  • src/api/hooks/chat.ts
  • src/api/types/chat.ts
  • test/e2e/chat-conversation.spec.ts
  • test/e2e/chat-list.spec.ts
  • test/e2e/chat-navigation.spec.ts
  • test/e2e/chat-send-message.spec.ts
  • test/e2e/chat-fixtures.ts
  • test/e2e/chat-helpers.ts

Files to modify:

  • src/App.tsx — Remove AgentsChat import and /agents/chat routes
  • src/layout/RootLayout.tsx — Remove agentsChat from MENU_ITEM_ROUTES and MENU_ITEMS, remove unused MessagesSquare import if only used by chat
  • src/api/index.ts — Remove chatApi export
  • vite-plugin-mock-api.ts — Remove all ChatGateway mock handlers, chatStore, chatMessagesByChat, chatUnreadIdsByChat, and related types/imports

2. Verify API paths (already fixed)

Confirm no /apiv2 references remain anywhere in the codebase. The fix was merged in PR #23.

3. Add real e2e conversation test

Create a new e2e test file (e.g., test/e2e/chat-e2e.spec.ts) that:

  1. Acquires OIDC tokens for two different users (User A and User B) using the acquireOidcTokens helper (with different email env vars or parameterized calls).
  2. User B creates a chat with User A via POST /api/agynio.api.gateway.v1.ChatGateway/CreateChat.
  3. User B sends a message to that chat via POST /api/agynio.api.gateway.v1.ChatGateway/SendMessage.
  4. User A reads messages from the chat via POST /api/agynio.api.gateway.v1.ChatGateway/GetMessages and verifies B's message is present.
  5. User A sends a reply via POST /api/agynio.api.gateway.v1.ChatGateway/SendMessage.
  6. User B reads messages and verifies A's reply is present.

The test should use the Connect protocol (JSON over HTTP with Connect-Protocol-Version: 1 header) to call the ChatGateway. Each user's requests must include their own OIDC access_token as a Bearer token in the Authorization header.

Authentication approach:

  • Use acquireOidcTokens() from test/e2e/auth-helper.ts, calling it twice with different email addresses.
  • User A: default e2e-tester@agyn.test or via E2E_OIDC_EMAIL_A env var
  • User B: e2e-tester-b@agyn.test or via E2E_OIDC_EMAIL_B env var

Gateway base URL: Use E2E_BASE_URL env var (same as other e2e tests), which should resolve to the app's ingress that routes /api/* to the gateway.

Important: This test calls the API directly (not through the browser UI) to verify the backend chat functionality works end-to-end. It is a Playwright test file but uses fetch/HTTP calls rather than page interactions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions