Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linear - New ProjectUpdates #15332

Merged
merged 7 commits into from
Jan 21, 2025
Merged

Linear - New ProjectUpdates #15332

merged 7 commits into from
Jan 21, 2025

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jan 17, 2025

Resolves #15313

Note: Will add source to linear app once this is published. Can't push changes for linear until linear_app package is updated.

Summary by CodeRabbit

  • New Features

    • Added support for retrieving and tracking project updates in Linear.
    • Introduced new methods for listing and fetching project updates.
    • New module for handling events related to the creation of project updates.
    • Added a new constant PROJECT_UPDATE to enhance resource management.
    • Added a new fragment definition for ProjectUpdate.
    • Introduced a new GraphQL query listProjectUpdates for retrieving project updates.
    • Added a new method isRelevantPolling for improved resource filtering.
  • Chores

    • Updated version numbers across multiple Linear app components.
    • Minor improvements to code structure and documentation.
  • Version Bump

    • Package version updated from 0.6.0 to 0.7.0.

Copy link

vercel bot commented Jan 17, 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) Visit Preview Jan 20, 2025 3:56pm
pipedream-docs ⬜️ Ignored (Inspect) Jan 20, 2025 3:56pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jan 20, 2025 3:56pm

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request updates the Linear app integration with a focus on version increments and the introduction of new functionalities related to project updates. Key changes include the addition of new methods, a GraphQL fragment, a query for project updates, and a new webhook trigger for project updates. The package version has been incremented, and several action files have also received minor version updates.

Changes

File Change Summary
linear_app.app.mjs Added getProjectUpdate and listProjectUpdates methods
common/constants.mjs Added PROJECT_UPDATE to RESOURCE_TYPE
common/fragments.mjs Added new ProjectUpdate fragment
common/queries.mjs Added listProjectUpdates GraphQL query
common/utils.mjs Updated buildVariables to support createdAt filtering
sources/new-projectupdate-created/new-projectupdate-created.mjs New module for project update webhook trigger
Multiple action files Version number increments (0.x.6 → 0.x.7)
package.json Version updated from 0.6.0 to 0.7.0

Assessment against linked issues

Objective Addressed Explanation
Create webhook trigger for Project updates
Support Linear Project updates resource type

Possibly related PRs

  • GitHub app actions improvements #14058: The main PR updates the version number of the create-issue.mjs file, which is related to the version updates in the get-issue.mjs, get-teams.mjs, search-issues.mjs, and update-issue.mjs files, all of which also involve version increments in the same Linear application context.
  • Linear Project Updates webhook #15259: This PR introduces a new webhook for project updates in the Linear application, which is directly related to the changes made in the main PR regarding the create-issue.mjs file.
  • Linear - Throw blocking configurationError for webhooks #14884: The main PR introduces a new module for project updates, which is directly related to the changes in the project-updated-instant.mjs file, as both involve updates to project-related functionalities in the Linear application.

Suggested labels

User submitted, ai-assisted

Suggested reviewers

  • GTFalcao

Poem

🐰 Hop, hop, Linear's new delight!
Project updates take their flight
Webhooks dancing, versions soar
CodeRabbit opens a brand new door
Integrations bloom so bright! 🚀


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 61d9ad2 and 3bd47ac.

📒 Files selected for processing (1)
  • components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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. (Beta)
  • @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.

@michelle0927 michelle0927 marked this pull request as ready for review January 17, 2025 18:54
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: 1

🧹 Nitpick comments (3)
components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs (1)

8-9: Enhance source description with supported event types.

The description should clarify that this source only emits events for newly created project updates, not for updates or deletions.

Apply this diff to improve the description:

-  name: "New Project Update (Instant)",
-  description: "Emit new event when a new Project Update is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
+  name: "New Project Update Created (Instant)",
+  description: "Emit new event when a project update is created (does not trigger on update or delete actions). [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
components/linear_app/linear_app.app.mjs (1)

Line range hint 19-25: Fix typo in resourceMapper property name.

