Skip to content

Conversation

@szuperaz
Copy link
Contributor

@szuperaz szuperaz commented Jan 9, 2026

….current_feed

🎫 Ticket: https://linear.app/stream/issue/REACT-739/respect-enrichment-options-when-updating-feed-from-current-feed

📑 Docs: N/A

💡 Overview

📝 Implementation notes

Summary by CodeRabbit

  • Tests

    • Expanded test coverage for feed enrichment behavior across combinations of enrichment flags, websocket scenarios, deduplication, ordering, and follow/membership interactions.
  • Bug Fixes

    • Feed initialization now respects enrichment configuration: membership is always requested; capability and follow fields are included or skipped according to flags, and followings remain supported when enabled.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

FieldsToUpdate construction for newly discovered feeds was changed to always include own_membership and to respect enrichment_options flags for own_capabilities and own_follows; enrich_own_followings still enables own_followings. Tests expanded to cover flag combinations and edge cases.

Changes

Cohort / File(s) Summary
Feed Logic Implementation
packages/feeds-client/src/feed/feed.ts
Adjusted fieldsToUpdate construction: always include own_membership; include own_capabilities only if !enrichmentOptions.skip_own_capabilities; include own_follows only if !enrichmentOptions.skip_own_follows; preserve enrich_own_followingsown_followings.
Test Coverage
packages/feeds-client/src/feed/feed.test.ts
Expanded tests (many new scenarios) validating fieldsToUpdate generation across combinations of skip_own_capabilities, skip_own_follows, enrich_own_followings, WebSocket backfill behavior, deduplication, and interactions with current_feed and own_followings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

Possibly related PRs

Suggested reviewers

  • isekovanic
  • arnautov-anton

Poem

🐰
Fields now follow flags where they should,
Membership first, the rest as they’re good,
Tests hop through options one by one,
Ensuring each feed update is done—
A small rabbit cheers: work neatly hood!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description includes the required template sections (Ticket, Docs, Overview, Implementation notes) with the ticket reference, but Overview and Implementation notes sections are empty. Complete the Overview section to describe what the change does and the Implementation notes section to explain how it achieves the objective.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: respecting enrichment settings when updating feed state from activity.current_feed, which aligns with the code modifications shown.
Linked Issues check ✅ Passed The PR code changes modify fieldsToUpdate logic to conditionally include own_capabilities and own_follows based on enrichment_options flags, directly addressing REACT-739's requirement to respect enrichment settings.
Out of Scope Changes check ✅ Passed All changes are scoped to the feeds-client feed module, modifying fieldsToUpdate logic and corresponding test coverage, with no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/feeds-client/src/feed/feed.ts:
- Around line 993-1002: The change altered the push order on fieldsToUpdate
(currently pushing 'own_membership' first), breaking tests that expect the
previous order; revert to backward-compatible ordering by moving the
fieldsToUpdate.push('own_membership') so it is executed after the existing
pushes for 'own_capabilities', 'own_follows' and conditional 'own_followings'
(i.e., ensure enrichmentOptions checks for skip_own_capabilities,
skip_own_follows, and enrich_own_followings run before adding 'own_membership'),
or alternatively update all affected tests to expect the new order — but
preferred fix is to reorder the pushes in feed.ts to keep 'own_membership' last.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ffa5df8 and 359124e.

📒 Files selected for processing (2)
  • packages/feeds-client/src/feed/feed.test.ts
  • packages/feeds-client/src/feed/feed.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript for all code in this repository

Files:

  • packages/feeds-client/src/feed/feed.ts
  • packages/feeds-client/src/feed/feed.test.ts
**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

Add and extend tests with .test.ts suffix, covering FeedsClient, Feed classes, event handlers, state management, React hooks, contexts, utility functions, generated API clients, and integration tests in integration-tests/ directories

Files:

  • packages/feeds-client/src/feed/feed.test.ts
🧠 Learnings (2)
📚 Learning: 2025-12-17T11:01:52.854Z
Learnt from: CR
Repo: GetStream/stream-feeds-js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-17T11:01:52.854Z
Learning: Prioritize backwards compatibility, API stability, and high test coverage when changing code in this TypeScript Feeds SDK repository

Applied to files:

  • packages/feeds-client/src/feed/feed.ts
  • packages/feeds-client/src/feed/feed.test.ts
