Skip to content

feat: Add get or create follow and unfollow endpoints and fix generate command#282

Open
naumoskajana wants to merge 2 commits into
mainfrom
feeds-1497
Open

feat: Add get or create follow and unfollow endpoints and fix generate command#282
naumoskajana wants to merge 2 commits into
mainfrom
feeds-1497

Conversation

@naumoskajana
Copy link
Copy Markdown
Contributor

@naumoskajana naumoskajana commented May 19, 2026

🎫 Ticket: https://linear.app/stream/issue/FEEDS-1497

📑 Docs: https://github.com/GetStream/docs-content/pull/

💡 Overview

📝 Implementation notes

Summary by CodeRabbit

  • New Features

    • Added a follow operation that updates local follow state and refreshes related profile fields when applicable.
  • Chores

    • Improved OpenAPI client generation by switching to a prebuilt generator, preserving generated output and continuing linting of generated code.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

📝 Walkthrough

Walkthrough

The PR switches OpenAPI generation to a prebuilt ./build/chat-manager binary and adds FeedsClient.getOrCreateFollow, which delegates to the superclass, updates local follow state, reconciles own_* fields when enriched, and returns the API response.

Changes

OpenAPI Build Automation

Layer / File(s) Summary
Prebuilt binary invocation
generate-openapi.sh
OpenAPI generation command switches from go run ./cmd/chat-manager to executing the prebuilt ./build/chat-manager binary with identical arguments and output directory, preserving the subsequent yarn lint:gen step.

Feeds follow handling

Layer / File(s) Summary
getOrCreateFollow state reconciliation
packages/feeds-client/src/feeds-client/feeds-client.ts
Adds FeedsClient.getOrCreateFollow which calls super.getOrCreateFollow, updates follow-derived feed state, conditionally reconciles own_* fields for source and target feeds when enrich_own_fields is present, and returns the response.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble code and hop along the logs,
A tiny dev with tidy, helpful paws—
A binary saved from endless compile clogs,
New follow paths that update all the laws. 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete, missing critical sections: Overview and Implementation notes are empty placeholders, providing no substantive information about the changes, rationale, or implementation details. Fill in the Overview section with the change summary and Implementation notes section with technical details about the new endpoints and generate command fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main changes: adding get/create follow and unfollow endpoints and fixing the generate command, matching the actual file modifications shown in the summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feeds-1497

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
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/feeds-client/src/feeds-client/feeds-client.ts`:
- Around line 1173-1187: Missing tests for the new getOrCreateFollow method: add
integration tests that exercise FeedsClient.getOrCreateFollow by mocking or
using the test harness to call getOrCreateFollow with enriched and non-enriched
requests, assert that it delegates to the superclass (super.getOrCreateFollow)
and returns the response, and verify side effects by checking that
updateStateFromFollows is applied and checkIfOwnFieldsChanged was invoked for
both response.follow.source_feed and response.follow.target_feed when
request.enrich_own_fields is true; mirror the existing test patterns used for
follow and getOrCreateFollows (same setup, assertions on returned Follow object
and on client state reconciliation) to ensure coverage for getOrCreateFollow,
updateStateFromFollows, and checkIfOwnFieldsChanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1461d0ad-3a74-4087-9209-052c7bc98da6

📥 Commits

Reviewing files that changed from the base of the PR and between f291273 and c2d2646.

📒 Files selected for processing (1)
  • packages/feeds-client/src/feeds-client/feeds-client.ts

Comment thread packages/feeds-client/src/feeds-client/feeds-client.ts
Comment thread generate-openapi.sh
rm -rf $OUTPUT_DIR

( cd $CHAT_DIR ; make openapi ; go run ./cmd/chat-manager openapi generate-client --language ts --spec ./releases/v2/feeds-clientside-api.yaml --output $OUTPUT_DIR )
( cd $CHAT_DIR ; make openapi ; ./build/chat-manager openapi generate-client --language ts --spec ./releases/v2/feeds-clientside-api.yaml --output $OUTPUT_DIR )
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.

Is this change intended ?

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.

I think it is because the PR description says: "fix generate command"

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.

Probably chat repo had some structural change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, chat repo has some changes, splitting the code by products (chat, feeds, moderation, video)

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.

3 participants