The property name resouceMapper is consistently misspelled throughout the file (missing 'r'). While this doesn't affect functionality as it's used consistently, it should be corrected for maintainability.

Apply this diff to fix the typo:

  return this.listResourcesOptions({
    prevContext,
    resourcesFn: this.listTeams,
-   resouceMapper: ({
+   resourceMapper: ({
      id, name,
    }) => ({
      label: name,
      value: id,
    }),
  });

This change should be applied to all occurrences in the file.

Also applies to: 293-321

components/linear_app/sources/common/webhook.mjs (1)

64-66: Consider adding JSDoc documentation for the new method.

The isRelevantPolling method appears to be a base implementation that child classes can override for specific filtering logic during polling operations. Adding documentation would help developers understand its purpose and expected usage.

+    /**
+     * Determines if a polled resource is relevant and should be emitted.
+     * Override this method in child classes to implement specific filtering logic.
+     * @param {Object} resource - The resource to check
+     * @returns {boolean} True if the resource is relevant, false otherwise
+     */
     isRelevantPolling() {
       return true;
     },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between edf01ea and cdacd95.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • components/linear_app/actions/create-issue/create-issue.mjs (1 hunks)
  • components/linear_app/actions/get-issue/get-issue.mjs (1 hunks)
  • components/linear_app/actions/get-teams/get-teams.mjs (1 hunks)
  • components/linear_app/actions/search-issues/search-issues.mjs (1 hunks)
  • components/linear_app/actions/update-issue/update-issue.mjs (1 hunks)
  • components/linear_app/common/constants.mjs (1 hunks)
  • components/linear_app/common/fragments.mjs (1 hunks)
  • components/linear_app/common/queries.mjs (1 hunks)
  • components/linear_app/common/utils.mjs (1 hunks)
  • components/linear_app/linear_app.app.mjs (2 hunks)
  • components/linear_app/package.json (1 hunks)
  • components/linear_app/sources/comment-created-instant/comment-created-instant.mjs (1 hunks)
  • components/linear_app/sources/common/webhook.mjs (2 hunks)
  • components/linear_app/sources/issue-created-instant/issue-created-instant.mjs (1 hunks)
  • components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs (1 hunks)
  • components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs (1 hunks)
  • components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs (1 hunks)
  • components/linear_app/sources/project-updated-instant/project-updated-instant.mjs (2 hunks)
✅ Files skipped from review due to trivial changes (10)
  • components/linear_app/package.json
  • components/linear_app/sources/comment-created-instant/comment-created-instant.mjs
  • components/linear_app/actions/get-teams/get-teams.mjs
  • components/linear_app/actions/search-issues/search-issues.mjs
  • components/linear_app/actions/get-issue/get-issue.mjs
  • components/linear_app/actions/create-issue/create-issue.mjs
  • components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs
  • components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs
  • components/linear_app/sources/issue-created-instant/issue-created-instant.mjs
  • components/linear_app/actions/update-issue/update-issue.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (9)
components/linear_app/common/constants.mjs (1)

16-16: LGTM! Addition of PROJECT_UPDATE constant

The new constant follows the established naming pattern and correctly maps to Linear's API resource type.

components/linear_app/sources/project-updated-instant/project-updated-instant.mjs (1)

11-11: LGTM! Version bump and improved documentation

Good maintenance updates:

  • Version increment follows semantic versioning
  • Added helpful description for the teamIds parameter

Also applies to: 22-22

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

45-48: Consider adding date format validation

While the implementation is consistent with other filters, consider adding validation for the date format in createdAt.gte to prevent potential GraphQL query errors.

Example validation:

  const createdAt = args.filter.createdAt
-   ? `, createdAt: { gte: "${args.filter.createdAt.gte}" }`
+   ? `, createdAt: { gte: "${new Date(args.filter.createdAt.gte).toISOString()}" }`
    : "";
components/linear_app/common/queries.mjs (1)

78-105: LGTM! Well-structured ProjectUpdates query

The new query follows best practices:

  • Consistent with Linear's GraphQL schema
  • Implements standard pagination
  • Properly references required fragments
components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs (2)

50-59: LGTM! Good practice limiting historical data.

The implementation wisely limits the initial data fetch to updates from the last week, preventing excessive historical data processing.


63-71: LGTM! Robust filtering implementation.

The filtering logic properly handles both webhook events and polling scenarios, ensuring events are only emitted for the specified team and project (if provided).

components/linear_app/linear_app.app.mjs (2)

251-253: LGTM! Clean implementation of project update retrieval.

The method follows the established pattern of using the Linear SDK for single resource retrieval.


272-280: LGTM! Consistent implementation of project updates listing.

The method follows the established pattern for GraphQL queries and response handling.

components/linear_app/sources/common/webhook.mjs (1)

114-114: Verify the impact of switching from isRelevant to isRelevantPolling.

The change from isRelevant to isRelevantPolling suggests a separation between webhook and polling relevance checks. While both base implementations return true, we should verify that existing child classes implement the new method correctly where needed.

✅ Verification successful

The separation of isRelevant and isRelevantPolling is correctly implemented

The change introduces a clear separation between webhook and polling validation:

  • Base class provides safe defaults (both methods return true)
  • Sources can override either method based on their specific needs
  • Currently, only new-projectupdate-created needs specific polling validation and correctly implements isRelevantPolling
  • Other sources appropriately inherit the default polling behavior
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing implementations of isRelevant that might need to be updated

# Find all source files that might extend this base class
echo "Searching for source files that might need updates..."
rg -l "isRelevant\(" components/linear_app/sources/

# Check for any existing implementations that might need the new method
echo "Checking existing implementations..."
ast-grep --pattern 'isRelevant($_) { $$$ }' components/linear_app/sources/

Length of output: 627


Script:

#!/bin/bash
# Search for both method implementations and their usage with context
echo "Searching for isRelevant and isRelevantPolling implementations and usage..."
rg "isRelevant" -A 3 -B 3 components/linear_app/sources/

# Check class definitions that might extend the base class
echo "Checking class definitions..."
ast-grep --pattern 'class $_ extends $_ { $$$ }'

# Try different patterns for method implementations
echo "Checking alternative method syntaxes..."
ast-grep --pattern 'isRelevant = $_'

Length of output: 34711


Script:

#!/bin/bash
# Check for class inheritance and polling-related code
echo "Checking class inheritance..."
ast-grep --pattern 'class $_ extends Webhook { $$$ }'

echo "Checking for polling-related code..."
rg "poll" -B 2 -A 2 components/linear_app/sources/

# Check for any other isRelevantPolling implementations or references
echo "Checking for isRelevantPolling usage..."
rg "isRelevantPolling" -B 2 -A 2 components/linear_app/sources/

Length of output: 2270

components/linear_app/common/fragments.mjs Outdated Show resolved Hide resolved
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 (2)
components/linear_app/common/fragments.mjs (2)

139-167: LGTM! Consider enhancing user and initiative fields.

The fragment structure is well-organized and follows Linear's GraphQL schema. Consider these optional enhancements:

  • Add name field to the user object for display purposes
  • Add id field to initiatives.nodes for reference purposes
  user {
    id
+   name
  }
  ...
  initiatives {
    nodes {
+     id
      name
    }
  }

143-143: Document the health field.

Please add a comment explaining the possible values and meaning of the health field to improve code maintainability.

  id
  body
+ // health: Represents the project's health status (e.g. "on_track", "at_risk", "off_track")
  health
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cdacd95 and 61d9ad2.

📒 Files selected for processing (1)
  • components/linear_app/common/fragments.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base

jcortes
jcortes previously approved these changes Jan 17, 2025
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!

@michelle0927
Copy link
Collaborator Author

/approve

@michelle0927 michelle0927 merged commit cf980fd into master Jan 21, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-15313 branch January 21, 2025 15:37
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.

[TRIGGER] Linear - New ProjectUpdates
2 participants