Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add waiting for labels to sdk repos #461

Merged
merged 6 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions src/brain/issueLabelHandler/followups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,43 @@ import * as Sentry from '@sentry/node';

import { isFromABot } from '@utils/isFromABot';

const REPOS_TO_TRACK_FOR_TRIAGE = new Set(['sentry', 'sentry-docs']);
const REPOS_TO_TRACK_FOR_FOLLOWUPS = new Set([
'sentry',
'sentry-docs',
'arroyo',
'cdc',
'craft',
'relay',
'responses',
'self-hosted',
'sentry-native',
'snuba',
'snuba-sdk',
'symbolic',
'symbolicator',
'test-ttt-simple',
'wal2json',

// Web team, T1
'sentry-javascript',
'sentry-python',
'sentry-php',
'sentry-laravel',
'sentry-symfony',
'sentry-ruby',

// Mobile team, T1
// https://www.notion.so/sentry/346452f21e7947b4bf515d5f3a4d497d?v=cad7f04cf9064e7483ab426a26d3923a
'sentry-cocoa',
'sentry-java',
'sentry-react-native',
'sentry-unity',
'sentry-dart',
'sentry-android-gradle-plugin',
'sentry-dotnet',
'sentry-dart-plugin',
'test-sentry-app',
]);
chadwhitacre marked this conversation as resolved.
Show resolved Hide resolved
import { ClientType } from '@/api/github/clientType';
import {
WAITING_FOR_COMMUNITY_LABEL,
Expand All @@ -16,8 +52,8 @@ import {
} from '@/utils/githubEventHelpers';
import { getClient } from '@api/github/getClient';

function isNotInARepoWeCareAboutForTriage(payload) {
return !REPOS_TO_TRACK_FOR_TRIAGE.has(payload.repository.name);
function isNotInARepoWeCareAboutForFollowups(payload) {
return !REPOS_TO_TRACK_FOR_FOLLOWUPS.has(payload.repository.name);
}

function isNotWaitingForCommunity(payload) {
Expand All @@ -40,7 +76,7 @@ export async function updateCommunityFollowups({
});

const reasonsToDoNothing = [
isNotInARepoWeCareAboutForTriage,
isNotInARepoWeCareAboutForFollowups,
isNotFromAnExternalOrGTMUser,
isNotWaitingForCommunity,
isFromABot,
Expand Down
29 changes: 29 additions & 0 deletions src/brain/issueLabelHandler/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,31 +227,42 @@ describe('issueLabelHandler', function () {
await createIssue();
expectUntriaged();
expectAdding();
expect(octokit.issues._labels).toContain(WAITING_FOR_PRODUCT_OWNER_LABEL);
});

it('adds `Status: Untriaged` for GTM users', async function () {
await createIssue(undefined, 'Troi');
expectUntriaged();
expectAdding();
expect(octokit.issues._labels).toContain(WAITING_FOR_PRODUCT_OWNER_LABEL);
});

it('skips adding `Status: Untriaged` in untracked repos', async function () {
await createIssue('other-repo');
expectTriaged();
expectNoAdding();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('skips adding `Status: Untriaged` when added during creation', async function () {
untriage();
await createIssue(undefined, 'Picard');
expectUntriaged();
expectNoAdding();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('skips adding `Status: Untriaged` for internal users', async function () {
await createIssue(undefined, 'Picard');
expectTriaged();
expectNoAdding();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

// removing
Expand All @@ -261,26 +272,38 @@ describe('issueLabelHandler', function () {
await addLabel('Cheeseburger Pie');
expectTriaged();
expectRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('skips removing `Status: Untriaged` when its not present', async function () {
await addLabel('Cheeseburger Pie');
expectTriaged();
expectNoRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('skips removing `Status: Untriaged` when adding `Status: Untriaged`', async function () {
untriage();
await addLabel(UNTRIAGED_LABEL);
expectUntriaged();
expectNoRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('skips removing `Status: Untriaged` in untracked repos', async function () {
untriage();
await addLabel('Cheeseburger Pie', 'other-repo');
expectUntriaged();
expectNoRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it('gracefully handles race with other remover of `Status: Untriaged`', async function () {
Expand All @@ -290,6 +313,9 @@ describe('issueLabelHandler', function () {
expectNoError();
expectTriaged();
expectRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});

it("doesn't handle non-404 errors when removing `Status: Untriaged`", async function () {
Expand All @@ -299,6 +325,9 @@ describe('issueLabelHandler', function () {
expectError(400);
expectUntriaged();
expectRemoval();
expect(octokit.issues._labels).not.toContain(
WAITING_FOR_PRODUCT_OWNER_LABEL
);
});
});

Expand Down
4 changes: 2 additions & 2 deletions src/brain/issueLabelHandler/triage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const REPOS_TO_TRACK_FOR_TRIAGE = new Set([
'sentry-dart-plugin',
]);
import { ClientType } from '@/api/github/clientType';
import { UNTRIAGED_LABEL } from '@/config';
import { UNTRIAGED_LABEL, WAITING_FOR_PRODUCT_OWNER_LABEL } from '@/config';
import { getClient } from '@api/github/getClient';

function isAlreadyUntriaged(payload) {
Expand Down Expand Up @@ -90,7 +90,7 @@ export async function markUntriaged({
owner,
repo: payload.repository.name,
issue_number: payload.issue.number,
labels: [UNTRIAGED_LABEL],
labels: [UNTRIAGED_LABEL, WAITING_FOR_PRODUCT_OWNER_LABEL],
});

tx.finish();
Expand Down