Skip to content

[Episode Chat] Send the missing chat analytics properties - #6141

Merged
sztomek merged 6 commits into
feat/episode-chat-answer-ratingfrom
feat/episode-chat-analytics
Oct 14, 2026
Merged

sztomek merged 6 commits into
feat/episode-chat-answer-ratingfrom
feat/episode-chat-analytics

Conversation

@sztomek

@sztomek sztomek commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Sends the episode chat analytics from EventHorizonSchemas#139 that Android was still missing. This PR is based on #6142.

episode_chat_message_sent.message_index

  • The position of the user's question in the conversation, starting at 1.
  • It continues from the saved conversation when the chat is reopened, and starts again at 1 after Clear Chat. (Clear Chat is removed in a follow-up PR, so in the end it only continues.)
  • A retried question keeps its number.
  • If a question fails and the user asks a new one instead of retrying, the failed one isn't counted. It's also no longer sent to the server as part of the conversation history (it was never saved, so it disappeared from the chat anyway).

episode_chat_quote_play_tapped / episode_chat_quote_stop_tapped

  • These now send quote_source = inline_timestamp, the only way to play a quote since [Episode Chat] Restyle the conversation #6124.
  • The stop event goes away in the follow-up that makes a quote tap keep playing. Automattic/EventHorizonSchemas#140 removes it from the schema.

episode_chat_response_received (new on Android)

  • duration_ms measures how long the user waits for an answer: from sending the question until the answer is saved. A token refresh or the database writes can add to it.
  • ChatViewModel gets the clock injected as a TimeSource, so tests can control the time.

episode_chat_response_rated (new on Android)

  • Sent each time a 👍/👎 from [Episode Chat] Rate answers with thumbs up or down #6142 sets a rating, with rating and message_index (the number of the question the answer replies to). Clearing a rating isn't tracked, since the schema says it "fires on each tap that sets a rating".

Fixes POC-952 https://linear.app/a8c/issue/POC-952

Testing Instructions

Use a debug build with "Episode Chat" on in Beta features, and watch adb logcat | grep "Analytics:".

  1. Open Ask about this episode and ask two questions. ✅ episode_chat_message_sent shows message_index=1, then 2. Each one is followed by episode_chat_response_received with a duration_ms.
  2. Close the chat, reopen it, and ask again. ✅ message_index=3.
  3. ⋯ › Clear Chat, then ask again. ✅ message_index=1.
  4. Turn on airplane mode and ask a question. ✅ episode_chat_message_failed, and no response_received. Turn airplane mode off and tap Retry. ✅ It keeps the same message_index.
  5. Tap a quote's timestamp, then tap it again. ✅ The play and stop events both have quote_source=inline_timestamp.
  6. Tap 👎 under the second answer. ✅ episode_chat_response_rated with rating=negative and message_index=2. Tap 👎 again to clear it. ✅ Nothing is tracked.

Screenshots or Screencast

No UI changes.

Checklist

  • If this is a user-facing change, I have added an entry in CHANGELOG.md
  • Ensure the linter passes (./gradlew spotlessApply to automatically apply formatting/linting)
  • I have considered whether it makes sense to add tests for my changes
  • All strings that need to be localized are in modules/services/localization/src/main/res/values/strings.xml
  • Any jetpack compose components I added or changed are covered by compose previews
  • I have updated (or requested that someone edit) the Event Horizon schema to reflect any new or changed analytics.

I have tested any UI changes...

  • with different themes
  • with a landscape orientation
  • with the device set to have a large display and font size
  • for accessibility with TalkBack

@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 54s —— View job


No blocking issues. message_index comes out right for retry, Clear Chat, reopen, and a new question after a failure, since the UI's canSend blocks a second send while one is in flight. TimeSource is already provided by UtilsModule, which the chat module depends on, so Hilt can inject it.

Non-blocking

  • modules/features/chat/src/main/kotlin/au/com/shiftyjelly/pocketcasts/chat/ChatViewModel.kt:468: if a save fails partway, the failed question can already be in the DB and still shown in the chat. The next question then leaves it out of message_index and the history. Doing the inserts in ChatManagerImpl.sendMessage in one transaction fixes this. [Episode Chat] Send the missing chat analytics properties #6141 (comment)

