@sentry/junior-github 0.286.0 → 0.288.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221,7 +221,7 @@ function gitHubPullRequestEventGuidance(guidance) {
221
221
  var MERGE_STATE_CHECK = "Do not guess whether it can merge. Before you say anything about that, run `gh pr view NUMBER --repo OWNER/REPO --json autoMergeRequest,mergeStateStatus,reviewDecision,baseRefName --jq '{autoMerge: (.autoMergeRequest != null), mergeStateStatus, reviewDecision, baseRefName}'` and `gh pr checks NUMBER --repo OWNER/REPO --required`. If it prints \"no required checks reported\", the required checks may not have started on the latest commit yet. It does not mean that none are required. If auto-merge is on and only required checks remain, say only that it merges when they pass. If GitHub blocks it for another reason, run `gh api repos/OWNER/REPO/rules/branches/BASE` and name the rule that blocks it. Do not say that you did not merge it.";
222
222
  var GITHUB_PULL_REQUEST_OUTCOME_GUIDANCE = {
223
223
  "pull_request.review.approved": `Mention each person in People involved, or the person who asked for the pull request if that line is missing. Say who approved it and link it. Do not merge it unless asked. ${MERGE_STATE_CHECK}`,
224
- "pull_request.merged": `${STACK_CHECK} If open pull requests in the stack remain above it and Junior pushed their branches, restack them before you reply. Do not ask first. Run \`gh stack checkout NUMBER\` with the lowest open pull request, then \`gh stack sync\`. If sync reports a conflict, ${STACK_CONFLICT_STEPS} Then mention each person in People involved, or the person who asked for the pull request if that line is missing. Say that it merged and link it. When you restacked, say so in the same reply.`
224
+ "pull_request.merged": "Mention each person in People involved, or the person who asked for the pull request if that line is missing. Say that it merged and link it."
225
225
  };
226
226
  function gitHubPullRequestCreateWatch(config) {
227
227
  const outcomeEvents = Object.keys(
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ import {
59
59
  readGrantPermissions,
60
60
  requireEnv,
61
61
  resolveUserAccount
62
- } from "./chunk-XOE6HDSA.js";
62
+ } from "./chunk-RRID5LSH.js";
63
63
 
64
64
  // src/tool-support/attribution.ts
65
65
  import * as z from "zod";
@@ -4027,23 +4027,17 @@ function pullRequestRefs(events) {
4027
4027
  }
4028
4028
  return [...refs.values()];
4029
4029
  }
4030
- async function hasMatch(hasMatchEvent, ref) {
4031
- for (const event of gitHubMergeConflictEvents(ref)) {
4032
- if (await hasMatchEvent(event)) return true;
4033
- }
4034
- return false;
4035
- }
4036
4030
  function deliveredPullRequest(payload, ref) {
4037
4031
  const parsed = z26.object({ pull_request: pullRequestSchema3 }).safeParse(payload);
4038
4032
  const pullRequest = parsed.success ? parsed.data.pull_request : void 0;
4039
4033
  return pullRequest?.number === ref.number && typeof pullRequest.mergeable === "boolean" ? pullRequest : void 0;
4040
4034
  }
4041
4035
  async function loadGitHubMergeConflictEvents(args) {
4042
- const { hasMatch: hasMatchEvent, loadPullRequest: loadPullRequest2 } = args;
4043
- if (!hasMatchEvent || !loadPullRequest2) return [];
4036
+ const { hasMatch, loadPullRequest: loadPullRequest2 } = args;
4037
+ if (!hasMatch || !loadPullRequest2) return [];
4044
4038
  const conflicts = [];
4045
4039
  for (const ref of pullRequestRefs(args.events)) {
4046
- if (!await hasMatch(hasMatchEvent, ref)) continue;
4040
+ if (!await hasMatch(gitHubMergeConflictEvents(ref))) continue;
4047
4041
  try {
4048
4042
  const loaded = deliveredPullRequest(args.pullRequestPayload, ref) ?? pullRequestSchema3.parse(await loadPullRequest2(ref));
4049
4043
  if (loaded.state !== "open" || loaded.mergeable !== false || loaded.mergeable_state !== "dirty") {
@@ -4499,12 +4493,10 @@ async function withGitHubPullRequestMatchData(args) {
4499
4493
  );
4500
4494
  const events = filtered.size > 0 ? await withLookups(context, args.events, filtered) : args.events;
4501
4495
  const rest = new Set(ALL_LOOKUPS.filter((lookup) => !filtered.has(lookup)));
4502
- const { hasMatch: hasMatch2 } = args;
4503
- if (rest.size === 0 || !hasMatch2) return events;
4504
- const matches = await Promise.all(
4505
- events.filter((event) => numbers.has(event.eventKey)).map((event) => hasMatch2(event))
4506
- );
4507
- if (!matches.some(Boolean)) return events;
4496
+ const { hasMatch } = args;
4497
+ if (rest.size === 0 || !hasMatch) return events;
4498
+ const matchEvents = events.filter((event) => numbers.has(event.eventKey));
4499
+ if (!await hasMatch(matchEvents)) return events;
4508
4500
  return await withLookups(context, events, rest);
4509
4501
  }
4510
4502
 
@@ -4606,18 +4598,15 @@ async function loadGitHubPullRequestAuthors(args) {
4606
4598
  return [...authors.values()].slice(0, MAX_PEOPLE);
4607
4599
  }
4608
4600
  async function withGitHubPullRequestPeople(args) {
4609
- const { hasMatch: hasMatch2 } = args;
4601
+ const { hasMatch } = args;
4610
4602
  const peopleEvents = args.events.filter(
4611
4603
  (event) => PEOPLE_EVENTS.has(event.eventType)
4612
4604
  );
4613
4605
  const parsed = webhookSchema2.safeParse(args.body);
4614
- if (peopleEvents.length === 0 || !hasMatch2 || !args.load || !parsed.success) {
4606
+ if (peopleEvents.length === 0 || !hasMatch || !args.load || !parsed.success) {
4615
4607
  return args.events;
4616
4608
  }
4617
- const matches = await Promise.all(
4618
- peopleEvents.map((event) => hasMatch2(event))
4619
- );
4620
- if (!matches.some(Boolean)) return args.events;
4609
+ if (!await hasMatch(peopleEvents)) return args.events;
4621
4610
  const { pull_request: pullRequest, repository: repository2 } = parsed.data;
4622
4611
  const target = {
4623
4612
  logins: [
@@ -4836,7 +4825,7 @@ function createGitHubWebhookRoute(args) {
4836
4825
  log: args.log,
4837
4826
  privateKeyEnv: args.privateKeyEnv
4838
4827
  }) : void 0;
4839
- const hasMatch2 = args.events.hasMatch;
4828
+ const hasMatch = args.events.hasMatch;
4840
4829
  const commitPages = args.loadPullRequestCommitPages ? shareCommitPages(args.loadPullRequestCommitPages) : void 0;
4841
4830
  const events = await withGitHubPullRequestPeople({
4842
4831
  body,
@@ -4853,7 +4842,7 @@ function createGitHubWebhookRoute(args) {
4853
4842
  deliveryId,
4854
4843
  eventName
4855
4844
  }),
4856
- hasMatch: hasMatch2,
4845
+ hasMatch,
4857
4846
  ...commitPages ? {
4858
4847
  loadAuthors: async (target) => await loadGitHubPullRequestAuthors({
4859
4848
  loadPage: commitPages(target)
@@ -4864,7 +4853,7 @@ function createGitHubWebhookRoute(args) {
4864
4853
  log: args.log,
4865
4854
  neededMatchKeys: args.events.neededMatchKeys
4866
4855
  }),
4867
- hasMatch: hasMatch2,
4856
+ hasMatch,
4868
4857
  ...commitPages ? {
4869
4858
  load: async (target) => await loadGitHubPullRequestPeople({
4870
4859
  logins: target.logins,
@@ -4874,9 +4863,7 @@ function createGitHubWebhookRoute(args) {
4874
4863
  log: args.log
4875
4864
  });
4876
4865
  const feedbackTarget = pullRequestFeedbackTarget(events);
4877
- const feedbackHasMatch = feedbackTarget && hasMatch2 ? (await Promise.all(events.map((event) => hasMatch2(event)))).some(
4878
- Boolean
4879
- ) : false;
4866
+ const feedbackHasMatch = feedbackTarget && hasMatch ? await hasMatch(events) : false;
4880
4867
  if (feedbackTarget && feedbackHasMatch) {
4881
4868
  try {
4882
4869
  await args.markFeedbackReviewing(feedbackTarget);
@@ -4893,7 +4880,7 @@ function createGitHubWebhookRoute(args) {
4893
4880
  ...await loadGitHubMergeConflictEvents({
4894
4881
  deliveryId,
4895
4882
  events,
4896
- hasMatch: hasMatch2,
4883
+ hasMatch,
4897
4884
  loadPullRequest: args.loadPullRequest,
4898
4885
  log: args.log,
4899
4886
  pullRequestPayload: eventName === "pull_request" ? body : void 0
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeGitHubEvents
3
- } from "./chunk-XOE6HDSA.js";
3
+ } from "./chunk-RRID5LSH.js";
4
4
  export {
5
5
  normalizeGitHubEvents
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.286.0",
3
+ "version": "0.288.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,7 +32,7 @@
32
32
  "drizzle-orm": "^0.45.2",
33
33
  "marked": "^18.1.2",
34
34
  "zod": "^4.5.4",
35
- "@sentry/junior-plugin-api": "0.286.0"
35
+ "@sentry/junior-plugin-api": "0.288.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@oxlint/plugins": "1.79.0",
@@ -11,7 +11,7 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
11
11
  - Treat shallow clones as inspection checkouts; deepen before history work; never force-push around missing ancestry.
12
12
  - Install dependencies with the lockfile frozen mode before verification when needed.
13
13
  - Finish every code change with a pushed PR, without asking, unless the user opts out or asked for investigation only. Open it ready when work and checks are done; open a draft when work, checks, or decisions remain. An open scope question goes in the PR body, not in a stop.
14
- - After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this, except in a stack: a stack merges only with a linear history, so stacked PRs restack with `gh stack`. When a stacked PR merges, restack the open PRs above it, because GitHub sends them no event when its own rebase stops at a conflict. GitHub sends no event for a new conflict, and conflicted PRs get no new checks. The plugin publishes `pull_request.merge_conflict` for a watched PR only when another webhook event arrives for it, so the post-push check stays.
14
+ - After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this, except in a stack: a stack merges only with a linear history, so stacked PRs restack with `gh stack`. GitHub sends no event for a new conflict, and conflicted PRs get no new checks. The plugin publishes `pull_request.merge_conflict` for a watched PR only when another webhook event arrives for it, so the post-push check stays.
15
15
  - Write conventional PR titles and short plain-English bodies; keep check results out of the PR body.
16
16
  - Report exact validation and permission failures.
17
17
  - For 5xx, timeout, and connection failures, and for stalled or unexplained check failures, check GitHub status with `github_getStatus` (or the incidents on a `pull_request.checks.failed` event) before diagnosing. Report a matching incident as the likely cause; with no match, do not blame an outage.
@@ -51,4 +51,4 @@ Open this when making repository edits, not for read-only inspection.
51
51
 
52
52
  ## Follow
53
53
 
54
- When PR creation returns a subscribable hint, subscribe to suggested review/CI events. Fix routine review feedback and failed checks without a thread update. When a PR in a stack merges, restack the open PRs above it with `gh stack sync` before you reply; GitHub sends them no event when its own rebase stops at a conflict. Reply only when the requester needs to act, or when the PR merges or closes.
54
+ When PR creation returns a subscribable hint, subscribe to suggested review/CI events. Fix routine review feedback and failed checks without a thread update. Reply only when the requester needs to act, or when the PR merges or closes.