Skip to content

fix(no-ticket): treat an empty trailing OWNER/REPO part as not given - #550

Merged
cloudsmith-iduffy merged 5 commits into
masterfrom
iduffy/fix-empty-path-part
Oct 28, 2026
Merged

cloudsmith-iduffy merged 5 commits into
masterfrom
iduffy/fix-empty-path-part

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffy cloudsmith-iduffy commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Shell completion often leaves a trailing slash, so people run cloudsmith repos get myorg/. The CLI split that into myorg and an empty repo name, and then asked the API for a repository with no slug:

Before:

$ cloudsmith repos get myorg/
Getting list of repositories ... OK

Owner / Repository (Identifier) | Type   | Packages | Groups | Downloads | Size
None/None                       | Public | None     | None   | None      | None

The request was GET /repos/myorg//.

After:

$ cloudsmith repos get myorg/
Getting list of repositories ... OK

Owner / Repository (Identifier) | Type    | Packages | Groups | Downloads | Size
myorg/r1                        | Private | 1        | 1      | 0         | 0 B

The request is now GET /repos/myorg/, the same as repos get myorg.

The fix is in the shared validate_slashes validator. It now drops empty trailing parts that are optional. A required part that is empty still gives the usage error Individual values cannot be blank. validate_optional_owner_repo no longer passes allow_blank, so I removed that flag. This means an empty OWNER in front of a REPO, such as repos get /myrepo, is now a usage error. Before, the CLI dropped the repo name without a message and listed your own repositories.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

I checked every command that takes a path argument with an optional trailing part:

  • repos get / list repos (OWNER/REPO, both optional): this is the bug above. repos get with no argument, or /, still lists your own repositories.
  • metrics entitlements (OWNER[/REPO]): myorg/ used to give a usage error. Now it works the same as myorg.
  • push <format> targets with OWNER/REPO/DISTRO[/RELEASE]: o/r/ubuntu/ used to give a usage error. Now it works the same as o/r/ubuntu.
  • list packages, list entitlements, upstream, tags and the other OWNER/REPO[/...] commands have no optional parts. myorg/ still gives a usage error there.

🤖 Generated with Claude Code

`cloudsmith repos get myorg/` sent a request for a repository with an
empty name. The validator now drops empty optional trailing parts, so
the command lists the `myorg` namespace. An empty OWNER before a REPO
gives a usage error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 17:52
@cloudsmith-iduffy cloudsmith-iduffy added the breaking change Changes behaviour that scripts or users can depend on label Oct 24, 2026

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

🟢 Approval recommended

The focused change preserves required-component validation, matches affected callers, and includes regression coverage with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes shared path validation so an empty optional trailing component is treated as omitted, preventing requests with empty repository names.

Changes:

  • Drops empty optional trailing components while still rejecting blank required components.
  • Adds regression tests for trailing slashes, omitted paths, and invalid blank components.
  • Documents the behavior change in the changelog.
File Description
cloudsmith_cli/​cli/​validators.py Normalizes empty optional trailing components and removes allow_blank.
cloudsmith_cli/​cli/​tests/​test_validators.py Adds four focused path-validation regression tests.
CHANGELOG.md Explains trailing-slash handling and blank-owner rejection.

Review effort: Balanced

@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as ready for review October 24, 2026 18:00
@cloudsmith-iduffy
cloudsmith-iduffy requested a review from a team as a code owner October 24, 2026 18:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudsmith-iduffy
cloudsmith-iduffy enabled auto-merge (squash) October 28, 2026 13:54
@cloudsmith-iduffy

Copy link
Copy Markdown
Collaborator Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
auto-merge was automatically disabled October 28, 2026 14:02

Head branch was pushed to by a user without write access

* origin/master:
  fix(no-ticket): print a skipped API error one time in copy, move and resync (#552)
  fix(no-ticket): save credentials.ini with mode 0600 (#553)
  fix(no-ticket): keep credential-helper list running on a bad config file (#549)
  fix(no-ticket): show pnpm hosts when the pnpm launcher is missing (#554)

# Conflicts:
#	CHANGELOG.md
@cloudsmith-iduffy
cloudsmith-iduffy enabled auto-merge (squash) October 28, 2026 17:31
@cloudsmith-iduffy
cloudsmith-iduffy merged commit dc5fe84 into master Oct 28, 2026
19 checks passed
@cloudsmith-iduffy
cloudsmith-iduffy deleted the iduffy/fix-empty-path-part branch October 28, 2026 17:31
cloudsmith-iduffy added a commit that referenced this pull request Oct 28, 2026
* origin/master:
  fix(no-ticket): treat an empty trailing OWNER/REPO part as not given (#550)
  fix(no-ticket): print a skipped API error one time in copy, move and resync (#552)
  fix(no-ticket): save credentials.ini with mode 0600 (#553)
  fix(no-ticket): keep credential-helper list running on a bad config file (#549)
  fix(no-ticket): show pnpm hosts when the pnpm launcher is missing (#554)
  fix(no-ticket): read and write .npmrc as UTF-8 (#555)
  chore(no-ticket): pushing 1.30.1 release (#566)
  fix(no-ticket): bumping python runtime versions to expedited security patches (#565)

# Conflicts:
#	CHANGELOG.md
cloudsmith-iduffy added a commit that referenced this pull request Oct 28, 2026
* origin/master:
  fix(no-ticket): show the API error when mcp cannot load the API schema (#561)
  fix(no-ticket): treat an empty trailing OWNER/REPO part as not given (#550)
  fix(no-ticket): print a skipped API error one time in copy, move and resync (#552)
  fix(no-ticket): save credentials.ini with mode 0600 (#553)
  fix(no-ticket): keep credential-helper list running on a bad config file (#549)
  fix(no-ticket): show pnpm hosts when the pnpm launcher is missing (#554)
  fix(no-ticket): read and write .npmrc as UTF-8 (#555)
  chore(no-ticket): pushing 1.30.1 release (#566)
  fix(no-ticket): bumping python runtime versions to expedited security patches (#565)

# Conflicts:
#	CHANGELOG.md
cloudsmith-iduffy added a commit that referenced this pull request Oct 28, 2026
* origin/master:
  fix(no-ticket): show a clean error when the SAML IdP response is not a JSON object (#559)
  fix(no-ticket): show the API error when mcp cannot load the API schema (#561)
  fix(no-ticket): treat an empty trailing OWNER/REPO part as not given (#550)
  fix(no-ticket): print a skipped API error one time in copy, move and resync (#552)
  fix(no-ticket): save credentials.ini with mode 0600 (#553)
  fix(no-ticket): keep credential-helper list running on a bad config file (#549)
  fix(no-ticket): show pnpm hosts when the pnpm launcher is missing (#554)

# Conflicts:
#	CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Changes behaviour that scripts or users can depend on

Development

Successfully merging this pull request may close these issues.

4 participants