Skip to content

Account for `@` prefix when comparing usernames for verification

Dominic Bauer requested to merge fix-avoid-reassignment-for-verification into master

What does this MR do and why?

Fixes !1672 (merged), which does not work as intended.

/company/team/team.yml contains usernames without @ prefix. But AssignDevForVerification#UNASSIGNMENT_BODY_REGEXP includes the @ in its matcher group.

This causes the comparison username == except to never hold:

# https://gitlab.com/gitlab-org/quality/triage-ops/-/blob/1e65213e9f9b9c0f25368e0e10372a7ce18cfbeb/lib/team_member_select_helper.rb#L115
def select_team_member_usernames(include_unavailable: true, include_ooo: true, except: nil)
  WwwGitLabCom.team_from_www.each_with_object([]) do |(username, data), memo|
    next if !include_unavailable && unavailable?(username)

    next if !include_ooo && out_of_office?(username)

    # except is prefixed, username is not
    next if username == except

    memo << "@#{username}" if yield(data)
  end
end

Expected impact & dry-runs

n/a

See https://gitlab.com/gitlab-org/quality/triage-ops/-/tree/master/doc/scheduled#testing-with-a-dry-run on how to perform dry-runs.

Action items

  • (If applicable) Add documentation to the handbook pages for Triage Operations =>
  • (If applicable) Identify the affected groups and how to communicate to them:
    • /cc @person_or_group =>
    • Relevant Slack channels =>
    • Engineering week-in-review
Edited by Dominic Bauer

Merge request reports