Skip to content

Comments

Support new Nexus OSS versions for --skip-existing argument logic#10603

Merged
radoering merged 2 commits intopython-poetry:mainfrom
kisev:fix-publish-skip-existing-logic
Nov 1, 2025
Merged

Support new Nexus OSS versions for --skip-existing argument logic#10603
radoering merged 2 commits intopython-poetry:mainfrom
kisev:fix-publish-skip-existing-logic

Conversation

@kisev
Copy link
Contributor

@kisev kisev commented Oct 29, 2025

Pull Request Check List

Resolves: #10602

  • Added tests for changed code.
  • Updated documentation for changed code.

Summary by Sourcery

Enhancements:

  • Treat HTTP 400 responses containing "cannot be updated" as file-exists errors

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 29, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR extends the _is_file_exists_error method’s conditional checks to recognize the new ‘cannot be updated’ message from newer Nexus OSS versions, ensuring the --skip-existing flag correctly skips uploads for these errors.

Class diagram for updated _is_file_exists_error method logic

classDiagram
class Uploader {
    _is_file_exists_error(response: requests.Response) bool
}
Uploader : +_is_file_exists_error checks for
Uploader : - status == 400 and "already exist" in reason_and_text
Uploader : - status == 400 and "updating asset" in reason_and_text
Uploader : + status == 400 and "cannot be updated" in reason_and_text
Uploader : - status == 403 and "overwrite artifact" in reason_and_text
Uploader : - status == 403 and "overwrite artifact" in reason_and_text
Uploader : - status == 403 and "overwrite artifact" in reason_and_text
Loading

File-Level Changes

Change Details Files
Extend Nexus OSS error detection for skip-existing logic
  • Add condition to match ‘cannot be updated’ in error response text
src/poetry/publishing/uploader.py

Assessment against linked issues

Issue Objective Addressed Explanation
#10602 Update Poetry to recognize the '400 cannot be updated' error message from Nexus OSS as an indicator that the file already exists when using the --skip-existing flag.
#10602 Ensure that the new error message is supported without changing the handling of previously supported error messages.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider extracting these repetitive error-pattern checks into a centralized list or configuration so adding future cases like “cannot be updated” stays maintainable.
  • Update the _is_file_exists_error docstring (or add an inline comment) to note that Nexus OSS’s “cannot be updated” message is now handled by this logic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting these repetitive error-pattern checks into a centralized list or configuration so adding future cases like “cannot be updated” stays maintainable.
- Update the _is_file_exists_error docstring (or add an inline comment) to note that Nexus OSS’s “cannot be updated” message is now handled by this logic.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Member

@radoering radoering left a comment

Choose a reason for hiding this comment

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

Can you add a test with the full text here, please?

(409, ""),
(400, "File already exists"),
(400, "Repository does not allow updating assets"),
(403, "Not enough permissions to overwrite artifact"),
(400, "file name has already been taken"),

@radoering radoering force-pushed the fix-publish-skip-existing-logic branch from 6abc8d5 to 8ee51b1 Compare November 1, 2025 06:50
@radoering radoering enabled auto-merge (squash) November 1, 2025 06:51
@radoering radoering merged commit 08ff7d3 into python-poetry:main Nov 1, 2025
63 checks passed
@kisev kisev deleted the fix-publish-skip-existing-logic branch November 1, 2025 07:24
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poetry crashes when using poetry publish --skip-existing with Nexus OSS

2 participants