Skip to content

fix(UNFY-421): pick a thread's latest MMS from the rows its thread shows - #274

Open
jake-dev-99 wants to merge 1 commit into
mainfrom
bug/unfy-421-latest-mms-user-visible-filter
Open

jake-dev-99 wants to merge 1 commit into
mainfrom
bug/unfy-421-latest-mms-user-visible-filter

Conversation

@jake-dev-99

@jake-dev-99 jake-dev-99 commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Fixes the conversation-list preview for threads whose newest MMS row is one the thread view hides (UNFY-421).

Cause. ConversationLookup._enrichConversation picked each thread's latest MMS with no MMS-type filter. The thread view keeps only MmsMessageType.userVisibleValues. Old builds saved sent MMS with no m_type and a millisecond date, which outranks every real row under date DESC. Those rows became the tile preview for threads that never show them. The full investigation is on the Linear issue.

Change.

  • The latest-MMS query uses the same userVisibleValues filter as the thread view.
  • New test: a null-m_type row with a millisecond date and a download notification are both skipped.
  • The test fake's MMS table declares m_type, the column the query now filters on.

Not in this PR.

  • Deleting the dead Kotlin writer that produced these rows: a separate debt change.
  • What to do with the existing malformed rows: an open decision on the issue.

Verification.

  • flutter pub get, flutter analyze --no-fatal-warnings (no issues), flutter test (405 passed), ./scripts/verify_mms_migration.sh and flutter pub publish --dry-run (0 warnings).
  • No Kotlin changed, so the native gate does not apply.
  • /sz-code-review, quick and full against origin/main: PASS, 0 findings.

🤖 Generated with Claude Code

Summary by Sourcery

Align conversation-list MMS previews with thread visibility rules.

Bug Fixes:

  • Ensure conversation previews select the latest MMS only from message types visible in the thread view, preventing hidden legacy or transport-only rows from appearing as previews.

Tests:

  • Add coverage for hidden MMS rows with newer dates and update the MMS test schema to support type filtering.

Summary by CodeRabbit

  • Bug Fixes
    • Conversation details now select the latest user-visible MMS, excluding drafts and transport-only notifications. This prevents non-message MMS records from being shown as the latest conversation message.

The conversation list's latest-MMS query had no MMS-type filter, while the
thread view keeps only user-visible types. Old builds saved sent MMS with
no m_type and a millisecond date, which outranks every real row under
`date DESC`, so those rows became the tile preview for threads whose view
never shows them.

Apply the thread view's `MmsMessageType.userVisibleValues` filter to the
enrichment query, and declare `m_type` on the test fake's MMS table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Filter the conversation's latest-MMS lookup to the same user-visible message types as the thread view, preventing hidden MMS rows from supplying the preview.

  • lib/src/android/services/conversation_lookup.dart L445-451

Tests

Add regression coverage proving a malformed null-type MMS and a transport-only notification are skipped, and expose m_type in the fake MMS table schema.

  • test/conversation_enrichment_test.dart L97-120, L762-766

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T22:26:00.334066Z df296bc PR opened
🔒 Security Review ✅ Completed 2026-11-18T22:27:02.322902Z df296bc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The latest-MMS lookup now excludes MMS types outside MmsMessageType.userVisibleValues. A regression test checks that a newer row without m_type and a transport notification do not replace the latest visible MMS.

Changes: Latest MMS lookup

Layer / File(s) Summary
Filter latest MMS results
lib/src/android/services/conversation_lookup.dart, test/conversation_enrichment_test.dart
The lookup filters MMS results to user-visible types. The regression test verifies that a legacy row without m_type and a transport notification are ignored. The MMS fixture schema now includes m_type.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: claude

Merge Risk: Minimal · up to df296

The conversation-list preview now uses the same MMS visibility filter as the thread view, so hidden legacy rows and download notifications no longer appear as previews. A regression test covers both cases. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the latest MMS shown for a conversation thread is now picked from the same rows the thread view displays. The raw summary confirms the query now uses MmsMessageType.us…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the latest MMS shown for a conversation thread is now picked from the same rows the thread view displays. The raw summary confirms the query now uses MmsMessageType.userVisibleValues, matching the objectives. The ticket prefix and 'fix' type are conventional and do not hurt clarity.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d264f9de-e873-4a84-90dd-fda92f25a45a
Commits

Reviewing files that changed from the base of the PR and between 624ab60 and df296bc.

Files selected for processing: 2

  • lib/src/android/services/conversation_lookup.dart
  • test/conversation_enrichment_test.dart

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="lib/src/android/services/conversation_lookup.dart" line_range="451" />
<code_context>
     final latestMmsFuture = MessageLookup.instance.listMms(
       filter: MmsFilter(
         threadId: base.threadId,
+        types: MmsMessageType.userVisibleValues,
         excludeMessageBoxes: const [MessageBox.draft],
       ),
</code_context>
<issue_to_address>
**Latest MMS contract is underspecified**

Callers relying on the model documentation's promise of the most recent non-draft MMS do not receive transport-only or unknown-type rows; the field now returns only MMS types visible in the thread view.

Update the `latestMms` field documentation to say it is the most recent user-visible, non-draft MMS.
</issue_to_address>

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

final latestMmsFuture = MessageLookup.instance.listMms(
filter: MmsFilter(
threadId: base.threadId,
types: MmsMessageType.userVisibleValues,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Low · Latest MMS contract is underspecified

Callers relying on the model documentation's promise of the most recent non-draft MMS do not receive transport-only or unknown-type rows; the field now returns only MMS types visible in the thread view.

Update the latestMms field documentation to say it is the most recent user-visible, non-draft MMS.

Prompt for AI agents
In `lib/src/android/services/conversation_lookup.dart` at line 451:

**Latest MMS contract is underspecified**

Callers relying on the model documentation's promise of the most recent non-draft MMS do not receive transport-only or unknown-type rows; the field now returns only MMS types visible in the thread view.

Update the `latestMms` field documentation to say it is the most recent user-visible, non-draft MMS.

@sz-overseer-jake-dev-99

Copy link
Copy Markdown

SZ Code Review

Verdict: FAIL
Findings: 1

Review boundary

  • Mode: full
  • Scope: all
  • Lifecycle: commit
  • Base commit: 624ab60dcd6895c94ce2eaecf54422f4f8d86fb5
  • Reviewed commit: df296bc099907d6279845180b0d3031c922d0de3
  • Reviewed changes: the whole branch since 624ab60dcd6895c94ce2eaecf54422f4f8d86fb5
  • Revision: 1
  • Review cycle: 1 of 3
  • Pre-push authoritative: yes

Findings

1. Canon blocker

  • Location: reference/simple-zen-toolchain-architecture.md:115
  • Evidence: documentation
  • Canon document: reference/simple-zen-toolchain-architecture.md

Finding

The PR title fix(UNFY-421): pick a thread's latest MMS from the rows its thread shows violates TCA-BRN-04, which requires the Linear issue identifier in brackets at the start.

Required fix

Rename the PR to [UNFY-421] Pick a thread's latest MMS from the rows its thread shows.

Auto-merge (shadow): eligible; the human still merges.

@sz-overseer-jake-dev-99 sz-overseer-jake-dev-99 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head: df296bc099907d6279845180b0d3031c922d0de3
Comparison commit: 624ab60dcd6895c94ce2eaecf54422f4f8d86fb5
Revision: 1

SZ Code Review

Verdict: FAIL
Findings: 1

Review boundary

  • Mode: full
  • Scope: all
  • Lifecycle: commit
  • Base commit: 624ab60dcd6895c94ce2eaecf54422f4f8d86fb5
  • Reviewed commit: df296bc099907d6279845180b0d3031c922d0de3
  • Reviewed changes: the whole branch since 624ab60dcd6895c94ce2eaecf54422f4f8d86fb5
  • Revision: 1
  • Review cycle: 1 of 3
  • Pre-push authoritative: yes

Findings

1. Canon blocker

  • Location: reference/simple-zen-toolchain-architecture.md:115
  • Evidence: documentation
  • Canon document: reference/simple-zen-toolchain-architecture.md

Finding

The PR title fix(UNFY-421): pick a thread's latest MMS from the rows its thread shows violates TCA-BRN-04, which requires the Linear issue identifier in brackets at the start.

Required fix

Rename the PR to [UNFY-421] Pick a thread's latest MMS from the rows its thread shows.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant