@sentry/junior-github 0.276.0 → 0.277.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.
- package/dist/{chunk-PCWKGWHE.js → chunk-IR7D5MR7.js} +30 -4
- package/dist/github-status.d.ts +16 -0
- package/dist/index.js +459 -341
- package/dist/pull-request-outcomes/store.d.ts +7 -2
- package/dist/testing.js +1 -1
- package/dist/tools/get-status.d.ts +137 -0
- package/dist/webhooks/check-suite.d.ts +6 -0
- package/dist/webhooks/handler.d.ts +3 -0
- package/package.json +2 -2
- package/skills/github-code/SKILL.md +5 -5
- package/skills/github-code/SPEC.md +1 -0
- package/skills/github-code/references/troubleshooting-workarounds.md +15 -1
- package/skills/github-issues/references/troubleshooting-workarounds.md +1 -1
|
@@ -47,9 +47,14 @@ export declare function recordGitHubPullRequestOutcome(db: GitHubDb, input: GitH
|
|
|
47
47
|
commitComposition: GitHubPullRequestCommitComposition | undefined;
|
|
48
48
|
conversationIds: string[];
|
|
49
49
|
}>;
|
|
50
|
-
/** Return candidate conversations that have an associated
|
|
50
|
+
/** Return candidate conversations that have an associated open pull request. */
|
|
51
51
|
export declare function listGitHubUnfinishedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Return the latest merge or close time for each candidate conversation.
|
|
54
|
+
* A closed pull request is finished even when it did not merge. A
|
|
55
|
+
* conversation with an open pull request is still unfinished; the caller
|
|
56
|
+
* combines this with `listGitHubUnfinishedWork`.
|
|
57
|
+
*/
|
|
53
58
|
export declare function listGitHubFinishedWork(db: GitHubDb, conversationIds: string[]): Promise<Record<string, string>>;
|
|
54
59
|
/** Return candidate conversations linked to any Junior-owned pull request. */
|
|
55
60
|
export declare function listGitHubAssignedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
|
package/dist/testing.js
CHANGED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { type PluginCache } from "@sentry/junior-plugin-api";
|
|
2
|
+
/** Read open and recent GitHub incidents to tell outages from other failures. */
|
|
3
|
+
export declare function createGitHubGetStatusTool(ctx: {
|
|
4
|
+
cache: PluginCache;
|
|
5
|
+
}): import("@sentry/junior-plugin-api").PluginToolDefinition<Record<string, never>, {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
objectAnnotations?: {
|
|
8
|
+
kind: "object";
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
12
|
+
title: string;
|
|
13
|
+
url: string | null;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
status?: string | undefined;
|
|
16
|
+
trigger?: string | undefined;
|
|
17
|
+
warning?: string | undefined;
|
|
18
|
+
displayType?: string | undefined;
|
|
19
|
+
sourceUpdatedAt?: string | undefined;
|
|
20
|
+
facts?: {
|
|
21
|
+
type: "code_change";
|
|
22
|
+
author?: string | undefined;
|
|
23
|
+
sourceBranch?: string | undefined;
|
|
24
|
+
targetBranch?: string | undefined;
|
|
25
|
+
reviewers?: string[] | undefined;
|
|
26
|
+
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
27
|
+
checks?: {
|
|
28
|
+
passed: number;
|
|
29
|
+
failed: number;
|
|
30
|
+
pending: number;
|
|
31
|
+
} | undefined;
|
|
32
|
+
mergeable?: boolean | undefined;
|
|
33
|
+
changedFiles?: number | undefined;
|
|
34
|
+
additions?: number | undefined;
|
|
35
|
+
deletions?: number | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
type: "task";
|
|
38
|
+
assignees?: string[] | undefined;
|
|
39
|
+
priority?: string | undefined;
|
|
40
|
+
project?: string | undefined;
|
|
41
|
+
cycle?: string | undefined;
|
|
42
|
+
dueDate?: string | undefined;
|
|
43
|
+
labels?: string[] | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
type: "deployment";
|
|
46
|
+
project?: string | undefined;
|
|
47
|
+
environment?: string | undefined;
|
|
48
|
+
revision?: string | undefined;
|
|
49
|
+
branch?: string | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
type: "calendar_event";
|
|
52
|
+
when?: string | undefined;
|
|
53
|
+
attendees?: string[] | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
truncated?: boolean | undefined;
|
|
57
|
+
continuation?: {
|
|
58
|
+
arguments: Record<string, unknown>;
|
|
59
|
+
reason?: string | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
target: "getStatus";
|
|
62
|
+
incidents: {
|
|
63
|
+
components: string[];
|
|
64
|
+
impact: string;
|
|
65
|
+
name: string;
|
|
66
|
+
resolved_at?: string | undefined;
|
|
67
|
+
started_at: string;
|
|
68
|
+
status: string;
|
|
69
|
+
url: string;
|
|
70
|
+
}[];
|
|
71
|
+
}, {
|
|
72
|
+
[x: string]: unknown;
|
|
73
|
+
objectAnnotations?: {
|
|
74
|
+
kind: "object";
|
|
75
|
+
key: string;
|
|
76
|
+
label: string;
|
|
77
|
+
objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
|
|
78
|
+
title: string;
|
|
79
|
+
url: string | null;
|
|
80
|
+
description?: string | undefined;
|
|
81
|
+
status?: string | undefined;
|
|
82
|
+
trigger?: string | undefined;
|
|
83
|
+
warning?: string | undefined;
|
|
84
|
+
displayType?: string | undefined;
|
|
85
|
+
sourceUpdatedAt?: string | undefined;
|
|
86
|
+
facts?: {
|
|
87
|
+
type: "code_change";
|
|
88
|
+
author?: string | undefined;
|
|
89
|
+
sourceBranch?: string | undefined;
|
|
90
|
+
targetBranch?: string | undefined;
|
|
91
|
+
reviewers?: string[] | undefined;
|
|
92
|
+
review?: "approved" | "changes_requested" | "required" | undefined;
|
|
93
|
+
checks?: {
|
|
94
|
+
passed: number;
|
|
95
|
+
failed: number;
|
|
96
|
+
pending: number;
|
|
97
|
+
} | undefined;
|
|
98
|
+
mergeable?: boolean | undefined;
|
|
99
|
+
changedFiles?: number | undefined;
|
|
100
|
+
additions?: number | undefined;
|
|
101
|
+
deletions?: number | undefined;
|
|
102
|
+
} | {
|
|
103
|
+
type: "task";
|
|
104
|
+
assignees?: string[] | undefined;
|
|
105
|
+
priority?: string | undefined;
|
|
106
|
+
project?: string | undefined;
|
|
107
|
+
cycle?: string | undefined;
|
|
108
|
+
dueDate?: string | undefined;
|
|
109
|
+
labels?: string[] | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
type: "deployment";
|
|
112
|
+
project?: string | undefined;
|
|
113
|
+
environment?: string | undefined;
|
|
114
|
+
revision?: string | undefined;
|
|
115
|
+
branch?: string | undefined;
|
|
116
|
+
} | {
|
|
117
|
+
type: "calendar_event";
|
|
118
|
+
when?: string | undefined;
|
|
119
|
+
attendees?: string[] | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
}[] | undefined;
|
|
122
|
+
truncated?: boolean | undefined;
|
|
123
|
+
continuation?: {
|
|
124
|
+
arguments: Record<string, unknown>;
|
|
125
|
+
reason?: string | undefined;
|
|
126
|
+
} | undefined;
|
|
127
|
+
target: "getStatus";
|
|
128
|
+
incidents: {
|
|
129
|
+
components: string[];
|
|
130
|
+
impact: string;
|
|
131
|
+
name: string;
|
|
132
|
+
resolved_at?: string | undefined;
|
|
133
|
+
started_at: string;
|
|
134
|
+
status: string;
|
|
135
|
+
url: string;
|
|
136
|
+
}[];
|
|
137
|
+
}>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* GitHub check suite events.
|
|
3
3
|
*/
|
|
4
4
|
import type { EventInput } from "@sentry/junior-plugin-api";
|
|
5
|
+
import type { GitHubStatusIncident } from "../github-status.js";
|
|
5
6
|
export type GitHubFailingCheck = {
|
|
6
7
|
checkRunId: number;
|
|
7
8
|
conclusion: string;
|
|
@@ -17,6 +18,8 @@ export type GitHubCheckSuitePullRequestFacts = {
|
|
|
17
18
|
/** Optional values for one check suite event. */
|
|
18
19
|
export type GitHubCheckSuiteFacts = {
|
|
19
20
|
failingChecks?: GitHubFailingCheck[];
|
|
21
|
+
/** Open or recent githubstatus.com incidents when the suite failed. */
|
|
22
|
+
githubIncidents?: GitHubStatusIncident[];
|
|
20
23
|
/** Pull request values by number when a match filter needs them. */
|
|
21
24
|
pullRequestFactsByNumber?: Record<number, GitHubCheckSuitePullRequestFacts>;
|
|
22
25
|
};
|
|
@@ -35,6 +38,7 @@ export declare function buildCheckSuiteEvent(args: {
|
|
|
35
38
|
deliveryId: string;
|
|
36
39
|
eventType: "pull_request.checks.failed" | "pull_request.checks.recovered";
|
|
37
40
|
failingChecks?: GitHubFailingCheck[];
|
|
41
|
+
githubIncidents?: GitHubStatusIncident[];
|
|
38
42
|
headBranch?: string;
|
|
39
43
|
headSha?: string;
|
|
40
44
|
isDraft?: boolean;
|
|
@@ -82,6 +86,8 @@ export declare function loadCheckSuiteFacts(args: {
|
|
|
82
86
|
appIdEnv: string;
|
|
83
87
|
body: unknown;
|
|
84
88
|
installationIdEnv: string;
|
|
89
|
+
/** Open or recent githubstatus.com incidents, shared through a cache. */
|
|
90
|
+
loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
|
|
85
91
|
loadPullRequestFacts?: boolean;
|
|
86
92
|
log?: {
|
|
87
93
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GitHubStatusIncident } from "../github-status.js";
|
|
1
2
|
import type { CodeChangePublisher, PluginConversationAnnotations, PluginConversationReviewItems, PluginLogger, PluginRoute, EventPublisher } from "@sentry/junior-plugin-api";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import type { GitHubDb } from "../db/database.js";
|
|
@@ -33,6 +34,8 @@ export declare function createGitHubWebhookRoute(args: {
|
|
|
33
34
|
* involved.
|
|
34
35
|
*/
|
|
35
36
|
loadPullRequestCommitPages?(target: GitHubPullRequestTarget): Promise<GitHubCommitPageLoader>;
|
|
37
|
+
/** Read open and recent GitHub incidents for failed check suites. */
|
|
38
|
+
loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
|
|
36
39
|
/** Read one pull request for its mergeability. */
|
|
37
40
|
loadPullRequest?(pullRequest: GitHubPullRequestRef): Promise<unknown>;
|
|
38
41
|
/** Load a repository role for `openerRole`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.277.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.
|
|
35
|
+
"@sentry/junior-plugin-api": "0.277.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@oxlint/plugins": "1.79.0",
|
|
@@ -18,11 +18,11 @@ Use `git` and `gh` for repository work.
|
|
|
18
18
|
|
|
19
19
|
## Open when needed
|
|
20
20
|
|
|
21
|
-
| Need
|
|
22
|
-
|
|
|
23
|
-
| Commands and permissions
|
|
24
|
-
| Edit, verify, and open a PR
|
|
25
|
-
| Command or
|
|
21
|
+
| Need | Read |
|
|
22
|
+
| ---------------------------------- | -------------------------------------------------------------------------------------- |
|
|
23
|
+
| Commands and permissions | [references/api-surface.md](references/api-surface.md) |
|
|
24
|
+
| Edit, verify, and open a PR | [references/workflow.md](references/workflow.md) |
|
|
25
|
+
| Command, permission, or CI failure | [references/troubleshooting-workarounds.md](references/troubleshooting-workarounds.md) |
|
|
26
26
|
|
|
27
27
|
## Always
|
|
28
28
|
|
|
@@ -14,6 +14,7 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
|
|
|
14
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.
|
|
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
|
+
- 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.
|
|
17
18
|
|
|
18
19
|
## Runtime architecture
|
|
19
20
|
|
|
@@ -21,11 +21,25 @@
|
|
|
21
21
|
| Dependencies are missing | Run the frozen install. Do not change the lockfile. |
|
|
22
22
|
| Frozen install fails | Report the exact failure. |
|
|
23
23
|
| Plugin setup fails | Report the setup failure. Do not repair it from the skill. |
|
|
24
|
+
| GitHub returns 5xx, times out, or drops the connection | Check GitHub status. |
|
|
25
|
+
| Checks stay queued, stall, or fail with no cause in logs | Check GitHub status. |
|
|
24
26
|
|
|
25
27
|
## Retry rules
|
|
26
28
|
|
|
27
|
-
- Retry a transport failure once after you check the repository.
|
|
29
|
+
- Retry a transport failure once after you check the repository. If it fails again, check GitHub status.
|
|
28
30
|
- Do not repeat 401, 403, 404, or validation failures.
|
|
29
31
|
- A `user-read` or `user-write` failure needs private App OAuth.
|
|
30
32
|
- An `installation-*` access denial needs an App permission or installation fix.
|
|
31
33
|
- Use structured `permission_denied` details when present.
|
|
34
|
+
|
|
35
|
+
## GitHub status
|
|
36
|
+
|
|
37
|
+
Call `github_getStatus`. It lists GitHub incidents that are open or were resolved in the last 24 hours. All callers share one cached read of githubstatus.com. Do not read the status page another way.
|
|
38
|
+
|
|
39
|
+
A `pull_request.checks.failed` event already lists incidents that are open or ended in the last hour. Use that list before you call the tool.
|
|
40
|
+
|
|
41
|
+
- An incident matches when its time covers the failure and its components cover the failing operation: `Git Operations` for clone, fetch, and push; `API Requests` for `gh` and GitHub tools; `Actions` for workflow runs; `Pull Requests`, `Issues`, or `Webhooks` for those features and missing events.
|
|
42
|
+
- Match: say the failure is likely from that incident, and link it. Do not keep retrying. Do not change code, permissions, or workflows to work around it.
|
|
43
|
+
- No match: say GitHub status shows no related incident, and continue from the error. Do not blame an outage.
|
|
44
|
+
- If `github_getStatus` fails, say that GitHub status is unknown. Do not guess.
|
|
45
|
+
- A 401, 403, 404, or 422 usually gives its own cause. Check status for one only when that cause does not fit, such as a 404 for a repository you just read.
|
|
@@ -18,7 +18,7 @@ Use this table to recover quickly while keeping operations deterministic.
|
|
|
18
18
|
|
|
19
19
|
## Retry guidance
|
|
20
20
|
|
|
21
|
-
- Retry once for transient transport failures after verifying repo context.
|
|
21
|
+
- Retry once for transient transport failures after verifying repo context. If it fails again, call `github_getStatus`. Report a related open or recent incident with its link. With no related incident, do not blame an outage.
|
|
22
22
|
- Do not loop retries on repeated 401/403/404 validation errors.
|
|
23
23
|
- Treat missing or stale `user-read`/`user-write` grants as private GitHub App OAuth work. Treat all `installation-*` failures as App permission, installation scope, or host environment setup; they do not fall back to user OAuth.
|
|
24
24
|
- For persistent permission problems, return explicit remediation and stop.
|