style: prettier pass
This commit is contained in:
1 parent
dcaa27db9a
commit
594592046b
8 files changed
+35
-25
No files matched your search
@@ -45,7 +45,10 @@ export class GooseReviewer {
|
||||
input.files.map((file) => file.filename)
|
||||
);
|
||||
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;
|
||||
},
|
||||
|
||||
@@ -943,7 +943,10 @@ async function maybeMergePullRequest(
|
||||
// A concurrent schedule run or approval event may have merged this head
|
||||
// first. GitHub answers 405 with "was already merged"; treat it as done.
|
||||
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;
|
||||
}
|
||||
throw error;
|
||||
@@ -958,7 +961,10 @@ function isAlreadyMergedError(error: unknown): boolean {
|
||||
if (candidate.status !== 405 && candidate.status !== 409) {
|
||||
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(
|
||||
|
||||
@@ -39,9 +39,7 @@ test("toDiffPosition maps valid new lines and rejects stale ones", () => {
|
||||
});
|
||||
|
||||
test("hunk headers with ranges are parsed correctly", () => {
|
||||
const valid = collectValidNewLines([
|
||||
file("@@ -10,5 +20,3 @@\n+first\n+second\n+third")
|
||||
]);
|
||||
const valid = collectValidNewLines([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:22"), true);
|
||||
assert.equal(valid.has("src/a.ts:23"), false);
|
||||
|
||||
@@ -8,14 +8,8 @@ import {
|
||||
} from "../src/storage/cacheStore.js";
|
||||
|
||||
test("object keys are scoped by repository id, pull number, and optional prefix", () => {
|
||||
assert.equal(
|
||||
repositoryKnowledgeObjectKey("123"),
|
||||
"repositories/123/knowledge/repository.md"
|
||||
);
|
||||
assert.equal(
|
||||
pullRequestReviewObjectKey("123", 7),
|
||||
"repositories/123/pulls/7/latest.json"
|
||||
);
|
||||
assert.equal(repositoryKnowledgeObjectKey("123"), "repositories/123/knowledge/repository.md");
|
||||
assert.equal(pullRequestReviewObjectKey("123", 7), "repositories/123/pulls/7/latest.json");
|
||||
assert.equal(
|
||||
pullRequestReviewObjectKey("123", 7, "forum-1"),
|
||||
"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.
|
||||
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", "repository-knowledge.md"))).mode & 0o222, 0o222);
|
||||
assert.equal(
|
||||
(await fs.stat(path.join(root, ".ghbot", "repository-knowledge.md"))).mode & 0o222,
|
||||
0o222
|
||||
);
|
||||
} else {
|
||||
assert.equal((await fs.stat(path.join(root, ".ghbot"))).mode & 0o777, 0o777);
|
||||
assert.equal(
|
||||
|
||||
+6
-8
@@ -52,20 +52,18 @@ test("throws the last error after exhausting attempts", async () => {
|
||||
},
|
||||
{ maxAttempts: 3, baseDelayMs: 1 }
|
||||
),
|
||||
/boom 3$/
|
||||
);
|
||||
/boom 3$/
|
||||
);
|
||||
assert.equal(attempts, 3);
|
||||
});
|
||||
|
||||
test("4xx errors are not retried by default", async () => {
|
||||
let attempts = 0;
|
||||
await assert.rejects(
|
||||
withRetry(
|
||||
"probe.client-error",
|
||||
async () => {
|
||||
attempts += 1;
|
||||
throw new HttpLikeError(404, "not found");
|
||||
})
|
||||
withRetry("probe.client-error", async () => {
|
||||
attempts += 1;
|
||||
throw new HttpLikeError(404, "not found");
|
||||
})
|
||||
);
|
||||
assert.equal(attempts, 1);
|
||||
});
|
||||
|
||||
@@ -54,7 +54,8 @@ test("a clean decision submits a single final APPROVE review", () => {
|
||||
});
|
||||
|
||||
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({
|
||||
originalMarker: marker,
|
||||
oldCommitId: "a".repeat(40),
|
||||
|
||||
@@ -9,7 +9,14 @@ import {
|
||||
import { containsSecret, redactSecrets } from "../src/security/secrets.js";
|
||||
|
||||
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("environment.ts"), false);
|
||||
|
||||
Reference in new issue
Block a user