Skip to content

fix: metadata enum update#298

Open
BartoszBlizniak wants to merge 2 commits into
masterfrom
fix/metadata-list-filter-enums
Open

fix: metadata enum update#298
BartoszBlizniak wants to merge 2 commits into
masterfrom
fix/metadata-list-filter-enums

Conversation

@BartoszBlizniak
Copy link
Copy Markdown
Member

Description

Fix cloudsmith metadata list filters. The CLI converted --source-kind / --classification to integers, but the v2 API's EnumFieldV2 accepts only the lowercased enum name, so every filtered list returned HTTP 400.
This drops the stale client-side enum int-maps and normalisers, sends the lowercased name, and lets the backend validate it.

Type of Change

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

Additional Notes

  • Root cause: the contract changed after the CLI shipped (v1.17.0). Backend #15294 (2026-05-05) switched the list filter from IntegerField to EnumFieldV2 (name-only); #15489 (2026-05-20) renamed the enums (ECOSYSTEM→UPSTREAM, CUSTOMER→CUSTOM) and reindexed classifications. The CLI's maps matched the backend exactly when written, then drifted — not an original implementation error.

@BartoszBlizniak BartoszBlizniak requested a review from a team as a code owner June 4, 2026 11:27
Copilot AI review requested due to automatic review settings June 4, 2026 11:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes cloudsmith metadata list filtering against the v2 API by sending enum values as lowercased names (instead of legacy client-side integer mappings), aligning the CLI with the backend’s EnumFieldV2 contract and avoiding HTTP 400s on filtered list calls.

Changes:

  • Removed stale enum int-maps/normalizers and updated the metadata API client to lowercase string filter values before sending.
  • Updated CLI command help/tests to reflect name-based filters and to stop client-side validation of filter values.
  • Added a changelog entry documenting the behavioral fix.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
cloudsmith_cli/core/api/metadata.py Drops integer normalization and sends lowercased enum names as query params.
cloudsmith_cli/core/tests/test_metadata.py Updates tests for name-based filters and backend-driven validation behavior.
cloudsmith_cli/cli/commands/metadata.py Removes client-side validation and updates CLI help text for filters.
cloudsmith_cli/cli/tests/commands/test_metadata.py Updates CLI tests to pass through name-based filters and unknown names.
CHANGELOG.md Documents the fix to metadata list filtering behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith_cli/core/api/metadata.py Outdated
Comment thread CHANGELOG.md Outdated
Comment thread cloudsmith_cli/core/tests/test_metadata.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants