Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
73 changes: 69 additions & 4 deletions .github/REVIEWERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# code owner team as soon as a PR opens, before the workflow requests anyone,
# so the whole team gets notified.
#
# Last match wins. Files with no rule (CI, scripts, root config, shared test
# utils, most of packages/core) fall back to @getsentry/team-javascript-sdks.
# Last match wins. A rule prefixed with `+` doesn't replace that match but adds
# its owners on top of it, wherever it sits in the file. Files with no rule (CI,
# scripts, root config, shared test utils, most of packages/core) fall back to
# @getsentry/team-javascript-sdks plus the contractors listed in
# scripts/junior-requesters.mjs.
# Don't add a catch-all `*` rule: it would put the whole team in the codeowner
# pool of every PR and dilute the routing below.

Expand All @@ -26,9 +29,9 @@
/dev-packages/e2e-tests/test-applications/webpack-*/ @getsentry/team-javascript-sdks-browser

# Node/server runtimes and related packages
/packages/node/ @getsentry/team-javascript-sdks-server
/packages/node/ @getsentry/team-javascript-sdks-server @timfish
/packages/server-runtime-injection/ @getsentry/team-javascript-sdks-server
/packages/server-utils/ @getsentry/team-javascript-sdks-server
/packages/server-utils/ @getsentry/team-javascript-sdks-server @timfish
/packages/node-native/ @getsentry/team-javascript-sdks-server
/packages/profiling-node/ @getsentry/team-javascript-sdks-server
/packages/opentelemetry/ @getsentry/team-javascript-sdks-server
Expand All @@ -54,6 +57,14 @@
/dev-packages/e2e-tests/test-applications/tsx-express/ @getsentry/team-javascript-sdks-server
/dev-packages/e2e-tests/test-applications/gen-ai-libraries/ @getsentry/team-javascript-sdks-server

# Bundler plugins
/packages/bundler-plugins/ @getsentry/team-javascript-sdks-framework @timfish
/packages/esbuild-plugin/ @getsentry/team-javascript-sdks-framework @timfish
/packages/rollup-plugin/ @getsentry/team-javascript-sdks-framework @timfish
/packages/vite-plugin/ @getsentry/team-javascript-sdks-framework @timfish
/packages/webpack-plugin/ @getsentry/team-javascript-sdks-framework @timfish
/dev-packages/bundler-plugin-integration-tests/ @getsentry/team-javascript-sdks-framework @timfish

# Framework integration packages
/packages/angular/ @getsentry/team-javascript-sdks-framework
/packages/astro/ @getsentry/team-javascript-sdks-framework
Expand Down Expand Up @@ -94,3 +105,57 @@
/dev-packages/e2e-tests/test-applications/tanstack*/ @getsentry/team-javascript-sdks-framework
/dev-packages/e2e-tests/test-applications/vinext-*/ @getsentry/team-javascript-sdks-framework
/dev-packages/e2e-tests/test-applications/vue-*/ @getsentry/team-javascript-sdks-framework

# AI integrations, on top of the owners above
+/packages/server-utils/src/ai/ @RulaKhaled
+/packages/server-utils/test/ai/ @RulaKhaled
+/packages/server-utils/*/integrations/anthropic* @RulaKhaled
+/packages/server-utils/*/integrations/flue* @RulaKhaled
+/packages/server-utils/*/integrations/google-genai* @RulaKhaled
+/packages/server-utils/*/integrations/groq* @RulaKhaled
+/packages/server-utils/*/integrations/langchain* @RulaKhaled
+/packages/server-utils/*/integrations/langgraph* @RulaKhaled
+/packages/server-utils/*/integrations/mastra* @RulaKhaled
+/packages/server-utils/*/integrations/mistral* @RulaKhaled
+/packages/server-utils/*/integrations/openai* @RulaKhaled
+/packages/server-utils/*/integrations/pi-* @RulaKhaled
+/packages/server-utils/*/integrations/together-ai* @RulaKhaled
+/packages/server-utils/*/integrations/typesafe* @RulaKhaled
+/packages/server-utils/*/integrations/vercel-ai/ @RulaKhaled
+/packages/server-utils/*/integrations/aws-sdk/services/bedrock-runtime* @RulaKhaled
+/packages/server-utils/src/orchestrion/config/openai-compatible.ts @RulaKhaled
+/packages/cloudflare/src/instrumentations/agents/ @RulaKhaled
+/packages/core/src/integrations/mcp-server/ @RulaKhaled
+/packages/core/src/integrations/conversationId.ts @RulaKhaled
+/packages/core/src/tracing/spans/extractGenAiSpans.ts @RulaKhaled
+/packages/core/test/lib/tracing/spans/extractGenAiSpans.test.ts @RulaKhaled
+/packages/core/src/utils/ai/ @RulaKhaled
+/packages/core/test/lib/utils/ai/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/anthropic/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/flue/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/google-genai/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/groq/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/langchain/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/langgraph/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/mastra/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/mcp-server/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/mistral/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/openai/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/pi-ai/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/pi-durable/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/together-ai/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/typesafe/ @RulaKhaled
+/dev-packages/node-integration-tests/suites/tracing/vercelai/ @RulaKhaled
+/dev-packages/cloudflare-integration-tests/suites/tracing/google-genai/ @RulaKhaled
+/dev-packages/cloudflare-integration-tests/suites/tracing/langchain/ @RulaKhaled
+/dev-packages/cloudflare-integration-tests/suites/tracing/langgraph/ @RulaKhaled
+/dev-packages/cloudflare-integration-tests/suites/tracing/openai/ @RulaKhaled
+/dev-packages/cloudflare-integration-tests/suites/tracing/workers-ai/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/gen-ai-libraries/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/node-openai-decisions/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/node-mastra/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/cloudflare-mastra/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/cloudflare-vercelai-v7/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/*nextjs*/app/ai-*/ @RulaKhaled
+/dev-packages/e2e-tests/test-applications/*nextjs*/app/api/openai/ @RulaKhaled
+/.agents/skills/add-ai-integration/ @RulaKhaled
48 changes: 48 additions & 0 deletions scripts/assign-reviewers-owners.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { describe, expect, it } from 'vitest';

import { getOwnersForFiles, parseCodeowners } from './assign-reviewers.mjs';

const CODEOWNERS = `
# comment
/packages/browser/ @getsentry/browser
/packages/node/ @getsentry/server
/packages/node/src/x.ts @someone
*.md @getsentry/docs
+/packages/node/src/ai/ @ai-expert
+/packages/core/src/ai/ @ai-expert
`;

describe('getOwnersForFiles', () => {
const rules = parseCodeowners(CODEOWNERS);

it('collects owners across all touched files', () => {
expect(getOwnersForFiles(rules, ['packages/browser/src/index.ts', 'packages/node/src/sdk.ts'])).toEqual([
'@getsentry/browser',
'@getsentry/server',
]);
});

it('uses the last matching rule for a file', () => {
expect(getOwnersForFiles(rules, ['packages/node/src/x.ts'])).toEqual(['@someone']);
});

it('matches unanchored patterns at any depth', () => {
expect(getOwnersForFiles(rules, ['packages/node/README.md'])).toEqual(['@getsentry/docs']);
});

it('adds the owners of `+` rules on top of the winning rule', () => {
expect(getOwnersForFiles(rules, ['packages/node/src/ai/openai.ts'])).toEqual(['@getsentry/server', '@ai-expert']);
});

it('does not let a later `+` rule replace the winning rule', () => {
expect(getOwnersForFiles(rules, ['packages/node/src/ai/README.md'])).toEqual(['@getsentry/docs', '@ai-expert']);
});

it('uses only the `+` rule owners when no other rule matches', () => {
expect(getOwnersForFiles(rules, ['packages/core/src/ai/utils.ts'])).toEqual(['@ai-expert']);
});

it('does not match sibling directories that share a prefix', () => {
expect(getOwnersForFiles(rules, ['packages/browser-utils/src/index.ts', 'packages/nodejs/a.ts'])).toEqual([]);
});
});
26 changes: 17 additions & 9 deletions scripts/assign-reviewers.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';

import { getJuniorRequesters, TEAM_SLUG } from './junior-requesters.mjs';
import { CONTRACTORS, getJuniorRequesters, TEAM_SLUG } from './junior-requesters.mjs';

const REQUIRED_REVIEWERS = 3;
// Managers who are members of the SDK teams, but should never be auto-requested for review.
Expand Down Expand Up @@ -41,17 +41,24 @@ export function parseCodeowners(content) {
.map(line => line.trim())
.filter(line => line && !line.startsWith('#'))
.map(line => {
const [pattern, ...owners] = line.split(/\s+/);
return { regexp: patternToRegExp(pattern), owners };
const additive = line.startsWith('+');
const [pattern, ...owners] = line.replace(/^\+/, '').split(/\s+/);
return { regexp: patternToRegExp(pattern), owners, additive };
});
}

/** CODEOWNERS semantics: the last matching rule wins for each file. */
/**
* CODEOWNERS semantics: the last matching rule wins for each file. Rules prefixed with `+` are an extension: they
* never win, but add their owners on top of the winning rule.
*/
export function getOwnersForFiles(rules, files) {
const owners = new Set();
for (const file of files) {
const rule = rules.findLast(r => r.regexp.test(file));
rule?.owners.forEach(owner => owners.add(owner));
const matching = rules.filter(r => r.regexp.test(file));
const winner = matching.findLast(r => !r.additive);
for (const rule of [winner, ...matching.filter(r => r.additive)]) {
rule?.owners.forEach(owner => owners.add(owner));
}
}
return [...owners];
}
Expand All @@ -67,8 +74,9 @@ function shuffle(items) {

/**
* Picks reviewers to top the PR up to `REQUIRED_REVIEWERS`, preferring the codeowner pool and falling back
* to the whole team. Within a pool, people who were asked for the fewest reviews recently (`load`, keyed by
* lowercase login) go first, ties are broken randomly. Logins are compared case-insensitively, as GitHub does.
* to the whole team plus the contractors. Within a pool, people who were asked for the fewest reviews recently
* (`load`, keyed by lowercase login) go first, ties are broken randomly. Logins are compared case-insensitively,
* as GitHub does.
*/
export function pickReviewers({ existing, codeownerPool, teamPool, exclude, load = new Map() }) {
const taken = new Set([...existing, ...exclude].map(login => login.toLowerCase()));
Expand Down Expand Up @@ -245,7 +253,7 @@ export async function assignReviewers({ github, context, core }) {
}
}

const teamPool = await listTeamMembers(TEAM_SLUG);
const teamPool = [...(await listTeamMembers(TEAM_SLUG)), ...CONTRACTORS];
const busy = await getBusyLogins({ github, core, logins: [...codeownerPool, ...teamPool] });
const load = await getReviewLoad({ github, core, owner, repo });

Expand Down
73 changes: 29 additions & 44 deletions scripts/assign-reviewers.test.mjs
Original file line number Diff line number Diff line change
@@ -1,46 +1,8 @@
import { describe, expect, it, vi } from 'vitest';

import {
assignReviewers,
getBusyLogins,
getOwnersForFiles,
getReviewLoad,
parseCodeowners,
pickReviewers,
} from './assign-reviewers.mjs';
import { assignReviewers, getBusyLogins, getReviewLoad, pickReviewers } from './assign-reviewers.mjs';
import { attribution, junior, setup } from './github-test-utils.mjs';

const CODEOWNERS = `
# comment
/packages/browser/ @getsentry/browser
/packages/node/ @getsentry/server
/packages/node/src/x.ts @someone
*.md @getsentry/docs
`;

describe('getOwnersForFiles', () => {
const rules = parseCodeowners(CODEOWNERS);

it('collects owners across all touched files', () => {
expect(getOwnersForFiles(rules, ['packages/browser/src/index.ts', 'packages/node/src/sdk.ts'])).toEqual([
'@getsentry/browser',
'@getsentry/server',
]);
});

it('uses the last matching rule for a file', () => {
expect(getOwnersForFiles(rules, ['packages/node/src/x.ts'])).toEqual(['@someone']);
});

it('matches unanchored patterns at any depth', () => {
expect(getOwnersForFiles(rules, ['packages/node/README.md'])).toEqual(['@getsentry/docs']);
});

it('does not match sibling directories that share a prefix', () => {
expect(getOwnersForFiles(rules, ['packages/browser-utils/src/index.ts', 'packages/nodejs/a.ts'])).toEqual([]);
});
});

describe('pickReviewers', () => {
const teamPool = ['a', 'b', 'c', 'd', 'e', 'mydea'];

Expand Down Expand Up @@ -232,18 +194,31 @@ describe('assignReviewers', () => {
github.graphql.mockResolvedValue({ u0: { login: 'a', status: { indicatesLimitedAvailability: true } } });
await run();
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.arrayContaining(['b', 'c', 'd']) }),
expect.objectContaining({ reviewers: [expect.any(String), expect.any(String), expect.any(String)] }),
);
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.not.arrayContaining(['a']) }),
);
});

it('falls back to the contractors as well as the team', async () => {
const { github, run } = setup(assignReviewers, { user: { login: 'author', type: 'User' } });
const busy = login => ({ login, status: { indicatesLimitedAvailability: true } });
github.graphql.mockResolvedValue({ u0: busy('a'), u1: busy('b'), u2: busy('c') });
await run();
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.arrayContaining(['d', 'timfish', 'RulaKhaled']) }),
);
});

it('does not request a review from the requester of a Junior PR', async () => {
const { github, run } = setup(assignReviewers, { user: junior, body: attribution('**Alice Example**') });
await run();
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.arrayContaining(['b', 'c', 'd']) }),
expect.objectContaining({ reviewers: [expect.any(String), expect.any(String), expect.any(String)] }),
);
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.not.arrayContaining(['a']) }),
);
});

Expand All @@ -261,7 +236,11 @@ describe('assignReviewers', () => {
repository: {
pullRequests: {
pageInfo: { hasNextPage: false },
nodes: [pr(['a', 'b', 'c']), pr(['a', 'b']), pr(['a'])],
nodes: [
pr(['a', 'b', 'c', 'timfish', 'RulaKhaled']),
pr(['a', 'b', 'timfish', 'RulaKhaled']),
pr(['a', 'timfish', 'RulaKhaled']),
],
},
},
}
Expand Down Expand Up @@ -301,7 +280,10 @@ describe('assignReviewers', () => {
});
await run();
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.arrayContaining(['b', 'c', 'd']) }),
expect.objectContaining({ reviewers: [expect.any(String), expect.any(String), expect.any(String)] }),
);
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.not.arrayContaining(['a']) }),
);
});

Expand All @@ -315,7 +297,10 @@ describe('assignReviewers', () => {
);
await run();
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.arrayContaining(['b', 'c', 'd']) }),
expect.objectContaining({ reviewers: [expect.any(String), expect.any(String), expect.any(String)] }),
);
expect(github.rest.pulls.requestReviewers).toHaveBeenCalledWith(
expect.objectContaining({ reviewers: expect.not.arrayContaining(['a']) }),
);
});
});
2 changes: 2 additions & 0 deletions scripts/junior-requesters.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const TEAM_SLUG = 'team-javascript-sdks';
// Outside collaborators can't be members of a GitHub team, so contractors are listed here instead.
export const CONTRACTORS = ['timfish', 'RulaKhaled'];
export const JUNIOR_LOGIN = 'sentry-junior[bot]';
// Junior writes `via **Slack Name**` when the requester has no GitHub account linked in Junior. These people's
// GitHub profile name can't be matched to their Slack name.
Expand Down
4 changes: 1 addition & 3 deletions scripts/team-review-gate.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { getJuniorRequesters, JUNIOR_LOGIN, TEAM_SLUG } from './junior-requesters.mjs';
import { CONTRACTORS, getJuniorRequesters, JUNIOR_LOGIN, TEAM_SLUG } from './junior-requesters.mjs';

export const TEAM_REVIEW_LABEL = 'Waiting for: Team Review';
// Outside collaborators can't be members of a GitHub team, so contractors are listed here instead.
const CONTRACTORS = ['timfish', 'RulaKhaled'];
// Only the app that clears the label after a qualifying review may remove it.
const GITFLOW_APP_LOGIN = 'javascript-sdk-gitflow[bot]';

Expand Down
Loading