Skip to content

Add optional sources filter to conversations count endpoint#8873

Merged
kodjima33 merged 2 commits into
mainfrom
kodjima33/conversations-count-sources
Jul 2, 2026
Merged

Add optional sources filter to conversations count endpoint#8873
kodjima33 merged 2 commits into
mainfrom
kodjima33/conversations-count-sources

Conversation

@kodjima33

@kodjima33 kodjima33 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Backend half of the home-page "Omi Device → Connected" feature (desktop half follows separately).

  • GET /v1/conversations/count?sources=friend,omi counts conversations from the given capture sources (single Firestore in filter; cannot combine with statuses, 400 if both).
  • When sources is applied, the response echoes it ({count, sources}) so clients can tell a filtered count from an older backend ignoring the unknown param — prevents false positives during rollout.
  • Legacy response shape unchanged when the param is absent.

Verified over HTTP against real accounts (local backend, prod Firestore): 9,531 for a wearable account, 0 for one without, no composite-index issues with combined equality filters.

🤖 Generated with Claude Code

Review in cubic

Lets clients ask whether an account has conversations from specific capture
sources (e.g. friend/omi wearables). When the filter is applied the response
echoes it back, so clients can distinguish a filtered count from an older
backend that ignored the unknown param and returned the unfiltered total.
statuses and sources cannot combine (single Firestore in-filter per query).

Verified against real data over HTTP: filtered count + echo for an account
with wearable history, zero for one without, legacy shape unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-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.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

…or tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kodjima33 kodjima33 merged commit fb6d370 into main Jul 2, 2026
7 checks passed
@kodjima33 kodjima33 deleted the kodjima33/conversations-count-sources branch July 2, 2026 19:47
kodjima33 added a commit that referenced this pull request Jul 2, 2026
…ory (#8875)

The home Omi Device row only reflected a device paired to this Mac via
BLE — wearables usually pair on mobile, so desktop always showed it
unconnected.

Now the row shows **Connected** when the account has any
`friend`/`omi`-sourced conversations, via the new `sources` filter on
`/v1/conversations/count` (#8873). The client strictly decodes the
`{count, sources}` echo, so an older backend that ignores the param can
never produce a false positive (verified fail-closed against prod).
Result is sticky-cached in UserDefaults.

## Verification (local end-to-end)
- Local backend running the endpoint + local app build (`omi-subtitle`
named bundle, real launch path): Omi Device row renders **Connected**
for an account with a wearable conversation — screenshot in workspace.
- Fail-closed: same build against prod backend (no `sources` support)
shows no badge.
- `swift build` clean; backend tests 36/36 on the paired PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/8875?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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