Skip to content

feat(search): include favorite state in results - #6390

Open
dev-rb wants to merge 6 commits into
mainfrom
rahul/feat-search-favorites-reader
Open

dev-rb wants to merge 6 commits into
mainfrom
rahul/feat-search-favorites-reader

Conversation

@dev-rb

@dev-rb dev-rb commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Cross-cutting search API contract change and new per-user enrichment on every search response; failures degrade to false but could hide favorite UI state if the favorites service errors.

Overview
Search responses now expose viewer-specific favorite state via a required is_favorited field on unified and per-type search items (documents, chats, email, channels, channel messages, projects, calls, CRM companies, calendar events, agent sessions). OpenAPI, Rust models, SDK types, and cognition tool schemas were updated to match.

The search service adds a SearchFavoritesReader port and batch-enriches results after metadata assembly: unified search runs enrich_favorite_state before returning; channel search/name/message paths resolve favorited channel IDs separately. Channel message hits inherit the parent channel’s favorite flag, not the message id. Lookup failures are logged and results stay false rather than failing the request. Document storage wires the existing DssSoupFavoritesReader into search handler state (shared with soup).

The web client adds optional isFavorited on EntityBase and maps is_favoritedisFavorited across search transforms (including agent session mapping). Tests cover channel parent-channel behavior and unified mapping.

Also includes a Cargo.lock bump for rustls / aws-lc, and a documents test stub so failed creation does not invoke mention tracking.

Reviewed by Cursor Bugbot for commit fc2f597. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f58001d8-2b01-43f4-9f86-73a0fd6b2a24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: efe2057c-d29c-4e60-b9e2-c294d06de334

📥 Commits

Reviewing files that changed from the base of the PR and between 4ec7abf and e1ea6ab.

⛔ Files ignored due to path filters (6)
  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
  • apps/web/src/lib/service-clients/service-cognition/generated/tools/schemas.ts is excluded by !**/generated/**, !apps/web/src/lib/service-clients/**/generated/**
  • apps/web/src/lib/service-clients/service-cognition/generated/tools/types.ts is excluded by !**/generated/**, !apps/web/src/lib/service-clients/**/generated/**
  • apps/web/src/lib/service-clients/service-search/generated/models/channelMessageSearchResponseItem.ts is excluded by !**/generated/**, !apps/web/src/lib/service-clients/**/generated/**
  • apps/web/src/lib/service-clients/service-search/generated/models/channelNameSearchResponseItem.ts is excluded by !**/generated/**, !apps/web/src/lib/service-clients/**/generated/**
  • apps/web/src/lib/service-clients/service-search/generated/models/channelSearchResponseItem.ts is excluded by !**/generated/**, !apps/web/src/lib/service-clients/**/generated/**
📒 Files selected for processing (15)
  • apps/web/src/features/entity/types/entity.ts
  • apps/web/src/lib/queries/soup/transform-utils.test.ts
  • apps/web/src/lib/queries/soup/transform-utils.ts
  • apps/web/src/lib/service-clients/service-search/openapi.json
  • crates/models_search/src/channel.rs
  • crates/search_service/Cargo.toml
  • crates/search_service/src/api/context.rs
  • crates/search_service/src/api/search/channel.rs
  • crates/search_service/src/api/search/channel/test.rs
  • crates/search_service/src/api/search/unified/test.rs
  • crates/search_service/src/domain.rs
  • crates/search_service/src/domain/favorites.rs
  • crates/search_service/src/lib.rs
  • services/document_storage_service/src/api/context.rs
  • services/document_storage_service/src/service/soup_favorites_reader.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Channel search results now show whether each channel is favorited.
    • Message search results inherit and display the favorite status of their parent channel.
    • Favorite status is personalized for the requesting user.
  • Bug Fixes

    • Preserved channel favorite state when transforming search results for display.

Walkthrough

The search service now resolves favorited channel IDs for the requesting user and includes is_favorited in channel search responses. The field is defined in Rust models and OpenAPI schemas. The document storage service provides the favorites reader. Web mappers copy the value to channel and channel-message entities. Tests cover filtering and propagation.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to e1ea6

Favorite lookup failures degrade to an unfavorited display state rather than failing search, consistent with existing behavior. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title uses conventional commits format with the feat(search): prefix, is 47 characters long, and accurately summarizes the change.
Description check ✅ Passed The description clearly explains the favorite-state enrichment, API changes, frontend mapping, error behavior, and test coverage described in the changeset.

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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown

@dev-rb
dev-rb marked this pull request as draft September 14, 2026 18:34
@dev-rb dev-rb changed the title feat(search): include favorite state in channel results feat(search): include favorite state in results Sep 14, 2026
@dev-rb
dev-rb marked this pull request as ready for review September 14, 2026 19:35
@dev-rb
dev-rb requested a review from gbirman September 14, 2026 19:35

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cbf41b8. Configure here.

Comment thread crates/search_service/src/api/search/channel.rs

@gbirman gbirman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Old chat search results can show as failed. The generated tool schema now requires is_favorited, but saved NameSearch/ContentSearch results lack it. I reproduced this: the same payload passes the base schema and fails the PR schema. Make the generated reader accept missing favorite state and add legacy-payload coverage.
  • Favorite flags are snapshots. Favorite mutations don’t refresh cached search pages, so previously loaded pages can disagree with later pages after a toggle. The UI currently still reads the separate favorites list; before switching it to this field, add a reactive overlay or update/invalidate all affected search pages.
  • Each page also adds an awaited database lookup. Lookup failures return false, making unavailable state indistinguishable from “not favorited.”

i think overall though i'd prefer if we dispatched the favorite status call alongside the metadata enrichment step so we're not blocking on another roundtrip. or we can fold it into the the enrich metadata step directly in the sql (which seems maybe better since favorite status does seem like metadata but your call)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants