style: prettier pass
This commit is contained in:
1 parent
dcaa27db9a
commit
594592046b
8 files changed
+30
-20
No files matched your search
@@ -45,7 +45,10 @@ export class GooseReviewer {
|
|||||||
input.files.map((file) => file.filename)
|
input.files.map((file) => file.filename)
|
||||||
);
|
);
|
||||||
if (warnings.length > 0) {
|
if (warnings.length > 0) {
|
||||||
logger.warn({ warnings }, "Review output contained findings that could not be posted inline.");
|
logger.warn(
|
||||||
|
{ warnings },
|
||||||
|
"Review output contained findings that could not be posted inline."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return decision;
|
return decision;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -943,7 +943,10 @@ async function maybeMergePullRequest(
|
|||||||
// A concurrent schedule run or approval event may have merged this head
|
// A concurrent schedule run or approval event may have merged this head
|
||||||
// first. GitHub answers 405 with "was already merged"; treat it as done.
|
// first. GitHub answers 405 with "was already merged"; treat it as done.
|
||||||
if (isAlreadyMergedError(error)) {
|
if (isAlreadyMergedError(error)) {
|
||||||
logger.info({ owner, repo, pullNumber, headSha: params.headSha }, "Pull request was already merged by a concurrent run.");
|
logger.info(
|
||||||
|
{ owner, repo, pullNumber, headSha: params.headSha },
|
||||||
|
"Pull request was already merged by a concurrent run."
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
@@ -958,7 +961,10 @@ function isAlreadyMergedError(error: unknown): boolean {
|
|||||||
if (candidate.status !== 405 && candidate.status !== 409) {
|
if (candidate.status !== 405 && candidate.status !== 409) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return typeof candidate.message === "string" && /already.{0,20}merged|Pull Request is not mergeable/i.test(candidate.message);
|
return (
|
||||||
|
typeof candidate.message === "string" &&
|
||||||
|
/already.{0,20}merged|Pull Request is not mergeable/i.test(candidate.message)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hasCurrentHeadApprovalFrom(
|
async function hasCurrentHeadApprovalFrom(
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ test("toDiffPosition maps valid new lines and rejects stale ones", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("hunk headers with ranges are parsed correctly", () => {
|
test("hunk headers with ranges are parsed correctly", () => {
|
||||||
const valid = collectValidNewLines([
|
const valid = collectValidNewLines([file("@@ -10,5 +20,3 @@\n+first\n+second\n+third")]);
|
||||||
file("@@ -10,5 +20,3 @@\n+first\n+second\n+third")
|
|
||||||
]);
|
|
||||||
assert.equal(valid.has("src/a.ts:20"), true);
|
assert.equal(valid.has("src/a.ts:20"), true);
|
||||||
assert.equal(valid.has("src/a.ts:22"), true);
|
assert.equal(valid.has("src/a.ts:22"), true);
|
||||||
assert.equal(valid.has("src/a.ts:23"), false);
|
assert.equal(valid.has("src/a.ts:23"), false);
|
||||||
|
|||||||
@@ -8,14 +8,8 @@ import {
|
|||||||
} from "../src/storage/cacheStore.js";
|
} from "../src/storage/cacheStore.js";
|
||||||
|
|
||||||
test("object keys are scoped by repository id, pull number, and optional prefix", () => {
|
test("object keys are scoped by repository id, pull number, and optional prefix", () => {
|
||||||
assert.equal(
|
assert.equal(repositoryKnowledgeObjectKey("123"), "repositories/123/knowledge/repository.md");
|
||||||
repositoryKnowledgeObjectKey("123"),
|
assert.equal(pullRequestReviewObjectKey("123", 7), "repositories/123/pulls/7/latest.json");
|
||||||
"repositories/123/knowledge/repository.md"
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
pullRequestReviewObjectKey("123", 7),
|
|
||||||
"repositories/123/pulls/7/latest.json"
|
|
||||||
);
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
pullRequestReviewObjectKey("123", 7, "forum-1"),
|
pullRequestReviewObjectKey("123", 7, "forum-1"),
|
||||||
"forum-1/repositories/123/pulls/7/latest.json"
|
"forum-1/repositories/123/pulls/7/latest.json"
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ test("repository knowledge round trips through the agent scratch file", async ()
|
|||||||
// container-facing 0o777/0o666 contract can only be asserted on POSIX.
|
// container-facing 0o777/0o666 contract can only be asserted on POSIX.
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
assert.equal((await fs.stat(path.join(root, ".ghbot"))).mode & 0o222, 0o222);
|
assert.equal((await fs.stat(path.join(root, ".ghbot"))).mode & 0o222, 0o222);
|
||||||
assert.equal((await fs.stat(path.join(root, ".ghbot", "repository-knowledge.md"))).mode & 0o222, 0o222);
|
assert.equal(
|
||||||
|
(await fs.stat(path.join(root, ".ghbot", "repository-knowledge.md"))).mode & 0o222,
|
||||||
|
0o222
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
assert.equal((await fs.stat(path.join(root, ".ghbot"))).mode & 0o777, 0o777);
|
assert.equal((await fs.stat(path.join(root, ".ghbot"))).mode & 0o777, 0o777);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
+1
-3
@@ -60,9 +60,7 @@ test("throws the last error after exhausting attempts", async () => {
|
|||||||
test("4xx errors are not retried by default", async () => {
|
test("4xx errors are not retried by default", async () => {
|
||||||
let attempts = 0;
|
let attempts = 0;
|
||||||
await assert.rejects(
|
await assert.rejects(
|
||||||
withRetry(
|
withRetry("probe.client-error", async () => {
|
||||||
"probe.client-error",
|
|
||||||
async () => {
|
|
||||||
attempts += 1;
|
attempts += 1;
|
||||||
throw new HttpLikeError(404, "not found");
|
throw new HttpLikeError(404, "not found");
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ test("a clean decision submits a single final APPROVE review", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("superseded review bodies keep the original state marker", () => {
|
test("superseded review bodies keep the original state marker", () => {
|
||||||
const marker = "<!-- ghbot-review:v1 mode=normal outcome=pass requires-admin=false review=0 change=0 -->";
|
const marker =
|
||||||
|
"<!-- ghbot-review:v1 mode=normal outcome=pass requires-admin=false review=0 change=0 -->";
|
||||||
const body = formatSupersededReviewBody({
|
const body = formatSupersededReviewBody({
|
||||||
originalMarker: marker,
|
originalMarker: marker,
|
||||||
oldCommitId: "a".repeat(40),
|
oldCommitId: "a".repeat(40),
|
||||||
|
|||||||
@@ -9,7 +9,14 @@ import {
|
|||||||
import { containsSecret, redactSecrets } from "../src/security/secrets.js";
|
import { containsSecret, redactSecrets } from "../src/security/secrets.js";
|
||||||
|
|
||||||
test("protected basenames cover env files, agent configs, and deploy configs", () => {
|
test("protected basenames cover env files, agent configs, and deploy configs", () => {
|
||||||
for (const name of [".env", ".env.local", ".ENV", "AGENTS.MD", "opencode.json", "wrangler.toml"]) {
|
for (const name of [
|
||||||
|
".env",
|
||||||
|
".env.local",
|
||||||
|
".ENV",
|
||||||
|
"AGENTS.MD",
|
||||||
|
"opencode.json",
|
||||||
|
"wrangler.toml"
|
||||||
|
]) {
|
||||||
assert.equal(isProtectedBasename(name), true, `${name} should be protected`);
|
assert.equal(isProtectedBasename(name), true, `${name} should be protected`);
|
||||||
}
|
}
|
||||||
assert.equal(isProtectedBasename("environment.ts"), false);
|
assert.equal(isProtectedBasename("environment.ts"), false);
|
||||||
|
|||||||
Reference in new issue
Block a user