Skip to content

test: cover empty tag sets when prompting for tenant tags - #624

Open
NickJosevski wants to merge 1 commit into
mainfrom
nj/fix-529
Open

test: cover empty tag sets when prompting for tenant tags#624
NickJosevski wants to merge 1 commit into
mainfrom
nj/fix-529

Conversation

@NickJosevski

@NickJosevski NickJosevski commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #529

Adding tests only

The reported bug is already fixed, incidentally, and this adds only the missing regression coverage. Close #529 without merging if you'd rather not carry the tests.

What was actually wrong

tenant create failed interactively with please provide options to select from on any space without usable tag sets. The old AskTags helper in pkg/cmd/tenant/create/create.go flattened every tag set into one list and always raised a survey.MultiSelect:

canonicalTagName := []string{}
for _, tagSet := range tagSets {
    for _, tag := range tagSet.Tags {
        canonicalTagName = append(canonicalTagName, tag.CanonicalTagName)
    }
}
err = ask(&survey.MultiSelect{Options: canonicalTagName, ...}, &tags)

With no tag sets — or only empty ones — Options is empty and surveyext/select.go rejects it.

Why it no longer reproduces

#548 (feat: Extend tag sets and add environment tags, Nov 2025) replaced AskTags with selectors.Tags, which iterates each tag set and skips the empty ones. That landed after the versions in the report (2.15.7 and 2.18.0), so the fix has been shipping since ~2.19.0.

🤖 Generated with Claude Code

`tenant create` used to fail interactively with "please provide options
to select from" on any space without usable tag sets. The old AskTags
helper flattened every tag set into one list and always raised a
MultiSelect, so an empty list aborted the prompt.

That helper was replaced by selectors.Tags in #548, which iterates each
tag set and skips the ones with no tags, so the reported failure no
longer occurs. Nothing covered that behaviour though, and the fix was
incidental rather than deliberate, so add regression tests for the
zero-tag-set, empty-single-select and empty-multi-select cases, plus an
empty tag set sitting alongside a populated one.

Fixes #529

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NickJosevski
NickJosevski marked this pull request as ready for review August 4, 2026 07:17
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.

tenant create command errors during interactive mode if there are no tag sets available

1 participant