feat(social_fetch): add 4 reddit actions#21312
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds Reddit support to the social_fetch component by introducing shared Reddit helpers, new app props and API methods, four Reddit actions, and version bumps for existing actions, a source, and the package. ChangesSocial Fetch Reddit Support
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Action
participant SocialFetchApp
participant RedditAPI
Action->>SocialFetchApp: getSubreddit / listSubredditPosts / listPostComments / getPostTranscript
SocialFetchApp->>RedditAPI: GET /v1/reddit/... with query params
RedditAPI-->>SocialFetchApp: response data
SocialFetchApp-->>Action: response
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@components/social_fetch/actions/get-subreddit/get-subreddit.mjs`:
- Line 6: The Reddit action descriptions are too minimal and should be expanded
for agent use across all four new actions, including getSubreddit in
get-subreddit.mjs and the other Reddit action definitions in this PR. Update
each action’s description to add when-to-use guidance, brief parameter format
notes (especially accepted subreddit and URL forms), and a cross-reference to
related actions such as List Subreddit Posts so the agent can choose the right
tool more reliably. Keep the doc link, but make the description more
task-oriented and explicit in the action metadata.
In `@components/social_fetch/common/utils.mjs`:
- Around line 12-17: The truncation notice in the Object.keys(data) loop is
being overwritten each time another array field exceeds max, so only the last
truncated field is recorded. Update the logic in the truncation utility in
utils.mjs to accumulate notices instead of assigning data._truncated on every
iteration, and preserve existing messages when multiple array properties are
sliced.
In `@components/social_fetch/social_fetch.app.mjs`:
- Around line 125-139: The `sort` and `timeframe` prop descriptions in
`social_fetch.app.mjs` only point to the options arrays, so update those
descriptions to explicitly list the allowed enum values inline. Use the existing
`SUBREDDIT_POST_SORT_OPTIONS` and `SUBREDDIT_POST_TIMEFRAME_OPTIONS` definitions
to reflect the concrete values in the `sort` and `timeframe` fields so AI agents
can see examples like the valid sort and timeframe strings directly in the text.
- Around line 112-117: `listSubredditPosts` is using the raw `subreddit` input
in the request path, so the documented `r/`-prefixed and full Reddit URL forms
break the API call. Normalize the value inside `listSubredditPosts` before
constructing `/v1/reddit/subreddits/.../posts` by trimming, extracting the
subreddit name from `r/...` or `https://www.reddit.com/r/...`, and then encoding
only the canonical subreddit segment; keep the `subreddit` prop contract in sync
with the normalization behavior.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5c185984-8c6e-4a7e-8f2d-5672ec2deb81
📒 Files selected for processing (14)
components/social_fetch/actions/get-credit-balance/get-credit-balance.mjscomponents/social_fetch/actions/get-post/get-post.mjscomponents/social_fetch/actions/get-profile/get-profile.mjscomponents/social_fetch/actions/get-reddit-post-transcript/get-reddit-post-transcript.mjscomponents/social_fetch/actions/get-subreddit/get-subreddit.mjscomponents/social_fetch/actions/get-transcript/get-transcript.mjscomponents/social_fetch/actions/list-profile-posts/list-profile-posts.mjscomponents/social_fetch/actions/list-reddit-post-comments/list-reddit-post-comments.mjscomponents/social_fetch/actions/list-subreddit-posts/list-subreddit-posts.mjscomponents/social_fetch/common/constants.mjscomponents/social_fetch/common/utils.mjscomponents/social_fetch/package.jsoncomponents/social_fetch/social_fetch.app.mjscomponents/social_fetch/sources/new-profile-update/new-profile-update.mjs
Resolves #21276
Summary by CodeRabbit
New Features
Chores