📚 Learning: 2025-12-17T11:01:52.854Z
Learnt from: CR
Repo: GetStream/stream-feeds-js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-17T11:01:52.854Z
Learning: Applies to **/*.test.ts : Add and extend tests with .test.ts suffix, covering FeedsClient, Feed classes, event handlers, state management, React hooks, contexts, utility functions, generated API clients, and integration tests in __integration-tests__/ directories

Applied to files:

  • packages/feeds-client/src/feed/feed.ts
  • packages/feeds-client/src/feed/feed.test.ts
🧬 Code graph analysis (1)
packages/feeds-client/src/feed/feed.test.ts (2)
packages/feeds-client/src/feed/feed.ts (1)
  • feed (270-272)
packages/feeds-client/src/test-utils/response-generators.ts (2)
  • generateFeedResponse (84-115)
  • generateActivityResponse (135-167)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint-and-test (22.x)
🔇 Additional comments (2)
packages/feeds-client/src/feed/feed.ts (1)

994-999: LGTM! Enrichment flag logic is correct.

The conditional logic properly respects the skip_own_capabilities and skip_own_follows flags, using safe optional chaining to handle undefined enrichmentOptions.

packages/feeds-client/src/feed/feed.test.ts (1)

457-676: Excellent comprehensive test coverage for enrichment options.

The test suite thoroughly covers all combinations of enrichment flags:

  • Individual flags (skip_own_capabilities, skip_own_follows, enrich_own_followings)
  • Boolean values (true/false)
  • Multiple flag combinations
  • Edge cases (both skip flags true)

The tests are well-structured, descriptive, and properly isolated. Based on learnings, high test coverage is prioritized in this repository, and this PR delivers on that expectation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/feeds-client/src/feed/feed.test.ts (1)

440-455: Consider clarifying test name to indicate default behavior.

While the test is correct, the title "should always include..." might be slightly misleading given that the new tests below demonstrate these fields can be excluded via skip flags. Consider renaming to make it clear this tests the default behavior, e.g., "should include own_capabilities, own_follows, own_membership by default when not from WebSocket".

♻️ Optional test name refinement
-  it('should always include own_capabilities, own_follows, own_membership when not from WebSocket', () => {
+  it('should include own_capabilities, own_follows, own_membership by default when not from WebSocket', () => {
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 359124e and ca97ae1.

📒 Files selected for processing (1)
  • packages/feeds-client/src/feed/feed.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript for all code in this repository

Files:

  • packages/feeds-client/src/feed/feed.test.ts
**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

Add and extend tests with .test.ts suffix, covering FeedsClient, Feed classes, event handlers, state management, React hooks, contexts, utility functions, generated API clients, and integration tests in integration-tests/ directories

Files:

  • packages/feeds-client/src/feed/feed.test.ts
🧠 Learnings (2)
📚 Learning: 2025-12-17T11:01:52.854Z
Learnt from: CR
Repo: GetStream/stream-feeds-js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-17T11:01:52.854Z
Learning: Applies to **/*.test.ts : Add and extend tests with .test.ts suffix, covering FeedsClient, Feed classes, event handlers, state management, React hooks, contexts, utility functions, generated API clients, and integration tests in __integration-tests__/ directories

Applied to files:

  • packages/feeds-client/src/feed/feed.test.ts
📚 Learning: 2025-12-17T11:01:52.854Z
Learnt from: CR
Repo: GetStream/stream-feeds-js PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-17T11:01:52.854Z
Learning: Prioritize backwards compatibility, API stability, and high test coverage when changing code in this TypeScript Feeds SDK repository

Applied to files:

  • packages/feeds-client/src/feed/feed.test.ts
🧬 Code graph analysis (1)
packages/feeds-client/src/feed/feed.test.ts (2)
packages/feeds-client/src/feed/feed.ts (1)
  • feed (270-272)
packages/feeds-client/src/test-utils/response-generators.ts (2)
  • generateFeedResponse (84-115)
  • generateActivityResponse (135-167)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint-and-test (22.x)
🔇 Additional comments (4)
packages/feeds-client/src/feed/feed.test.ts (4)

300-437: LGTM! Expectations updated to reflect new fieldsToUpdate behavior.

The test expectations have been correctly updated to include own_membership as the first element in the fieldsToUpdate array. This aligns with the PR objective to ensure enrichment settings are respected when updating feed state from activity.current_feed.


457-509: Excellent coverage of skip_own_capabilities flag behavior.

The tests properly verify that:

  • When skip_own_capabilities is true, the own_capabilities field is excluded from fieldsToUpdate
  • When skip_own_capabilities is false, the own_capabilities field is included

Test structure is clear and assertions are precise.


511-563: Excellent coverage of skip_own_follows flag behavior.

The tests properly verify that:

  • When skip_own_follows is true, the own_follows field is excluded from fieldsToUpdate
  • When skip_own_follows is false, the own_follows field is included

Consistent with the skip_own_capabilities tests and provides thorough individual flag coverage.


565-676: Outstanding coverage of enrichment flag combinations!

These tests comprehensively verify the interaction between multiple enrichment flags:

  • Both skip_own_capabilities and skip_own_follows set to true correctly results in only own_membership
  • Skip flags properly combine with enrich_own_followings, showing that:
    • own_followings is added when enrichment is enabled
    • Skip flags still control their respective fields independently
  • All three meaningful combinations are tested (both skip flags, each individual skip flag with enrich_own_followings)

This demonstrates proper orthogonality of the enrichment options and ensures the implementation respects all flag combinations correctly.

@szuperaz szuperaz merged commit 1091ae9 into main Jan 9, 2026
6 checks passed
@szuperaz szuperaz deleted the respect-enrichment-options branch January 9, 2026 14:15
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.

2 participants