@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from 7a1e168 to e3e8b43 Compare October 8, 2026 17:35
@sztomek
sztomek changed the base branch from feat/episode-chat-feedback-form to feat/episode-chat-answer-rating October 8, 2026 17:35
@sztomek sztomek added this to the 8.23 milestone Oct 8, 2026
@sztomek
sztomek marked this pull request as ready for review October 8, 2026 17:48
@sztomek
sztomek requested a review from a team as a code owner October 8, 2026 17:48
@sztomek
sztomek requested review from geekygecko and removed request for a team October 8, 2026 17:48
@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 34s —— View job


The new push rebases the same five commits onto the updated feat/episode-chat-answer-rating, and the ViewModel changes look the same as in the last review. Nothing new to flag. The earlier non-blocking finding is still open: ChatManagerImpl.sendMessage still saves the question, reply and quote as separate writes, not in one transaction.

Non-blocking

@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 7fc7418 to 8e7d943 Compare October 9, 2026 13:29
@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from e3e8b43 to c3a6d4b Compare October 9, 2026 13:33
@claude

claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 31s —— View job


The new commit (c3a6d4b) fixes the earlier non-blocking finding. ChatManagerImpl.sendMessage now saves the question, reply and quote with one insertMessages call, which Room runs as a single transaction. A failed question really is never saved now. The createdAt + index offsets keep the three rows in order. Nothing new to flag, and nothing still open.

@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 8e7d943 to 4c534b6 Compare October 9, 2026 16:08
@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from c3a6d4b to 11698c5 Compare October 9, 2026 16:08
@claude

claude Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 35s —— View job


This push rebases the same six commits onto the updated feat/episode-chat-answer-rating. The single-transaction insertMessages change in ChatManagerImpl is the same as in the last review, so there's nothing new to flag and nothing still open.

@wpmobilebot wpmobilebot modified the milestones: 8.23, 8.24 Oct 12, 2026
@wpmobilebot

Copy link
Copy Markdown
Collaborator

Version 8.23 has now entered code-freeze, so the milestone of this PR has been updated to 8.24.

@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 4c534b6 to 1058010 Compare October 12, 2026 10:05
@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from 11698c5 to 02e2e93 Compare October 12, 2026 10:05
@claude

claude Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 16s —— View job


This push rebases the same six commits onto the updated feat/episode-chat-answer-rating without changing the PR diff, so there's nothing new to flag and nothing still open.

@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from 02e2e93 to 5ca63e6 Compare October 12, 2026 15:58
@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 1058010 to 162e5b5 Compare October 12, 2026 15:58
@claude

claude Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 15s —— View job


This push rebases the same six commits onto the updated feat/episode-chat-answer-rating without changing the PR diff, so there's nothing new to flag and nothing still open.

@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 162e5b5 to 128e302 Compare October 13, 2026 13:32
@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from 5ca63e6 to 56b4e9c Compare October 13, 2026 13:32
@claude

claude Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 12s —— View job


This push rebases the same six commits onto the updated feat/episode-chat-answer-rating without changing the PR diff, so there's nothing new to flag and nothing still open.

@sztomek
sztomek force-pushed the feat/episode-chat-analytics branch from 56b4e9c to b7ddabf Compare October 13, 2026 14:50
@sztomek
sztomek force-pushed the feat/episode-chat-answer-rating branch from 128e302 to 51ae9bb Compare October 13, 2026 14:50
@claude

claude Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @sztomek's task in 16s —— View job


This push rebases the same six commits onto the updated feat/episode-chat-answer-rating without changing the PR diff, so there's nothing new to flag and nothing still open.

@sztomek
sztomek merged commit 0e73311 into feat/episode-chat-answer-rating Oct 14, 2026
21 of 22 checks passed
@sztomek
sztomek deleted the feat/episode-chat-analytics branch October 14, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants