Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Aug 11, 2025

Resolves #17725

@vunguyenhung: I'm getting 403 errors from some components, but I suspect it's because the account's trial period has ended.

Summary by CodeRabbit

  • New Features

    • Added OAuth-based LaunchDarkly integration with automatic Authorization handling.
    • New actions: List Projects, List Environments, List Feature Flags, Get Project, Get Feature Flag, Get Feature Flag Status, Evaluate Feature Flag, Toggle Feature Flag, Update Feature Flag.
    • New event sources: New Flag Event, New User Event, New Access Token Event.
  • Chores

    • Updated package version to 0.7.0.
    • Added dependency on LaunchDarkly components.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Adds OAuth-specific wrappers for multiple LaunchDarkly actions and sources by reusing base modules and adjusting prop definitions to inject the OAuth app. Updates the OAuth app to reuse LaunchDarkly methods and add an OAuth Authorization header helper. Adds a utility to adjust prop definitions and bumps package version and dependency.

Changes

Cohort / File(s) Summary
OAuth-wrapped Actions
components/launch_darkly_oauth/actions/.../evaluate-feature-flag.mjs, .../get-feature-flag/get-feature-flag.mjs, .../get-feature-flag-status/get-feature-flag-status.mjs, .../update-feature-flag/update-feature-flag.mjs, .../toggle-feature-flag/toggle-feature-flag.mjs, .../list-members/list-members.mjs, .../list-feature-flags/list-feature-flags.mjs, .../list-projects/list-projects.mjs, .../get-project/get-project.mjs, .../list-environments/list-environments.mjs
New OAuth variants wrapping base LaunchDarkly actions; extract base metadata, adjust props via adjustPropDefinitions(app), set unique keys/version, include app in props.
OAuth-wrapped Sources
components/launch_darkly_oauth/sources/.../new-access-token-event.mjs, .../new-flag-event/new-flag-event.mjs, .../new-user-event/new-user-event.mjs
New OAuth variants wrapping base sources; reuse base metadata, adjust props with app, set OAuth-specific keys/version.
App Module
components/launch_darkly_oauth/launch_darkly_oauth.app.mjs
Reuses base LaunchDarkly app via spread, removes propDefinitions/authKeys, adds getHeaders injecting Bearer oauth_access_token, spreads base methods.
Utils
components/launch_darkly_oauth/common/utils.mjs
Adds adjustPropDefinitions(props, app) to prepend app to propDefinition arrays and drop app-typed props.
Package Metadata
components/launch_darkly_oauth/package.json
Version bump to 0.7.0; adds dependency @pipedream/launchdarkly ^0.1.1.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant OAuth_Action as OAuth Action
  participant App as OAuth App
  participant BaseAction as Base LaunchDarkly Action
  participant LD as LaunchDarkly API

  User->>OAuth_Action: Invoke action with props
  OAuth_Action->>App: getHeaders() with OAuth token
  OAuth_Action->>BaseAction: Call with adjusted props
  BaseAction->>LD: HTTP request (Authorization: Bearer <token>)
  LD-->>BaseAction: Response
  BaseAction-->>OAuth_Action: Result
  OAuth_Action-->>User: Output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Add Evaluate Feature Flag tool [#17725]
Add Update/Toggle Feature Flag tools [#17725]
Add list/get flag, get flag status, list members [#17725]
Add list/get project, list environments [#17725]

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add OAuth source: new-access-token-event (components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs:1–end) Sources are not requested in the issue; objectives focus on tools/actions for the MCP server.
Add OAuth source: new-flag-event (components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs:1–end) Not mentioned in objectives; unrelated to adding MCP tools.
Add OAuth source: new-user-event (components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs:1–end) Not part of the specified tools; outside scope of the linked issue.

Possibly related PRs

Suggested labels

action, trigger / source

Suggested reviewers

  • GTFalcao

Poem

In burrows of code where flags take flight,
I nibbled some props and set them right.
OAuth breeze, a token bright,
Toggle and list in lunar light.
Projects, members—such delight!
Thump-thump, shipped snug—good night. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-17725-2

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Aug 11, 2025 3:22pm
pipedream-docs ⬜️ Ignored (Inspect) Aug 11, 2025 3:22pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Aug 11, 2025 3:22pm

Copy link
Contributor

@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)
components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (1)

1-22: Optional: DRY the wrapper pattern with a small helper

All OAuth wrappers share the same structure. Consider centralizing with a helper to reduce duplication and drift.

Apply this minimal refactor in-place:

 import app from "../../launch_darkly_oauth.app.mjs";
-import common from "@pipedream/launchdarkly/actions/list-projects/list-projects.mjs";
-
-import { adjustPropDefinitions } from "../../common/utils.mjs";
-
-const {
-  name, description, type, ...others
-} = common;
-const props = adjustPropDefinitions(others.props, app);
-
-export default {
-  ...others,
-  key: "launch_darkly_oauth-list-projects",
-  version: "0.0.1",
-  name,
-  description,
-  type,
-  props: {
-    app,
-    ...props,
-  },
-};
+import common from "@pipedream/launchdarkly/actions/list-projects/list-projects.mjs";
+import { wrapOAuth } from "../../common/utils.mjs";
+
+export default wrapOAuth(common, app, "launch_darkly_oauth-list-projects", "0.0.1");

Support code (outside this file) you can add once to components/launch_darkly_oauth/common/utils.mjs:

export function wrapOAuth(common, app, key, version = "0.0.1") {
  const { name, description, type, ...others } = common;
  const props = adjustPropDefinitions(others.props ?? {}, app);
  return {
    ...others,
    key,
    version,
    name,
    description,
    type,
    props: { app, ...props },
  };
}

Also consider making adjustPropDefinitions resilient to missing props:

export function adjustPropDefinitions(props = {}, app) { /* existing body */ }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e68cd3 and 8defbd3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/get-feature-flag-status/get-feature-flag-status.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/get-feature-flag/get-feature-flag.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/get-project/get-project.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/list-environments/list-environments.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/list-feature-flags/list-feature-flags.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/list-members/list-members.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/toggle-feature-flag/toggle-feature-flag.mjs (1 hunks)
  • components/launch_darkly_oauth/actions/update-feature-flag/update-feature-flag.mjs (1 hunks)
  • components/launch_darkly_oauth/common/utils.mjs (1 hunks)
  • components/launch_darkly_oauth/launch_darkly_oauth.app.mjs (1 hunks)
  • components/launch_darkly_oauth/package.json (2 hunks)
  • components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs (1 hunks)
  • components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs (1 hunks)
  • components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (14)
components/launch_darkly_oauth/common/utils.mjs (14)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/get-feature-flag-status/get-feature-flag-status.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/get-feature-flag/get-feature-flag.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/get-project/get-project.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/list-feature-flags/list-feature-flags.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/list-members/list-members.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/update-feature-flag/update-feature-flag.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/list-environments/list-environments.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/toggle-feature-flag/toggle-feature-flag.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs (1)
  • props (9-9)
components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs (1)
  • props (9-9)
components/monday_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/list-feature-flags/list-feature-flags.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/get-feature-flag/get-feature-flag.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/get-project/get-project.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/update-feature-flag/update-feature-flag.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/get-feature-flag-status/get-feature-flag-status.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (2)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs (2)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/list-members/list-members.mjs (2)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/list-environments/list-environments.mjs (2)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs (1)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
components/launch_darkly_oauth/actions/toggle-feature-flag/toggle-feature-flag.mjs (13)
components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/get-feature-flag-status/get-feature-flag-status.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/get-feature-flag/get-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/get-project/get-project.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/list-feature-flags/list-feature-flags.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/list-members/list-members.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/update-feature-flag/update-feature-flag.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/list-environments/list-environments.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs (2)
  • others (6-8)
  • props (9-9)
components/launch_darkly_oauth/common/utils.mjs (1)
  • adjustPropDefinitions (1-40)
⏰ 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). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (17)
components/launch_darkly_oauth/package.json (1)

3-18: All OAuth-Wrapped Endpoints and Imports Verified

  • Confirmed every import from "@pipedream/launchdarkly" in components/launch_darkly_oauth resolves.
  • All 10 expected OAuth-wrapped actions are present:
    • evaluate-feature-flag
    • get-feature-flag
    • get-feature-flag-status
    • get-project
    • list-environments
    • list-feature-flags
    • list-members
    • list-projects
    • toggle-feature-flag
    • update-feature-flag
  • All 3 expected OAuth-wrapped sources are present:
    • new-access-token-event
    • new-flag-event
    • new-user-event

No missing files or broken imports detected—ready to merge.

components/launch_darkly_oauth/common/utils.mjs (1)

1-40: Prop definition adapter matches established pattern; LGTM.

The implementation mirrors the pattern used in other OAuth packages (e.g., monday_oauth), correctly:

  • Preserving string props
  • Replacing the first propDefinition element with the OAuth app
  • Dropping props of type "app"

No changes requested.

components/launch_darkly_oauth/launch_darkly_oauth.app.mjs (1)

1-17: App wrapper and headers override are correct; LGTM.

  • Spreading ...launchdarkly.methods before getHeaders ensures the OAuth header logic overrides the base.
  • Authorization header is appended last, preventing accidental override by callers.

Optional (no change required): consider adding Accept: application/json to be explicit for GET requests if any downstream relies on it.

components/launch_darkly_oauth/actions/evaluate-feature-flag/evaluate-feature-flag.mjs (1)

1-22: Wrapper pattern is correct and consistent; LGTM.

  • adjustPropDefinitions usage is appropriate and props are correctly reintroduced alongside app.
  • Key/version overrides are applied after spreading ...others.

No changes requested.

components/launch_darkly_oauth/actions/get-project/get-project.mjs (1)

1-22: Consistent OAuth wrapper; LGTM.

  • Properly injects app and adjusted props.
  • Correct key and version overrides.

No changes requested.

components/launch_darkly_oauth/actions/get-feature-flag/get-feature-flag.mjs (1)

1-22: Consistent OAuth wrapper; LGTM.

Pattern matches other actions and correctly replaces propDefinition app ref. No issues spotted.

components/launch_darkly_oauth/sources/new-access-token-event/new-access-token-event.mjs (1)

1-22: Source wrapper is correct; LGTM.

  • Props adjusted and app injected properly.
  • Unique key and version set.

No changes requested.

components/launch_darkly_oauth/sources/new-flag-event/new-flag-event.mjs (1)

1-22: Source wrapper follows the same solid pattern; LGTM.

Nothing concerning here; consistent with the rest of the OAuth-wrapped sources.

components/launch_darkly_oauth/actions/list-projects/list-projects.mjs (1)

1-22: Pattern-aligned OAuth wrapper — looks good

Consistently injects the OAuth app and adjusts prop definitions as elsewhere in the PR. Spread order ensures your overrides take precedence.

components/launch_darkly_oauth/actions/list-environments/list-environments.mjs (1)

1-22: LGTM — consistent OAuth wrapper

Correctly reuses base action metadata and injects app with adjusted props. Spread order and key override look correct.

components/launch_darkly_oauth/actions/list-feature-flags/list-feature-flags.mjs (1)

1-22: LGTM — wrapper matches established pattern

Imports are correct, props adjusted via utility, and key/version override is in the right place.

components/launch_darkly_oauth/sources/new-user-event/new-user-event.mjs (1)

1-22: Source wrapper looks correct

Properly injects the OAuth app into prop definitions and preserves base source metadata. Key uniqueness looks fine.

components/launch_darkly_oauth/actions/update-feature-flag/update-feature-flag.mjs (1)

1-22: LGTM — update wrapper is correct

OAuth app injection and prop adjustments look good. This action will rely on correct OAuth scopes on the app to avoid 403s at runtime.

components/launch_darkly_oauth/actions/toggle-feature-flag/toggle-feature-flag.mjs (1)

1-22: LGTM — toggle wrapper matches the pattern

All fields and prop handling look consistent with other OAuth-wrapped actions.

components/launch_darkly_oauth/actions/list-members/list-members.mjs (2)

1-22: LGTM — list-members OAuth wrapper

Implementation is consistent and correct.


1-22: Verification complete: all expected OAuth wrappers are present
All ten endpoints (get-feature-flag, get-feature-flag-status, list-feature-flags, list-projects, get-project, list-environments, list-members, toggle-feature-flag, update-feature-flag, new-user-event) have matching launch_darkly_oauth-… keys in the codebase. No missing wrappers detected.

components/launch_darkly_oauth/actions/get-feature-flag-status/get-feature-flag-status.mjs (1)

1-22: LGTM — status wrapper is correct

Uses the shared adjust utility and injects the app as expected. No issues spotted.

Copy link
Collaborator

@jcortes jcortes left a comment

Choose a reason for hiding this comment

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

Hi @michelle0927 lgtm! Ready for QA!

@vunguyenhung vunguyenhung merged commit 20c3032 into master Aug 12, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-17725-2 branch August 12, 2025 03:38
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.

Please add tools to the launch_darkly_oauth MCP server!

4 participants