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 deprecation message to the created pull request #10379

Closed

Conversation

kbukum1
Copy link
Contributor

@kbukum1 kbukum1 commented Aug 6, 2024

What are you trying to accomplish?

Implementing a feature to add deprecation messages to the created pull requests. This includes using log levels to match messages shown on the UI, ensuring clear communication of deprecation and other important information.

What issues does this affect or fix?

This enhancement adds the bundler v1 deprecation warning into the PR description.

Anything you want to highlight for special attention from reviewers?

  • This PR introduces a generic method to provide informational messages, warnings, and errors in the PR description. It is also generating bundler v1 deprecation warning and attaching it to the pr_notices which can be used to attach to the PR. We are attaching generated notices here: Attach generated_pr_notices into the PR description #10399.
  • Added PackageManagerBase abstract class and created PackageManager subclass for bundler to make the package manager information reachable through dependabot-core updater and common code. Currently, we are using this class for deprecation and support but it can be used for other purposes as well.

How will you know you've accomplished your goal?

  • Demonstration: The specs should successfully run successfully for generated_pr_notices and also should generated deprecation warning and unsupported error properly by the given package manager information.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@github-actions github-actions bot added the L: ruby:bundler RubyGems via bundler label Aug 6, 2024
@kbukum1 kbukum1 self-assigned this Aug 6, 2024
@kbukum1 kbukum1 force-pushed the kamil/bundler_v1_deprecation_warning_on_pr_description branch 5 times, most recently from f08fcd6 to 4b44e8b Compare August 7, 2024 16:28
@kbukum1 kbukum1 force-pushed the kamil/bundler_v1_deprecation_warning_on_pr_description branch from 1d93c23 to c7d7fa5 Compare August 7, 2024 23:22
@kbukum1 kbukum1 marked this pull request as ready for review August 8, 2024 00:38
@kbukum1 kbukum1 requested a review from a team as a code owner August 8, 2024 00:38
@kbukum1 kbukum1 force-pushed the kamil/bundler_v1_deprecation_warning_on_pr_description branch 3 times, most recently from 8ac3f05 to 5b24911 Compare August 9, 2024 23:57
added generating notices structure.
added generating deprecation and unsupported notices.
added deprecation warning as PR notice.
@kbukum1 kbukum1 force-pushed the kamil/bundler_v1_deprecation_warning_on_pr_description branch from 5b24911 to 81300b9 Compare August 10, 2024 00:05
Copy link
Member

@jakecoffman jakecoffman left a comment

Choose a reason for hiding this comment

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

So we're on the same page, at a high level, the way an update works is:

  1. FileFetcher
  2. FileParser
  3. For each dependency:
    a. UpdateChecker
    b. FileUpdater
  4. For each PR created: Gather PR body content

Of course this gets a little more complicated when multi-dir is involved. Because of multi-dir, I think having a single PackageManager that records the version is actually out of the question here. It's possible to have one directory be on a different version of the package manager than another.

So generally my thoughts for structuring this change:

  1. Move the existing ecosystem_version parsing to FileParser where it makes the most sense.
  2. Standardize on what they return (the PackageManager structure you have reconciled with what NPM already has)
  3. When processing a directory, POST to the ecosystem version endpoint, and if the version is not supported then skip the directory with a message
  4. Pass the directory's PackageManager into DependencySnapshot where it can tell the MessageBuilder to add the deprecation message.

UNSUPPORTED_BUNDLER_VERSIONS = T.let([].freeze, T::Array[String])
DEPRECATED_BUNDLER_VERSIONS = T.let(["1"].freeze, T::Array[String])

class PackageManager < PackageManagerBase
Copy link
Member

Choose a reason for hiding this comment

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

There's a PackageManager class under the NPM ecosystem that doesn't look much like this one. Are we going to reconcile the differences?

@@ -116,8 +118,19 @@ def conflicting_dependencies
)
end

sig { returns(PackageManagerBase) }
def package_manager
Copy link
Member

Choose a reason for hiding this comment

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

We already have a ecosystem_versions on the FileFetcher that we use to POST the ecosystem versions to the API to gather usage statistics.

We should either reuse that functionality or move it into the FileParser which might be the best place for it, and perhaps reconcile the differences between what they all return since they're all doing the same thing.

@@ -484,6 +484,64 @@ def self.helper_subprocess_bash_command(command:, stdin_data:, env:)
env_keys = env ? env.compact.map { |k, v| "#{k}=#{v}" }.join(" ") + " " : ""
"$ cd #{Dir.pwd} && echo \"#{escaped_stdin_data}\" | #{env_keys}#{command}"
end

sig do
Copy link
Member

Choose a reason for hiding this comment

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

These changes seem out of place in this file. It seems a more appropriate place would be in the PackageManagerBase or in the PullRequestCreator where most of the PR body generation exists.

@@ -209,8 +215,32 @@ def ignore_requirements
ignored_versions.flat_map { |req| requirement_class.requirements_array(req) }
end

sig { returns(T::Array[Notice]) }
Copy link
Member

Choose a reason for hiding this comment

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

Also seems out of place to have this plumbing in the UpdateChecker.

@kbukum1 kbukum1 marked this pull request as draft August 12, 2024 20:58
@kbukum1
Copy link
Contributor Author

kbukum1 commented Aug 16, 2024

The feature implemented in the following PR, #10421

@kbukum1 kbukum1 closed this Aug 16, 2024
@kbukum1 kbukum1 deleted the kamil/bundler_v1_deprecation_warning_on_pr_description branch August 22, 2024 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: ruby:bundler RubyGems via bundler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants