Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Auto Labeling v2.0 #542

Open
0x4007 opened this issue Jul 19, 2023 · 4 comments
Open

Auto Labeling v2.0 #542

0x4007 opened this issue Jul 19, 2023 · 4 comments

Comments

@0x4007
Copy link
Member

0x4007 commented Jul 19, 2023

Context

  • Default labels #506
  • you can see that I intentionally asked to only include repository wide in the config 1 2
  • In ubiquibot-config.yml we have a section that allows for repository-wide default labeling:
default-labels:
   - "Time: <1 Hour"
   - "Priority: 0 (Normal)"
   - "Test"

But I anticipate that the following input format will be the most useful and intuitive:

/default-labels "Time: <1 Hour" "Priority: 0 (Normal)"

I want to make it very clear that the above does the following:

  1. invokes the /default-labels handler
  2. implicit config selected on self (@pavlovcik)
  3. parses any strings as separate labels (in this case they are the Time: <1 Hour and Priority: 0 (Normal) labels
  4. CAN WORK WITH ANY ARBITRARY LABEL e.g. "QA" "UI/UX" "good first issue" "test label" "Priority: 5 (Emergency)" etc.

However if its a special label to assist with pricing/funding bounties (this means any Priority or Time labels only at this stage) due to @Draeieg's exploit vector I won't go into the details of here now, we MUST check the permissions level of the user the bot is facilitating AT THE TIME OF ISSUE CREATION.

For example:

  • User @pavlovcik is an admin role
  • OR billing_manager role
  • OR an admin called /allow set-priority true @pavlovcik AND /allow set-time true @pavlovcik

User @pavlovcik can configure their default-labels to be anything, including the forbidden labels BUT WHEN THE ISSUE IS CREATED THE BOT VERIFIES IF THEY HAVE THE AUTHORIZATION TO SET THOSE LABELS. If they do not have the authorization to set those labels, the bot should notify them in a comment. The bot should automatically add whatever label they do have authorization to add though.

Intention

Primarily I thought it could be useful for team members who write a lot of issues (me) especially if I know im going to be drafting up a ton of issues of a certain type e.g. small UI enhancements

/default-labels` "UI/UX" "Time: <1 Hour" and "Priority: 1 (Medium)"
@rndquu
Copy link
Member

rndquu commented Jul 20, 2023

So this PR adds a new bot config param default-labels. When a new issue is created by any user those default labels from the default-labels param are added.

What should be done as a part of this issue:

  1. Add a new /default-labels commands which sets default labels per repository for the user who invoked the command.
    Example usage:
/default-labels "Time: <1 Hour" "Priority: 0 (Normal)"

Default labels set by the /default-labels command should be saved to a DB. When user creates a new issue, then if he has default labels in a DB then default labels from the DB are added, else labels from the bot's config are added.

  1. If the Time or Priority label is going to be added on issue creation as the default label then we should check user's permission. We should allow setting Time or Priority default labels for users who
  • has admin repository permission
  • has permission to set Priority or Time labels. In other words if admin invoked /allow set-priority @pavlovcik true or /allow set-time @pavlovcik true in the past.
    If user doesn't have permissions to add any of the default labels the bot should show an error message similar to You don't have permission to set "Priority" label.

@wannacfuture
Copy link
Contributor

wannacfuture commented Jul 21, 2023

What about price label?
Should /default-labels handler accept price label param?
Or seems the bot should calc the price and add the appropriate price label to an issue when the default labels are added.

@rndquu
Copy link
Member

rndquu commented Jul 22, 2023

What about price label? Should /default-labels handler accept price label param? Or seems the bot should calc the price and add the appropriate price label to an issue when the default labels are added.

I guess for the Price label the same rules apply as for Priority and Time labels

If a default Price label is going to be added then check that user has admin repo permissions or /allow set-priority @user true was called in the past by one of the admins. So if Price tag is added as a default label then no need to calculate price based on Time and Priority labels. Need @pavlovcik confirmation

@0x4007
Copy link
Member Author

0x4007 commented Jul 22, 2023

Correct @rndquu

If the price label is set then it should take precedence. I didn't know this feature was implemented already.

Otherwise the price should be calculated by priority and time estimate labels.

@0x4007 0x4007 added ping and removed ping labels Aug 9, 2023
@0x4007 0x4007 added ping and removed ping labels Aug 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants