Skip to content

Match prereleases in remote ranges without mutating specifiers - #1438

Merged
gerrod3 merged 1 commit into
pulp:mainfrom
notatallshaw:fix/prerelease-remote-filters-20261019
Oct 20, 2026
Merged

gerrod3 merged 1 commit into
pulp:mainfrom
notatallshaw:fix/prerelease-remote-filters-20261019

Conversation

@notatallshaw

@notatallshaw notatallshaw commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

I plan to deprecate mutability of packaging's core objects to improve performance and hashability. This PR removes specifier mutation from Pulp's remote range filters ahead of that change.

A new __replace__ API will cover callers that need a modified copy in future versions of packaging. These filters don't need a copy: their include and exclude comparisons pass prereleases=True to contains(), keeping prerelease selection.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 26f34018-f895-4b56-89ee-9d82ca35262b
📥 Commits

Reviewing files that changed from the base of the PR and between 2a38248 and d052b8c.

📒 Files selected for processing: 2
  • CHANGES/+prerelease-range-filters.bugfix
  • pulp_python/app/utils.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dda9a343-b5ac-418e-b92b-b9fa45737308
📥 Commits

Reviewing files that changed from the base of the PR and between 2a38248 and 260ceef.

📒 Files selected for processing: 2
  • CHANGES/+prerelease-range-filters.bugfix
  • pulp_python/app/utils.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Remote include and exclude range filters now explicitly evaluate prerelease versions. The changelog records that matching prereleases are accepted without deprecation warnings.

Changes: Prerelease Range Filtering

Layer / File(s) Summary
Prerelease range evaluation
pulp_python/app/utils.py, CHANGES/+prerelease-range-filters.bugfix
Requirement parsing no longer sets each specifier’s prereleases flag. Include and exclude checks call contains(version, prereleases=True). The changelog records the change.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: gerrod3

Merge Risk: ⚪ Minimal · up to 260ce

Include and exclude ranges explicitly evaluate prerelease versions, with no identified behavior change outside those checks. No material merge risk is apparent.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: matching prereleases in remote ranges without mutating specifiers.
Description check Passed The description clearly explains the motivation and implementation. It omits the repository checklist and explicit changelog and test details, but it remains mostly complete and directly related to th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the motivation and implementation. It omits the repository checklist and explicit changelog and test details, but it remains mostly complete and directly related to the change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@notatallshaw
notatallshaw force-pushed the fix/prerelease-remote-filters-20261019 branch from 260ceef to d052b8c Compare October 19, 2026 20:15
@notatallshaw

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 49 minutes.

@notatallshaw

Copy link
Copy Markdown
Contributor Author

@coderabbitai The docstring-coverage warning refers to the previous commit. At d052b8c, both touched methods have docstrings. Does the warning still apply to the current head?

@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
git rev-parse HEAD
gh pr view 1438 --repo pulp/pulp_python --json headRefOid --jq '.headRefOid'
gh api repos/pulp/pulp_python/issues/1438/comments --paginate --jq '.[] | select(.user.login == "coderabbitai[bot]") | {created_at, body}'
ast-grep outline pulp_python/app/utils.py --match PackageIncludeFilter --view expanded
python - <<'PY'
import ast
from pathlib import Path
path = Path("pulp_python/app/utils.py")
source = path.read_text()
tree = ast.parse(source)
for cls in tree.body:
    if isinstance(cls, ast.ClassDef) and cls.name == "PackageIncludeFilter":
        for method in cls.body:
            if isinstance(method, (ast.FunctionDef, ast.AsyncFunctionDef)) and method.name in ("_parse_packages", "filter_release"):
                print(f"{path}: Line {method.lineno}: {cls.name}.{method.name}")
                print(f"Docstring: {ast.get_docstring(method)!r}")
PY
git show --format=fuller --stat d052b8c --

Length of output: 18650


@notatallshaw No. The docstring-coverage warning does not apply to the current head, d052b8c.

I verified that both touched methods in pulp_python/app/utils.py have docstrings:

  • PackageIncludeFilter._parse_packages — Line 668.
  • PackageIncludeFilter.filter_release — Line 695.

The displayed warning remains from the earlier review of 260ceef. The review of d052b8c was rate limited, so it did not refresh the check. No further docstring changes are needed for these methods. Thanks for clarifying.


✏️ Learnings added
Learnt from: notatallshaw
URL: https://github.com/pulp/pulp_python/pull/1438

Timestamp: 2026-10-19T20:19:31.402Z
Learning: In pulp/pulp_python, assess docstring-coverage warnings against the reviewed commit, not only the current PR head. At d052b8c, both touched Python methods, PackageIncludeFilter._parse_packages and PackageIncludeFilter.filter_release in pulp_python/app/utils.py, have docstrings. The displayed 50% warning came from the earlier review of 260ceef; the review of d052b8c was rate limited.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@gerrod3 gerrod3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making this proactive fix! Much appreciated!

@gerrod3
gerrod3 merged commit e28456f into pulp:main Oct 20, 2026
15 checks passed
@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.37: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.37/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backported as #1439

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.36: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.36/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backported as #1440

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.27: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.27/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backported as #1441

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.19: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.19/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backported as #1442

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.13: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply e28456f on top of patchback/backports/3.13/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backporting merged PR #1438 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    git remote add upstream https://github.com/pulp/pulp_python.git
    
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    git fetch upstream
    git checkout -b patchback/backports/3.13/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438 upstream/3.13
    
  4. Now, cherry-pick PR Match prereleases in remote ranges without mutating specifiers #1438 contents into that branch:
    git cherry-pick -x e28456fb25cf99178844947d2f30f755ab2661cb
    
    If it'll yell at you with something like fatal: Commit e28456fb25cf99178844947d2f30f755ab2661cb is a merge but no -m option was given., add -m 1 as follows instead:
    git cherry-pick -m1 -x e28456fb25cf99178844947d2f30f755ab2661cb
    
  5. At this point, you'll encounter some merge conflicts. You must
    resolve them in order to preserve the patch from PR Match prereleases in remote ranges without mutating specifiers #1438 as close to the
    original as possible.
  6. Once conflicts are resolved and git added, run:
    git cherry-pick --continue
    
  7. Push this branch to your fork on GitHub:
    git push origin patchback/backports/3.13/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438
    
  8. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.12: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply e28456f on top of patchback/backports/3.12/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backporting merged PR #1438 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    git remote add upstream https://github.com/pulp/pulp_python.git
    
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    git fetch upstream
    git checkout -b patchback/backports/3.12/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438 upstream/3.12
    
  4. Now, cherry-pick PR Match prereleases in remote ranges without mutating specifiers #1438 contents into that branch:
    git cherry-pick -x e28456fb25cf99178844947d2f30f755ab2661cb
    
    If it'll yell at you with something like fatal: Commit e28456fb25cf99178844947d2f30f755ab2661cb is a merge but no -m option was given., add -m 1 as follows instead:
    git cherry-pick -m1 -x e28456fb25cf99178844947d2f30f755ab2661cb
    
  5. At this point, you'll encounter some merge conflicts. You must
    resolve them in order to preserve the patch from PR Match prereleases in remote ranges without mutating specifiers #1438 as close to the
    original as possible.
  6. Once conflicts are resolved and git added, run:
    git cherry-pick --continue
    
  7. Push this branch to your fork on GitHub:
    git push origin patchback/backports/3.12/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438
    
  8. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Backport to 3.11: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply e28456f on top of patchback/backports/3.11/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438

Backporting merged PR #1438 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    git remote add upstream https://github.com/pulp/pulp_python.git
    
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    git fetch upstream
    git checkout -b patchback/backports/3.11/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438 upstream/3.11
    
  4. Now, cherry-pick PR Match prereleases in remote ranges without mutating specifiers #1438 contents into that branch:
    git cherry-pick -x e28456fb25cf99178844947d2f30f755ab2661cb
    
    If it'll yell at you with something like fatal: Commit e28456fb25cf99178844947d2f30f755ab2661cb is a merge but no -m option was given., add -m 1 as follows instead:
    git cherry-pick -m1 -x e28456fb25cf99178844947d2f30f755ab2661cb
    
  5. At this point, you'll encounter some merge conflicts. You must
    resolve them in order to preserve the patch from PR Match prereleases in remote ranges without mutating specifiers #1438 as close to the
    original as possible.
  6. Once conflicts are resolved and git added, run:
    git cherry-pick --continue
    
  7. Push this branch to your fork on GitHub:
    git push origin patchback/backports/3.11/e28456fb25cf99178844947d2f30f755ab2661cb/pr-1438
    
  8. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants