Skip to content

Conversation

@k-anshul
Copy link
Member

@k-anshul k-anshul commented Feb 5, 2026

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@k-anshul k-anshul self-assigned this Feb 5, 2026
if err != nil {
return err
if !ch.Interactive {
orgRole = "guest"
Copy link
Member Author

Choose a reason for hiding this comment

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

Not too sure about this.

addCmd.Flags().StringVar(&ch.Org, "org", ch.Org, "Organization")
addCmd.Flags().StringVar(&projectName, "project", "", "Project")
addCmd.Flags().StringVar(&group, "group", "", "User group")
addCmd.Flags().BoolVar(&autoInvite, "auto-invite", false, "Automatically invite the user to the organization if they are not already a member when adding to a group")
Copy link
Member Author

Choose a reason for hiding this comment

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

If required this can be removed as well and the default behaviour in non interactive mode can be to auto invite as well.

if !strings.Contains(err.Error(), "user is not a member of the org") {
return err
}
if !ch.Interactive {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm missing something, but the previous behavior kind of seems expected to me. What I mean is, adding a user to a group when they are not in the org is arguably a "mistake" – in interactive mode, we try to help the user to fix the mistake, but in non-interactive mode, it's okay to just tell them about the mistake.

To work around it, can't you just do it in two steps? Like:

# Step 1: Add to org
rill user add --email EMAIL --org ORG --interactive=false

# Step 2: Add to group
rill user add --email EMAIL --group GROUP --interactive=false

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I also suggested that as a workaround to Himadri.

But a question to consider, is it okay for commands to diverge in their interactive and non interactive behaviour ?

Copy link
Contributor

@begelundmuller begelundmuller Feb 9, 2026

Choose a reason for hiding this comment

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

Yeah it's definitely okay. Consider the example when there's a common user error (like here): in non-interactive mode, we should be strict and return the error, but in interactive mode, we have an opportunity to help the user to fix it.

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.

2 participants