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

Add ticket custom field number #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

laurenleach
Copy link
Contributor

@laurenleach laurenleach commented Oct 7, 2024

Pull Request

To help us get this pull request reviewed and merged quickly, please be sure to include the following items:

  • Tests (if applicable)
  • Documentation (if applicable)
  • Changelog entry
  • A full explanation here in the PR description of the work done

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

Backward Compatibility

Is this change backward compatible with the most recently released version? Does it introduce changes which might change the user experience in any way? Does it alter the Connector in any way?

  • Yes (backward compatible)
  • No (breaking changes)

Useful links:

  • [https://github.com/ConductorOne/baton-sdk/wiki/Coding-Guidelines](Baton SDK coding guidelines)
  • [https://github.com/ConductorOne/baton/blob/main/CONTRIBUTING.md](New contributor guide)

Issue Linking

What's new?

  • Add ticket custom field number case

Summary by CodeRabbit

  • New Features
    • Enhanced handling of custom fields in ticket processing to support numeric values.
  • Dependency Updates
    • Updated the version of the baton-sdk dependency to improve functionality and compatibility.

Copy link

coderabbitai bot commented Oct 7, 2024

Walkthrough

The pull request includes updates to the go.mod file, where the version of the github.com/conductorone/baton-sdk dependency has been changed from v0.2.33 to v0.2.35. Additionally, modifications are made to the customFieldSchemaToMetaField method in pkg/connector/tickets.go, adding support for handling v2.TicketCustomField_NumberValue types. This enhancement allows the method to process numeric custom field values, expanding its functionality while maintaining the existing control flow.

Changes

File Change Summary
go.mod Updated dependency version: github.com/conductorone/baton-sdk from v0.2.33 to v0.2.35.
pkg/connector/tickets.go Enhanced customFieldSchemaToMetaField method to handle *v2.TicketCustomField_NumberValue.

Possibly related PRs

Suggested reviewers

  • btipling

🐇 In the meadow, I hop with glee,
A version change for all to see!
Custom fields now can count,
Numeric values we can mount.
With each hop, our code does grow,
Thanks to the changes, off we go! 🌼


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 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.

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

🧹 Outside diff range and nitpick comments (1)
pkg/connector/tickets.go (1)

89-97: LGTM! Consider a minor optimization.

The new case for handling v2.TicketCustomField_NumberValue is implemented correctly and consistently with other cases. It properly checks for nil values at each step, ensuring robustness.

Consider simplifying the nil checks:

 case *v2.TicketCustomField_NumberValue:
-  if v.NumberValue == nil {
+  if v.NumberValue == nil || v.NumberValue.GetValue() == nil {
     return nil, nil
   }
-  numValue := v.NumberValue.GetValue()
-  if numValue == nil {
-    return nil, nil
-  }
-  return numValue.GetValue(), nil
+  return v.NumberValue.GetValue().GetValue(), nil

This change reduces the number of lines while maintaining the same functionality and nil-safety.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1adf0c3 and ad2e98a.

⛔ Files ignored due to path filters (12)
  • go.sum is excluded by !**/*.sum and included by none
  • vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/ticket.pb.go is excluded by !**/*.pb.go, !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pb/c1/connector/v2/ticket.pb.validate.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/cli/commands.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/cli/service_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/connectorbuilder/connectorbuilder.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/types/ticket/custom_fields.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/uhttp/gocache.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/uhttp/wrapper.go is excluded by !vendor/** and included by none
  • vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go is excluded by !**/*.pb.go, !vendor/** and included by none
  • vendor/modules.txt is excluded by !vendor/** and included by none
📒 Files selected for processing (2)
  • go.mod (1 hunks)
  • pkg/connector/tickets.go (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
go.mod (1)

6-6: Verify the intentionality and impact of the SDK update.

The github.com/conductorone/baton-sdk dependency has been updated from v0.2.33 to v0.2.35. This minor version update likely includes new features or non-breaking changes.

  1. Can you confirm that this update is intentional and related to the PR objective of adding a ticket custom field number?
  2. Have you verified compatibility with the new SDK version, especially concerning the changes made in the pkg/connector/tickets.go file?

To ensure there are no unintended consequences, please run the following command to check for any breaking changes or deprecations in the SDK update:

This will help identify any potential issues that may arise from the SDK update.

✅ Verification successful

Attempting to fetch and analyze the release notes again for github.com/conductorone/baton-sdk version v0.2.35.




SDK update verified and poses no breaking changes or deprecations.

The github.com/conductorone/baton-sdk dependency update to v0.2.35 is intentional and aligns with the PR objectives.

No breaking changes or deprecations were found in the release notes or the pkg directory, ensuring compatibility with the new SDK version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes or deprecations in the SDK update

# Fetch the changelog or release notes for the baton-sdk
gh repo view conductorone/baton-sdk --json url -q .url | xargs -I {} gh api {}/releases | jq -r '.[] | select(.tag_name == "v0.2.35") | .body'

# Search for any breaking changes or deprecation notices
rg -i "breaking change|deprecat" pkg

Length of output: 280


Script:

#!/bin/bash
# Description: Fetch the release notes for baton-sdk v0.2.35 and check for breaking changes or deprecations

# Fetch the release notes for tag v0.2.35
gh api repos/conductorone/baton-sdk/releases/tags/v0.2.35 --jq .body

# Search for any breaking changes or deprecation notices in the release notes
gh api repos/conductorone/baton-sdk/releases/tags/v0.2.35 --jq .body | rg -i "breaking change|deprecat"

# Additionally, search the pkg directory for breaking changes or deprecation notices
rg -i "breaking change|deprecat" pkg

Length of output: 436

pkg/connector/tickets.go (1)

89-97: Verify usage of updated customFieldSchemaToMetaField method.

The addition of number value handling enhances the method's capabilities. To ensure this change is fully utilized:

  1. Verify that all callers of customFieldSchemaToMetaField are aware of the new number value support.
  2. Check if any existing number fields were previously handled as strings and update them if necessary.

Run the following script to find usages of customFieldSchemaToMetaField:

Review the results to ensure proper utilization of the new number value support.

✅ Verification successful

Verification Successful: No issues found

The customFieldSchemaToMetaField method is properly utilized within pkg/connector/tickets.go, and number fields are correctly handled. No further action is required.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of customFieldSchemaToMetaField and potential number fields handled as strings

# Search for method calls
echo "Usages of customFieldSchemaToMetaField:"
rg --type go "customFieldSchemaToMetaField\(" -A 5

# Search for potential number fields handled as strings
echo "\nPotential number fields handled as strings:"
rg --type go "case jira\.TypeNumber:"

Length of output: 1061

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