Skip vnext issue creation for deprecated packages#47915
Open
l0lawrence wants to merge 6 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deprecated/inactive packages (Development Status :: 7 - Inactive) that still have a tests-weekly pipeline were getting next-* issues auto-created. Add a deprecation guard in create_vnext_issue that skips issue creation and closes any existing issue for inactive packages. Fixes Azure#39143 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the vnext issue automation in eng/tools/azure-sdk-tools to avoid auto-creating next-* GitHub issues for packages marked inactive/deprecated (via Development Status :: 7 - Inactive), and adds unit tests for the new behavior.
Changes:
- Added
is_package_deprecated()(backed byParsedSetup.from_path+is_package_active) to detect inactive packages. - Added an early-exit in
create_vnext_issue()to skip issue creation for inactive packages and close any existing vnext issue. - Added a new test module for the new helper and short-circuit behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| sdk/transcription/azure-ai-transcription/pyproject.toml | Flips verifytypes from false to true (appears unrelated to vnext issue creation behavior). |
| eng/tools/azure-sdk-tools/tests/test_vnext_issue_creator.py | Adds tests for the new deprecation/inactive package guard and helper. |
| eng/tools/azure-sdk-tools/gh_tools/vnext_issue_creator.py | Introduces inactive-package detection and short-circuit/close behavior in create_vnext_issue(). |
Comment on lines
+31
to
+34
| def is_package_deprecated(package_dir: str) -> bool: | ||
| """Returns True if the package is deprecated/inactive (e.g. carries the | ||
| 'Development Status :: 7 - Inactive' classifier). Deprecated packages should | ||
| not have vnext issues created against them.""" |
Comment on lines
+28
to
+31
| def test_is_package_deprecated(classifiers, expected_deprecated): | ||
| parsed = _FakeParsedSetup("azure-mgmt-fake", classifiers) | ||
| with mock.patch.object(vnext_issue_creator.ParsedSetup, "from_path", return_value=parsed): | ||
| assert vnext_issue_creator.is_package_deprecated("some/path") is expected_deprecated |
Comment on lines
+47
to
+48
| # No GitHub client should be constructed when short-circuiting on a deprecated package. | ||
| mock_github.assert_not_called() |
Comment on lines
+63
to
+64
| [tool.azure-sdk-build] | ||
| verifytypes = false | ||
| verifytypes = true |
Comment on lines
+1
to
+10
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from unittest import mock | ||
|
|
||
| import pytest | ||
|
|
||
| from gh_tools import vnext_issue_creator |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The dedup lookup filtered on creator=azure-sdk, but the automation now runs as the azure-sdk-automation[bot] GitHub App. That filter never matched the bot's existing issues, so a new duplicate was created on every run. Match issues from all known automation creators (azure-sdk and azure-sdk-automation[bot]) via a shared find_vnext_issues helper, update the newest existing issue, and close any older duplicates. close_vnext_issue now closes all matching duplicates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two related issues with the vnext (
next-*) issue automation ineng/tools/azure-sdk-tools/gh_tools/vnext_issue_creator.py:1. Issues created against deprecated packages
Deprecated/inactive packages (marked with
Development Status :: 7 - Inactive) that still have an existingtests-weeklypipeline were gettingnext-*(mypy/pyright/pylint/sphinx) issues auto-created against them. See #39143 (azure-mgmt-mixedreality). The only existing guard before creating a vnext issue wasis_typing_ignored, which does not account for deprecation status.2. Duplicate issues created every run
The dedup lookup filtered on
creator="azure-sdk", but the automation now runs as theazure-sdk-automation[bot]GitHub App. That filter never matched the bot's existing issues, so the "does an issue already exist?" check always came back empty and a brand new duplicate was created on every run (e.g. #47836 and #47839 forazure-ai-textanalytics).Fix
Deprecation guard
is_package_deprecated(package_dir)helper that reuses the repo's existingParsedSetup.from_path+is_package_activelogic (which honors theInactiveclassifier andENABLE_<PKG>overrides).create_vnext_issuethat, for deprecated packages, skips issue creation, closes any pre-existing vnext issue, and returns.This centrally covers all callers (
mypy.py,pylint.py,pyright.py,sphinx.py).Duplicate de-duplication
VNEXT_ISSUE_CREATORS = ["azure-sdk", "azure-sdk-automation[bot]"]and a sharedfind_vnext_issues()helper that matches open issues by label + title and creator login, across both automation identities. Filtering by creator (rather than title alone) still protects human-opened issues with the same title.create_vnext_issuenow updates the newest matching issue and closes older duplicates, converging on a single issue (so the existing duplicate pairs will self-heal on the next run).close_vnext_issuenow closes all matching duplicates, not just the first.Tests
Added
tests/test_vnext_issue_creator.py(10 tests, all passing):is_package_deprecatedacross classifier combinations + parse-failure fallback.create_vnext_issueshort-circuits and closes any existing issue for deprecated packages; still proceeds/creates issues for active packages.find_vnext_issuesmatches all automation creators and ignores human-opened / other-package issues.close_vnext_issuecloses all duplicates.create_vnext_issueupdates the newest issue and closes older duplicates.Black passes with the repo config (
eng/black-pyproject.toml).Fixes #39143