Skip to content

feat: update 'collaborator' command to support read-only permission type#272

Merged
mwbrooks merged 11 commits into
mainfrom
evegeris-release-read-only-app-collabs
Nov 27, 2025
Merged

feat: update 'collaborator' command to support read-only permission type#272
mwbrooks merged 11 commits into
mainfrom
evegeris-release-read-only-app-collabs

Conversation

@vegeris

@vegeris vegeris commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

Summary

A while back we added support for setting some app collaborators as read-only for deployed apps but never released the experiment

Requirements

@vegeris vegeris changed the title feat: Unhide the read-only app collaborator setting feat: unhide read-only app collaborator setting Nov 20, 2025
Comment thread cmd/collaborators/add.go

// promptCollaboratorsAddPermissionPrompts gathers the collaborator permission
// from selection if the experiment allows
func promptCollaboratorsAddPermissionPrompts(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed the behaviour here: before when adding a new collaborator we required the permission type to be set, but I think we can default to 'owner' unless otherwise specified

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good!

Since we're now defaulting to the owner, we should update the description of the --permission-type to default to owner as well. I'll make a suggestion for that!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Comment thread cmd/collaborators/update.go Outdated
slackUser.PermissionType, err = promptCollaboratorPermissionSelection(ctx, clients)
if err != nil {
return err
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When updating an existing collaborator however, maybe it would make sense to prompt for the permission type rather than error out

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we choose to prompt, than we should handle non-TTY (no interactivity) as well. In that case, I think we would error when there is no flag value provided.

suggestion: Personally, I suggest we keep the error when the flag is not provided because it's been tested and works. If we switch to a prompt, I'd rather see it as a separate PR because it changes the functionality rather than simply unhides the experiment (purpose of this PR).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good; I'll flip this back to erroring out if the flag isn't provided. I'm fine with keeping that behaviour if the CLI team doesn't see adding the prompt as an enhancement to the user experience

@vegeris vegeris changed the title feat: unhide read-only app collaborator setting feat: release read-only-collaborators experiment Nov 20, 2025
@codecov

codecov Bot commented Nov 20, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.85%. Comparing base (f768cc2) to head (ea994f2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/collaborators/add.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
+ Coverage   64.73%   64.85%   +0.11%     
==========================================
  Files         213      213              
  Lines       17582    17550      -32     
==========================================
  Hits        11382    11382              
+ Misses       5134     5103      -31     
+ Partials     1066     1065       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vegeris vegeris marked this pull request as ready for review November 20, 2025 20:39
@vegeris vegeris requested review from a team as code owners November 20, 2025 20:39

@lukegalbraithrussell lukegalbraithrussell 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.

docs changes are good!

@vegeris vegeris requested review from mwbrooks and zimeg November 21, 2025 17:41
@mwbrooks mwbrooks self-assigned this Nov 26, 2025
@mwbrooks mwbrooks added enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment labels Nov 26, 2025
@mwbrooks mwbrooks added this to the Next Release milestone Nov 26, 2025

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙇🏻 Thanks for unhiding and releasing the read-only-collaborators experiment!

✏️ The majority of the changes look good.

  • I've left 2 suggestions that we should merge to display the --permission-type description consistent with other commands.
  • I've marked this as Request changes because I don't think we should introduce a prompt for permission types when updating collaborators. I'd a nice UX improvement, but it has a high risk of introducing bugs for non-interactivity environments. I'd rather see this added as a separate PR that we can review, test, and feel confident in.

Comment thread cmd/collaborators/add.go Outdated
Comment thread cmd/collaborators/add.go

// promptCollaboratorsAddPermissionPrompts gathers the collaborator permission
// from selection if the experiment allows
func promptCollaboratorsAddPermissionPrompts(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good!

Since we're now defaulting to the owner, we should update the description of the --permission-type to default to owner as well. I'll make a suggestion for that!

Comment thread cmd/collaborators/update.go Outdated
slackUser.PermissionType, err = promptCollaboratorPermissionSelection(ctx, clients)
if err != nil {
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we choose to prompt, than we should handle non-TTY (no interactivity) as well. In that case, I think we would error when there is no flag value provided.

suggestion: Personally, I suggest we keep the error when the flag is not provided because it's been tested and works. If we switch to a prompt, I'd rather see it as a separate PR because it changes the functionality rather than simply unhides the experiment (purpose of this PR).

Comment thread cmd/collaborators/update.go Outdated
Comment on lines +123 to +130
response, err := clients.IO.SelectPrompt(
ctx,
"Select a permission type",
permissionLabels,
iostreams.SelectPromptConfig{
Required: true,
},
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: I think this needs to be more robust. The iostreams.SelectPromptConfig should be bound to the flag and the flag, so that non-interactive environments can work properly with the prompt.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the prompt for now but will make note of this if we want to bring it back

Comment thread cmd/collaborators/update.go Outdated
vegeris and others added 4 commits November 26, 2025 19:28
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
case "reader":
return READER, nil
default:
return "", fmt.Errorf("invalid")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated this error message to be more specific

@vegeris vegeris requested a review from mwbrooks November 27, 2025 16:50
@mwbrooks mwbrooks changed the title feat: release read-only-collaborators experiment feat: update 'collaborator' command to support read-only permission type Nov 27, 2025

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✅ Thanks a bunch @vegeris for releasing this feature out of experimentation! 🚀

🧪 Manual tests and code review look good to me 👌🏻

@mwbrooks mwbrooks merged commit e20c404 into main Nov 27, 2025
8 checks passed
@mwbrooks mwbrooks deleted the evegeris-release-read-only-app-collabs branch November 27, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor Use on pull requests to describe the release version increment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants