pr-shepherd 2.2.0 → 2.2.1
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/.claude-plugin/plugin.json +1 -1
- package/bin/github/graphql-http.mjs +8 -6
- package/bin/github/graphql-tolerated-errors.d.mts +3 -0
- package/bin/github/graphql-tolerated-errors.mjs +20 -0
- package/package.json +1 -1
- package/plugins/pr-shepherd/.claude-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/.codex.mcp.json +1 -1
- package/plugins/pr-shepherd/.mcp.json +1 -1
- package/plugins/pr-shepherd/package-lock.json +4 -4
- package/plugins/pr-shepherd/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { GitHubRequestError } from "./errors.mjs";
|
|
|
5
5
|
import { isGraphQlMutationDocument, withGraphQlInternalRetry } from "./graphql-internal-retry.mjs";
|
|
6
6
|
import { githubFetch } from "./github-fetch.mjs";
|
|
7
7
|
import { formatGraphQlErrors, parseGraphQlPayload } from "./graphql-response.mjs";
|
|
8
|
+
import { withoutToleratedErrors } from "./graphql-tolerated-errors.mjs";
|
|
8
9
|
import { CCR_GRAPHQL_REFUSAL_MESSAGE, isCcrGraphqlRefusal } from "./graphql-session-refusal.mjs";
|
|
9
10
|
import { isAppEligibleGraphql } from "./app-eligibility.mjs";
|
|
10
11
|
import { withAppQuotaFallback } from "./app-quota.mjs";
|
|
@@ -163,20 +164,21 @@ async function graphqlAttempt(query, vars, opts) {
|
|
|
163
164
|
authSource,
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
const errors = withoutToleratedErrors(payload.errors);
|
|
168
|
+
if (errors?.length && !opts.allowPartialData) {
|
|
169
|
+
throw new GitHubRequestError(`GitHub GraphQL error: ${formatGraphQlErrors(errors)}`, {
|
|
168
170
|
status: res.status,
|
|
169
171
|
rateLimit: rateLimit ?? undefined,
|
|
170
172
|
retryAfterSeconds,
|
|
171
|
-
graphqlErrors:
|
|
173
|
+
graphqlErrors: errors,
|
|
172
174
|
authSource,
|
|
173
175
|
});
|
|
174
176
|
}
|
|
175
|
-
if (
|
|
176
|
-
const messages =
|
|
177
|
+
if (errors?.length) {
|
|
178
|
+
const messages = errors.map((e) => e.message).join("; ");
|
|
177
179
|
process.stderr.write(`pr-shepherd: GraphQL non-fatal errors: ${messages}\n`);
|
|
178
180
|
}
|
|
179
|
-
return { data: payload.data, rateLimit, retryAfterSeconds, errors
|
|
181
|
+
return { data: payload.data, rateLimit, retryAfterSeconds, errors };
|
|
180
182
|
}
|
|
181
183
|
export async function graphql(query, vars = {}, opts = {}) {
|
|
182
184
|
const { data, errors } = await withGraphQlInternalRetry(query, () => graphqlInner(query, vars, opts));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A check suite's `app` can be unreadable while the suite itself is readable:
|
|
3
|
+
* GitHub blocks it when the app's owner enforces an IP allow list, and returns
|
|
4
|
+
* the rest of the response with `app: null`. Shepherd reads `app.slug` only to
|
|
5
|
+
* tell GitHub Actions suites apart, and an unreadable app is never Actions, so
|
|
6
|
+
* the null is complete enough to keep the snapshot.
|
|
7
|
+
*/
|
|
8
|
+
const TOLERATED_PATH = /(^|\.)checkSuites\.nodes\.\d+\.app$/;
|
|
9
|
+
function isTolerated(error) {
|
|
10
|
+
if (!Array.isArray(error.path))
|
|
11
|
+
return false;
|
|
12
|
+
return TOLERATED_PATH.test(error.path.map(String).join("."));
|
|
13
|
+
}
|
|
14
|
+
/** Drops errors on fields whose null Shepherd already handles. */
|
|
15
|
+
export function withoutToleratedErrors(errors) {
|
|
16
|
+
if (!errors?.length)
|
|
17
|
+
return errors;
|
|
18
|
+
const rest = errors.filter((e) => !isTolerated(e));
|
|
19
|
+
return rest.length ? rest : undefined;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "pr-shepherd-plugin",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"pr-shepherd": "2.
|
|
10
|
+
"pr-shepherd": "2.2.0"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"node_modules/@hono/node-server": {
|
|
@@ -889,9 +889,9 @@
|
|
|
889
889
|
}
|
|
890
890
|
},
|
|
891
891
|
"node_modules/pr-shepherd": {
|
|
892
|
-
"version": "2.
|
|
893
|
-
"resolved": "https://registry.npmjs.org/pr-shepherd/-/pr-shepherd-2.
|
|
894
|
-
"integrity": "sha512-
|
|
892
|
+
"version": "2.2.0",
|
|
893
|
+
"resolved": "https://registry.npmjs.org/pr-shepherd/-/pr-shepherd-2.2.0.tgz",
|
|
894
|
+
"integrity": "sha512-czQunFT1nHK4Qcn/3tAqFIi5vmCAdsoAWdd7oYdFVP1u5FGyyi82+fhrR+NJw/lmY4OGc5AWMxNI6xm+h9pr4g==",
|
|
895
895
|
"license": "MIT",
|
|
896
896
|
"dependencies": {
|
|
897
897
|
"@modelcontextprotocol/sdk": "^1.30.0",
|