4.0 KiB
4.0 KiB
Android chat status row spec
Goal
Surface conversationTasks and executionWarnings as a single compact status row under each Android chat bubble so owners can see backend work without stacking multiple cards, while keeping realtime patches minimal.
Motivation
- The current Android chat preview renders separate warning cards below every message and keeps an expensive list of
executionWarningsseparately, which duplicates the tap area and height of the chat list. - The Web page already summarizes tasks and warnings inline: we should match that on Android while keeping real-time patches restrictive, only rejiggering views for the affected message.
- Requirements from the user: group warnings per message, deduplicate statuses, update only affected message on realtime patches, no web/backend changes.
Architecture
- Extend
BossUi.buildMessageBubble(or its wrapper) to accept a reusable compact status row view that can show a grouped warning count and task status. - When building a message view in
ProjectDetailActivity.buildMessageView, gather all conversation task summaries and execution warnings that match the message ID. Deduplicate them by warning ID or Task ID and render them inside the status row. - Create helper methods to compute a
StatusRowView(aLinearLayout) that displays:- If there is an active
conversationTask, show a row with the backend status label and session/task info. - If there are warnings, show badge summaries with title and summary text but limit to one line (maybe ellipsized) and collapse duplicates by grouping warnings that share the same title+summary pair.
- If there is an active
buildMessageViewwill add the status row view directly under the existing bubble but before any other attachments.- The realtime warning patch logic already replaces a specific
messageIdview; ensure it reconstructs the same minimal status row and only rerenders when the status content changes. To do that, we may need to compute a canonical string for the combined task/warnings and store/compare to avoid redundant replacements.
Implementation details
- Introduce new helper methods in
ProjectDetailActivity:private LinearLayout buildStatusRow(JSONObject message, List<ConversationTaskSummary> tasks, JSONArray warnings)private boolean hasStatusChangesForMessage(...)to allow realtime patch to compare old vs new statuses without rerender unless necessary.
BossUimay need a new method such aspublic static LinearLayout buildMessageStatusRow(Context context, String label, String detail, int tintColor)to standardize the UI.- Update
ProjectDetailActivity.appendContent(buildMessageView(message))loops to clear prior warning cards and add the new status row once. - Keep logic around
findExecutionWarningForMessagebut adjust to return grouped data instead of each warning separately. - Update
currentRenderedProjectPayloadhandling to consider the grouped warning/task text, ensuringhasSameExecutionWarningForMessagereturnstruewhen summaries and counts match.
Testing approach (TDD)
- Add a new or expand existing Android tests that read
ProjectDetailActivity.javasource to assert the presence of status row construction, grouped warnings, and realtime patch logic (e.g.,tests/android-chat-incremental-realtime-append.test.tsandtests/android-chat-local-realtime-patch.test.ts). - Write a failing test first that expects a new helper like
buildMessageStatusRoworgetStatusTextForMessageto exist and to be used under each message. - Update tests referencing warning cards to expect the new inline status row and ensure patch logic still references the helper to rerender targeted messages only when necessary.
- Manually run
npm test android-chat-incremental-realtime-append.test.tsandnpm test android-chat-local-realtime-patch.test.tsafter implementing.
Validation
- After receiving user approval on this spec, proceed with the implementation plan using TDD. Use test file names to focus runs, and keep the Android changes confined to
ProjectDetailActivity.java,BossUi.java, and the corresponding tests.