Skip to content

fix(registry): use RepositoryV2 displayer for list-v2 commands (#1797 / #1799) - #1925

Open
Kanika0306 wants to merge 3 commits into
digitalocean:mainfrom
Kanika0306:fix-registry-list-v2-displayer
Open

fix(registry): use RepositoryV2 displayer for list-v2 commands (#1797 / #1799)#1925
Kanika0306 wants to merge 3 commits into
digitalocean:mainfrom
Kanika0306:fix-registry-list-v2-displayer

Conversation

@Kanika0306

Copy link
Copy Markdown

Summary

Fixes #1797 and #1799.

The doctl registry repository list-v2 and doctl registries repository list-v2 commands were registered using displayerType(&displayers.Repository{}) (the V1 displayer) instead of displayerType(&displayers.RepositoryV2{}).

As a result:

  • The --format flag validation and help strings for list-v2 only recognized V1 columns (Name, LatestTag, TagCount, UpdatedAt) and rejected V2-specific columns like ManifestCount or LatestManifest.
  • Custom column formatting (e.g. --format Name,ManifestCount,UpdatedAt) failed column validation.

Additionally, overrideCmdNS(overrideNS) needed to be passed during CmdBuilder initialization so option execution correctly binds --format flags under the command's config namespace.

Changes Made

  • commands/registry.go:
    • Updated cmdListRepositoriesV2 in both doctl registry repository list-v2 and doctl registries repository list-v2 namespaces to use displayerType(&displayers.RepositoryV2{}) and overrideCmdNS(overrideNS).
  • commands/displayers/registry.go:
    • Corrected interface check assertion to var _ Displayable = &RepositoryV2{}.
  • commands/registry_test.go:
    • Added unit test assertions verifying command fmtCols matches RepositoryV2{}.Cols().
    • Added unit tests for custom --format options with V2 fields (Name, ManifestCount, LatestManifest, TagCount, LatestTag, UpdatedAt) across both registry and registries namespaces.
  • integration/registry_repo_list_v2_test.go & integration/registries_list_repositories_test.go:
    • Added integration test specs validating list-v2 --format Name,ManifestCount,UpdatedAt.
  • integration/database_firewall_*.go:
    • Updated expected integration headers to match the Description column output.

Verification

Ran unit tests and integration tests:

# Unit & Displayer tests
go test ./commands -run "Repository|Registries"
go test ./commands/displayers/...
# Output: OK (PASSED)

# Integration tests
go test ./integration -run "TestRun/doctl/registry|TestRun/doctl/registries|TestRun/doctl/database/firewalls"
# Output: OK (PASSED)

Copilot AI lite review requested due to automatic review settings August 24, 2026 19:27

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

registry repository list-v2 ignores --format and --no-header flags

2 participants