diff --git a/test/unit/actions-fallback-webhook.test.ts b/test/unit/actions-fallback-webhook.test.ts index 62cb509d4b..41ce020322 100644 --- a/test/unit/actions-fallback-webhook.test.ts +++ b/test/unit/actions-fallback-webhook.test.ts @@ -115,7 +115,6 @@ async function seedRepoAndPr(env: ReturnType, headSha: str autonomy: { merge: "observe", update_branch: "observe" }, aiReviewMode: "off", gatePack: "oss-anti-slop", - gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off", diff --git a/test/unit/ci-completion-fork-resume.test.ts b/test/unit/ci-completion-fork-resume.test.ts index c7ebb2ba72..061a24ac23 100644 --- a/test/unit/ci-completion-fork-resume.test.ts +++ b/test/unit/ci-completion-fork-resume.test.ts @@ -47,7 +47,7 @@ async function seedForkResumeRepo(env: ReturnType, repo: s await upsertRepositoryFromGitHub(env, { name: repo.split("/")[1] ?? "repo", full_name: repo, private: false, owner: { login: owner ?? "owner" } }, 5001); // publicSurface/check/gate all OFF + no autonomy → reReviewStoredPullRequest is a clean no-op (no network), // so the test isolates resolution + coalesce + audit, exactly the head-SHA fix surface. - await upsertRepositorySettings(env, { repoFullName: repo, publicSurface: "off", checkRunMode: "off", gateCheckMode: "off", autonomy: {} }); + await upsertRepositorySettings(env, { repoFullName: repo, publicSurface: "off", checkRunMode: "off", autonomy: {} }); await upsertPullRequestFromGitHub(env, repo, { number: prNumber, title: "Fork PR", state: "open", user: { login: "outside-contributor" }, head: { sha: headSha }, labels: [], body: "fork change" }); } diff --git a/test/unit/linked-issue-satisfaction-run.test.ts b/test/unit/linked-issue-satisfaction-run.test.ts index beb40883b1..49cefd52e7 100644 --- a/test/unit/linked-issue-satisfaction-run.test.ts +++ b/test/unit/linked-issue-satisfaction-run.test.ts @@ -789,7 +789,6 @@ describe("linked-issue satisfaction wired end-to-end through the real webhook pi publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", gatePack: "oss-anti-slop", linkedIssueGateMode: "off", @@ -881,7 +880,6 @@ describe("linked-issue satisfaction wired end-to-end through the real webhook pi publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", gatePack: "oss-anti-slop", linkedIssueGateMode: "off", @@ -948,7 +946,6 @@ describe("linked-issue satisfaction wired end-to-end through the real webhook pi publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", linkedIssueGateMode: "off", linkedIssueSatisfactionGateMode: "advisory", diff --git a/test/unit/parity-wire.test.ts b/test/unit/parity-wire.test.ts index 24a890389d..2d8b08c4b8 100644 --- a/test/unit/parity-wire.test.ts +++ b/test/unit/parity-wire.test.ts @@ -388,7 +388,6 @@ async function seedGateEnabledRepo(env: Env): Promise { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, diff --git a/test/unit/policy-sanitizer.test.ts b/test/unit/policy-sanitizer.test.ts index cf5661da79..9e5defbb7d 100644 --- a/test/unit/policy-sanitizer.test.ts +++ b/test/unit/policy-sanitizer.test.ts @@ -61,7 +61,6 @@ function settingsFor(repoFullName: string, overrides: Partial { await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); // aiReviewLowConfidenceDisposition left UNSET — the shipped default (hold_for_review) is what's under test. - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto" }, aiReviewMode: "block", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto" }, aiReviewMode: "block", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 8, title: "Sub-floor defect PR", state: "open", user: { login: "contributor" }, head: { sha: "b8" }, labels: [], body: "Closes #1" }); await upsertPullRequestFile(env, { repoFullName: "owner/agent-repo", pullNumber: 8, path: "src/a.ts", status: "modified", additions: 1, deletions: 0, changes: 1, payload: { patch: "@@\n+export const ok = value.length;" } }); const inputFingerprint = await cachedSubFloorDefectFingerprint("Sub-floor defect PR"); @@ -333,7 +333,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto" }, aiReviewMode: "block", aiReviewLowConfidenceDisposition: "one_shot", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto" }, aiReviewMode: "block", aiReviewLowConfidenceDisposition: "one_shot", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 9, title: "Sub-floor defect PR (one_shot)", state: "open", user: { login: "contributor" }, head: { sha: "c9" }, labels: [], body: "Closes #1" }); await upsertPullRequestFile(env, { repoFullName: "owner/agent-repo", pullNumber: 9, path: "src/a.ts", status: "modified", additions: 1, deletions: 0, changes: 1, payload: { patch: "@@\n+export const ok = value.length;" } }); const inputFingerprint = await cachedSubFloorDefectFingerprint("Sub-floor defect PR (one_shot)"); @@ -398,7 +398,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -468,7 +468,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); // A sibling PR (different author, unrelated title) already open and already detail-synced — its files are @@ -538,7 +537,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); await upsertPullRequestFromGitHub(env, "JSONbored/gittensory", { @@ -633,7 +631,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -708,7 +706,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -783,7 +781,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -869,7 +867,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -952,7 +950,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -1011,7 +1009,7 @@ describe("queue processors", () => { }); await persistRegistrySnapshot(env, normalizeRegistryPayload({ "JSONbored/gittensory": { emission_share: 0.01, issue_discovery_share: 0 } }, { kind: "raw-github", url: "https://example.test" }, "2026-05-23T00:00:00.000Z")); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "advisory" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "advisory" }); const stickyComment: { current: { id: number; body: string } | null } = { current: null }; let postCount = 0; let patchCount = 0; @@ -1084,7 +1082,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "advisory", }); const postedBodies: string[] = []; @@ -1171,7 +1168,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -1262,7 +1259,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -1356,7 +1353,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -1434,7 +1431,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -1555,7 +1552,7 @@ describe("queue processors", () => { const env = createTestEnv({ JOBS: { async send(m: import("../../src/types").JobMessage) { sent.push(m); } } as unknown as Queue }); await upsertInstallation(env, { action: "created", installation: { id: 9400, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9400); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (const number of [1, 2, 3, 4]) { const headSha = `a${number}`; await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `PR${number}`, state: "open", user: { login: "c" }, head: { sha: headSha }, labels: [], body: "" }); @@ -1611,7 +1608,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9403, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9403); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, regateSweepOrderMode: "oldest-first", gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, regateSweepOrderMode: "oldest-first", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // Deliberately seeded out of PR-number order: #1 is the NEWEST, #3 is the OLDEST — proves the fan-out // follows createdAt, not insertion/number order. const created: Record = { 1: "2026-05-20T00:00:00.000Z", 2: "2026-05-10T00:00:00.000Z", 3: "2026-05-01T00:00:00.000Z" }; @@ -1660,7 +1657,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9402, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9402); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (const number of [1, 2, 3, 4, 5]) { const headSha = `repair-${number}`; await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Repair ${number}`, state: "open", user: { login: "c" }, head: { sha: headSha }, labels: [], body: "" }); @@ -1700,7 +1697,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9403, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9403); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // PR 1: missing its current Gate check -- the one priority repair. Make it newer-by-regate than the // ordinary stale PRs below, reproducing the backlog bug where a max=1 staleness slice could drop the repair. await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 1, title: "Repair 1", state: "open", user: { login: "c" }, head: { sha: "repair-1" }, labels: [], body: "" }); @@ -1741,7 +1738,7 @@ describe("queue processors", () => { const env = createTestEnv({ JOBS: { async send(m: import("../../src/types").JobMessage) { sent.push(m); } } as unknown as Queue }); await upsertInstallation(env, { action: "created", installation: { id: 9404, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9404); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // PR 1: missing its current Gate check for its current head -- surfaceRepairPriorityPullNumbers flags this as // outage-repair priority (no completed Gittensory Gate check run at the live head SHA). await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 1, title: "Repair 1", state: "open", user: { login: "c" }, head: { sha: "repair-1" }, labels: [], body: "" }); @@ -1788,7 +1785,7 @@ describe("queue processors", () => { const env = createTestEnv({ JOBS: { async send(m: import("../../src/types").JobMessage) { sent.push(m); } } as unknown as Queue }); await upsertInstallation(env, { action: "created", installation: { id: 9407, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9407); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // PR 1: missing its current Gate check for its current head -- would ordinarily be flagged outage-repair // priority on every tick. Pre-seed REGATE_REPAIR_MAX_ATTEMPTS_PER_SHA=5 (#3998) prior repair-attempt audit // events for this EXACT head SHA to simulate a review that keeps failing (e.g. a timeout) and never @@ -1840,7 +1837,7 @@ describe("queue processors", () => { const env = createTestEnv({ JOBS: { async send(m: import("../../src/types").JobMessage) { sent.push(m); } } as unknown as Queue }); await upsertInstallation(env, { action: "created", installation: { id: 9408, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9408); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 2, title: "Fresh repair", state: "open", user: { login: "c" }, head: { sha: "fresh-sha" }, labels: [], body: "" }); await repositoriesModule.markPullRequestSurfacePublished(env, "owner/agent-repo", 2, "fresh-sha"); const targetKey = "owner/agent-repo#2#fresh-sha"; @@ -1885,7 +1882,7 @@ describe("queue processors", () => { const env = createTestEnv({ JOBS: { async send(m: import("../../src/types").JobMessage) { sent.push(m); } } as unknown as Queue }); await upsertInstallation(env, { action: "created", installation: { id: 9401, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9401); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Repair me", state: "open", user: { login: "c" }, head: { sha: "a7" }, labels: [], body: "" }); await repositoriesModule.markPullRequestSurfacePublished(env, "owner/agent-repo", 7, "a7"); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); @@ -1937,7 +1934,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9406, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9406); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertRepoSyncSegment(env, completeSegment("owner/agent-repo", "open_pull_requests")); const backfillSpy = vi.spyOn(backfillModule, "backfillRepositorySegment").mockResolvedValueOnce({ ok: true, @@ -1968,7 +1965,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9402, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9402); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertRepoSyncSegment(env, completeSegment("owner/agent-repo", "open_pull_requests")); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -2025,7 +2022,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9403, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9403); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertRepoSyncSegment(env, { ...completeSegment("owner/agent-repo", "open_pull_requests"), status: "running", @@ -2056,7 +2053,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9404, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9404); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); const segmentSpy = vi.spyOn(repositoriesModule, "getRepoSyncSegment").mockRejectedValueOnce(new Error("segment read failed")); const backfillSpy = vi.spyOn(backfillModule, "backfillRepositorySegment").mockRejectedValueOnce(new Error("open PR refresh failed")); const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined); @@ -2110,7 +2107,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9405, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9405); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); const backfillSpy = vi.spyOn(backfillModule, "backfillRepositorySegment").mockResolvedValueOnce(undefined as never); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); @@ -2132,7 +2129,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9405, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9405); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertRepoSyncSegment(env, { ...completeSegment("owner/agent-repo", "open_pull_requests"), status: "partial", @@ -2166,7 +2163,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9407, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9407); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, checkRunMode: "off", commentMode: "off", publicSurface: "off" }); const segmentSpy = vi.spyOn(repositoriesModule, "getRepoSyncSegment").mockResolvedValueOnce({ ...completeSegment("owner/agent-repo", "open_pull_requests"), completedAt: undefined, @@ -2630,7 +2627,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); let mergeCalls = 0; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { @@ -3178,7 +3175,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, }); @@ -3258,7 +3255,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, }); @@ -3312,7 +3309,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, }); @@ -3377,7 +3374,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3465,7 +3462,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3556,7 +3553,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3652,7 +3649,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3741,7 +3738,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3835,7 +3832,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", manifestPolicyGateMode: "block", requireLinkedIssue: false, @@ -3913,7 +3910,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -3969,7 +3966,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -4033,7 +4030,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -4096,7 +4093,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); let commentPosts = 0; @@ -4227,7 +4223,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); let commentPosts = 0; @@ -4293,7 +4288,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); let commentPosts = 0; @@ -4369,7 +4363,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", aiReviewMode: "off", }); let commentPosts = 0; @@ -4436,7 +4429,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -4531,7 +4524,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -4606,7 +4599,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, autonomy: { review_state_label: "auto", request_changes: "auto" }, @@ -4669,7 +4662,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", manifestPolicyGateMode: "block", autonomy: { merge: "auto", request_changes: "auto" }, agentDryRun: true, @@ -4745,7 +4738,6 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", autonomy: { merge: "observe", request_changes: "observe" }, slopGateMode: "off", mergeReadinessGateMode: "off", @@ -4827,7 +4819,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, // evaluate + post the gate, take no merge/close action agentDryRun: false, // so the gate check-run is actually POSTed (dry-run suppresses the write) and capturable }); @@ -4906,7 +4898,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, }); @@ -4984,7 +4976,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, }); @@ -5056,7 +5048,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, // No gate.claMode manifest override — claGateMode stays undefined (the safe default). @@ -5133,7 +5125,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, }); @@ -5209,7 +5201,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, }); @@ -5289,7 +5281,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "observe", request_changes: "observe" }, agentDryRun: false, }); diff --git a/test/unit/queue-3.test.ts b/test/unit/queue-3.test.ts index df8bfc131f..1436bbc9cd 100644 --- a/test/unit/queue-3.test.ts +++ b/test/unit/queue-3.test.ts @@ -1099,7 +1099,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "auto", approve: "auto", close: "auto" }, }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -1158,7 +1158,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, // The banned login is per-repo DB config; the label is the configurable `.gittensory.yml` value below — @@ -1231,7 +1231,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -1294,7 +1294,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", merge: "auto" }, }); await upsertRepoFocusManifest(env, "JSONbored/gittensory", { settings: { screenshotTableGate: { enabled: true, whenLabels: ["visual"] } } }, "repo_file"); @@ -1378,7 +1378,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", label: "auto" }, }); await upsertRepoFocusManifest(env, "JSONbored/gittensory", { settings: { screenshotTableGate: { enabled: true, whenLabels: ["visual"] } } }, "repo_file"); @@ -1484,7 +1484,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", label: "auto" }, }); await upsertRepoFocusManifest(env, "JSONbored/gittensory", { settings: { screenshotTableGate: { enabled: true, whenLabels: ["visual"] } } }, "repo_file"); @@ -1602,7 +1602,7 @@ describe("queue processors", () => { installation: { id: 123, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { contents: "write", pull_requests: "write", issues: "write" }, events: [] }, }); await upsertRepositoryFromGitHub(env, { name: "repo", full_name: "owner/repo", private: false, owner: { login: "owner" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); if (opts.premergeContentRecheck !== undefined) { await upsertRepoFocusManifest(env, "owner/repo", { gate: { premergeContentRecheck: opts.premergeContentRecheck } }); } @@ -1681,7 +1681,7 @@ describe("queue processors", () => { }); // No default_branch on the repo record AND no base.ref on the PR record — baseRef resolves to undefined. await upsertRepositoryFromGitHub(env, { name: "repo", full_name: "owner/repo", private: false, owner: { login: "owner" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertRepoFocusManifest(env, "owner/repo", { gate: { premergeContentRecheck: true } }); await upsertPullRequestFromGitHub(env, "owner/repo", { number: 65, title: "No base ref", state: "open", user: { login: "contributor" }, head: { sha: "sha1" }, labels: [], body: "" }); const seen = { closed: false, merged: false, labels: [] as string[], comments: [] as string[], treeCalls: 0 }; @@ -2053,7 +2053,7 @@ describe("queue processors", () => { installation: { id: 123, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { contents: "write", pull_requests: "write", issues: "write" }, events: [] }, }); await upsertRepositoryFromGitHub(env, { name: "repo", full_name: "owner/repo", private: false, owner: { login: "owner" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: opts.autonomy ?? { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/repo", autonomy: opts.autonomy ?? { merge: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); if (opts.guardrailMode !== undefined) { await upsertRepoFocusManifest(env, "owner/repo", { settings: { unlinkedIssueGuardrail: { mode: opts.guardrailMode } } }); } @@ -2179,7 +2179,7 @@ describe("queue processors", () => { autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off", @@ -2338,7 +2338,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2406,7 +2406,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2492,7 +2492,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2533,7 +2533,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2577,7 +2577,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2624,7 +2624,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2663,7 +2663,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2711,7 +2711,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2755,7 +2755,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2793,7 +2793,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -2834,7 +2834,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 1, @@ -2892,7 +2892,7 @@ describe("queue processors", () => { commentMode: "off", publicSurface: "off", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 100, // above SIBLING_COUNT + 1 — this test only cares about concurrency, not closing. }); @@ -2954,7 +2954,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -3009,7 +3009,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -3077,7 +3077,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, // Deliberately NO contributorOpenPrCap here — only the install-wide env cap should catch this. @@ -3142,7 +3142,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -3201,7 +3201,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -3259,7 +3259,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, autoCloseExemptLogins: ["farmer99"], @@ -3320,7 +3320,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -3382,7 +3382,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, }); @@ -3440,7 +3440,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -3496,7 +3496,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -3577,7 +3577,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", // #label-scoping: the cap label/close rides on `close`; the new-account label rides on `review_state_label`. autonomy: { close: "auto", review_state_label: "auto" }, contributorOpenPrCap: 4, @@ -3614,7 +3614,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", review_state_label: "auto" }, contributorOpenPrCap: 2, accountAgeThresholdDays: 30, @@ -3668,7 +3668,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 4, accountAgeThresholdDays: 30, @@ -3703,7 +3703,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", accountAgeThresholdDays: 30, }); const seen = { labels: [] as string[], closed: false }; @@ -3749,7 +3749,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", label: "auto" }, // accountAgeThresholdDays intentionally omitted — off by default. }); @@ -3804,7 +3804,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto", review_state_label: "auto" }, accountAgeThresholdDays: 30, newAccountLabel: "custom-new-account-label", @@ -3837,7 +3837,7 @@ describe("queue processors", () => { await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", // autonomy intentionally omitted — deny-by-default ("observe" for every action class, including "review_state_label"). accountAgeThresholdDays: 30, }); @@ -4233,7 +4233,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -4318,7 +4318,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, @@ -4375,7 +4375,7 @@ describe("queue processors", () => { commentMode: "all_prs", publicSurface: "comment_only", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "advisory", autonomy: { close: "auto", label: "auto" }, contributorOpenPrCap: 2, diff --git a/test/unit/queue-4.test.ts b/test/unit/queue-4.test.ts index 1a7fe17253..2288d77a74 100644 --- a/test/unit/queue-4.test.ts +++ b/test/unit/queue-4.test.ts @@ -264,7 +264,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: over.autonomy ?? { merge: "auto", update_branch: "auto" }, agentPaused: over.agentPaused ?? false, }); @@ -402,7 +402,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, autonomy: { label: "observe" }, // not acting → agent never runs @@ -446,7 +446,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { review_state_label: "auto", request_changes: "auto" }, }); // No confirmed-miner seed → author is unconfirmed; the manifest's linkedIssue:block + no issue fires a @@ -496,7 +496,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { label: "auto" }, }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -538,7 +538,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { review_state_label: "auto" }, agentDryRun: true, }); @@ -587,7 +587,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", }); const calls = { gateChecks: 0, comments: 0, minerList: 0 }; @@ -658,7 +658,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", }); const calls = { gateChecks: 0, comments: 0, minerList: 0 }; @@ -736,7 +736,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", reviewCheckMode: "disabled", linkedIssueGateMode: "off", }); @@ -788,7 +787,6 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", reviewCheckMode: "disabled", linkedIssueGateMode: "off", }); @@ -837,7 +835,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", }); const calls = { minerList: 0, gateChecks: 0, comments: 0 }; @@ -909,7 +907,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", }); @@ -976,7 +974,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", }); const calls = { minerList: 0, gateChecks: 0 }; @@ -1060,7 +1058,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "block", // Also exercise the opt-in slop advisory in the same surface pass: it persists a per-PR assessment @@ -1143,7 +1141,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", }); const patchBodies: Array<{ status?: string; conclusion?: string; output?: { title?: string } }> = []; @@ -1215,7 +1213,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -1286,7 +1284,7 @@ describe("queue processors", () => { autoLabelEnabled: true, createMissingLabel: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -1360,7 +1358,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -1419,7 +1417,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", aiReviewMode: "off", }); @@ -1473,7 +1471,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "off", }); const patchBodies: Array<{ status?: string; conclusion?: string; output?: { title?: string } }> = []; @@ -1525,7 +1523,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, }); @@ -1575,7 +1573,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", requireLinkedIssue: true, }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -1628,7 +1626,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", }); const calls = { gateWrites: 0, commentGets: 0, commentPosts: 0 }; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { @@ -1688,7 +1686,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", }); let commentGets = 0; vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -1739,7 +1737,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", includeMaintainerAuthors: true, commandAuthorization: { default: ["maintainer", "collaborator", "confirmed_miner"], commands: { "review-now": ["maintainer"] } }, }); @@ -1845,7 +1842,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", includeMaintainerAuthors: true, autonomy: { merge: "auto" }, commandAuthorization: { default: ["maintainer"], commands: { "review-now": ["maintainer"] } }, @@ -1935,7 +1932,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", includeMaintainerAuthors: true, // Slop gate on → the rerun must refresh the PR files before evaluating (the guard fires). slopGateMode: "advisory", @@ -2009,7 +2005,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", includeMaintainerAuthors: true, // Even if repo config tries to allow confirmed miners, the checkbox is a maintainer/write-collaborator // control because it mutates the bot's persisted review comment. @@ -2156,7 +2151,6 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "off", includeMaintainerAuthors: true, }); await upsertPullRequestFromGitHub(env, "JSONbored/gittensory", { @@ -2407,7 +2401,7 @@ describe("queue processors", () => { publicSurface: "comment_and_label", autoLabelEnabled: true, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", }); let publicCalls = 0; vi.stubGlobal("fetch", async () => { @@ -2698,7 +2692,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -2885,7 +2879,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3061,7 +3055,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, // The only delta from the #4744 test above: turns on slop evidence collection so `slopBand` is populated @@ -3228,7 +3222,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3351,7 +3345,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3498,7 +3492,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3639,7 +3633,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3811,7 +3805,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -3992,7 +3986,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, }); @@ -4176,7 +4170,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -4254,7 +4248,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", // advisory (NOT block): block mode always reviews the full diff, ignoring exclude_paths/path_filters, so // only advisory mode exercises the filterReviewFilesForAi branch (src/queue/processors.ts). aiReviewMode: "advisory", @@ -4329,7 +4323,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, linkedIssueGateMode: "block", @@ -4493,7 +4487,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, autonomy: { update_branch: "auto" }, qualityGateMode: "advisory", @@ -4729,7 +4723,7 @@ describe("queue processors", () => { it("swallows an estimateReviewEffort failure when persisting the public-stats minutes — the publish still completes", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); const estimateSpy = vi.spyOn(reviewEffortModule, "estimateReviewEffort").mockImplementationOnce(() => { throw new Error("estimator blew up"); }); @@ -4817,7 +4811,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -4886,7 +4880,7 @@ describe("queue processors", () => { }); await persistRegistrySnapshot(env, normalizeRegistryPayload({ "JSONbored/gittensory": { emission_share: 0.01, issue_discovery_share: 0 } }, { kind: "raw-github", url: "https://example.test" }, "2026-05-23T00:00:00.000Z")); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop" }); await upsertPullRequestFromGitHub(env, "JSONbored/gittensory", { number: 77, title: "Held PR", state: "open", user: { login: "contributor" }, head: { sha: "a77" }, labels: [{ name: "manual-review" }], body: "Closes #1" }); await upsertPullRequestDetailSyncState(env, { repoFullName: "JSONbored/gittensory", pullNumber: 77, status: "complete", reviewsSyncedAt: new Date().toISOString() }); // A prior PUBLISHED review for this exact head — the freeze path reuses it (aiReview = frozenReview) instead of @@ -4946,7 +4940,7 @@ describe("queue processors", () => { AI_DAILY_NEURON_BUDGET: "100000", }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop" }); let unifiedCommentBody = ""; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { const url = input.toString(); @@ -5013,7 +5007,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, }); // Seed a FAILED check summary with a per-check WHY (codecov-style) so listCheckSummaries returns it and the @@ -5170,7 +5164,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, }); await upsertPullRequestFromGitHub(env, "JSONbored/gittensory", { @@ -5318,7 +5312,7 @@ describe("queue processors", () => { autoLabelEnabled: false, checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", backfillEnabled: true, }); await upsertPullRequestFromGitHub(env, "JSONbored/gittensory", { @@ -5503,7 +5497,6 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "off", }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -5557,7 +5550,6 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "off", }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); diff --git a/test/unit/queue-lifecycle-guards.test.ts b/test/unit/queue-lifecycle-guards.test.ts index 291578d2f6..ea38a1945a 100644 --- a/test/unit/queue-lifecycle-guards.test.ts +++ b/test/unit/queue-lifecycle-guards.test.ts @@ -260,7 +260,7 @@ describe("agentMaintenanceHeadMatchesGate", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { merge: "auto", approve: "auto", close: "auto" }, }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -1047,7 +1047,7 @@ describe("converted_to_draft gate-close (draft-dodge prevention)", () => { }); await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false, ...overrides, @@ -1175,7 +1175,7 @@ describe("converted_to_draft gate-close (draft-dodge prevention)", () => { }, repositories: [{ name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }], }); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "enabled", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); await recordGateBlockOutcome(env, { repoFullName: "JSONbored/gittensory", pullNumber: 42, headSha: "abc123", blockerCodes: ["missing_linked_issue"] }); await processJob(env, { type: "github-webhook", deliveryId: "draft-dodge-no-write", eventName: "pull_request", payload: draftPayload("contributor") }); @@ -1205,7 +1205,7 @@ describe("converted_to_draft gate-close (draft-dodge prevention)", () => { // No installations row pre-seeded. processGitHubWebhook auto-upserts one from the payload's bare // `installation: { id: 123 }` (no permissions field, as a real pull_request payload carries), so the // resulting row has no explicit pull_requests:write grant — the permission check must fail CLOSED (deny). - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "enabled", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); await recordGateBlockOutcome(env, { repoFullName: "JSONbored/gittensory", pullNumber: 42, headSha: "abc123", blockerCodes: ["missing_linked_issue"] }); await processJob(env, { type: "github-webhook", deliveryId: "draft-dodge-no-install-row", eventName: "pull_request", payload: draftPayload("contributor") }); @@ -1239,7 +1239,7 @@ describe("converted_to_draft gate-close (draft-dodge prevention)", () => { }, repositories: [{ name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }], }); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "enabled", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false }); await recordGateBlockOutcome(env, { repoFullName: "JSONbored/gittensory", pullNumber: 42, headSha: "abc123", blockerCodes: ["missing_linked_issue"] }); // First getInstallation call in processGitHubWebhook (installationActor derivation, unrelated to this fix) // resolves normally; the SECOND call is the draft-dodge readiness check itself -- that one is a genuine D1 @@ -1625,7 +1625,7 @@ describe("converted_to_draft gate-close (draft-dodge prevention)", () => { }); await upsertRepositorySettings(env, { repoFullName: "noslash", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", autonomy: { close: "auto" }, agentPaused: false, }); @@ -3616,7 +3616,7 @@ describe("installation app_id capture + dual-app webhook filter (#selfhost-app-i const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 123, account: { login: "JSONbored", id: 1, type: "User" }, target_type: "User", repository_selection: "all", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await seedWarmPrStateCache(env, "JSONbored/gittensory", 200); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3648,7 +3648,7 @@ describe("installation app_id capture + dual-app webhook filter (#selfhost-app-i const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 123, account: { login: "JSONbored", id: 1, type: "User" }, target_type: "User", repository_selection: "all", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await seedWarmPrStateCache(env, "JSONbored/gittensory", 201); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3704,7 +3704,7 @@ describe("installation app_id capture + dual-app webhook filter (#selfhost-app-i const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", gateCheckMode: "off", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 6, title: "Sweep target", state: "open", user: { login: "contributor" }, head: { sha: "a6" }, base: { ref: "main" }, labels: [], body: "" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -4139,7 +4139,7 @@ describe("auto-action convergence: end-to-end plan+execute for the general heuri commentMode: "off", publicSurface: "off", checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", // the default blocker mechanism for these tests: missing linked issue -> gate failure ...settingsOverrides, }); diff --git a/test/unit/queue.test.ts b/test/unit/queue.test.ts index 8df32f3fa5..92b8dd6ffd 100644 --- a/test/unit/queue.test.ts +++ b/test/unit/queue.test.ts @@ -1115,7 +1115,7 @@ describe("queue processors", () => { autonomy: { merge: "auto" }, aiReviewMode: "advisory", gatePack: "oss-anti-slop", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off", @@ -1163,7 +1163,7 @@ describe("queue processors", () => { autonomy: { merge: "auto" }, aiReviewMode: "block", gatePack: "oss-anti-slop", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off", @@ -1207,7 +1207,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // STORED head is the stale a7; GitHub's LIVE head is b8 (a push the lost synchronize never delivered). await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Drifted PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); let liveFilesFetched = false; @@ -1237,7 +1237,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Current PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); const resyncUpsertSpy = vi.spyOn(repositoriesModule, "upsertPullRequestFromGitHub"); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -1267,7 +1267,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // STORED row still reads open — the `closed` webhook was dropped (relay down); GitHub's LIVE state is closed. await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Closed PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); let filesFetched = false; @@ -1296,7 +1296,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Open PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); let webhookReplayApplied = false; @@ -1327,7 +1327,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); // Seed an UP-TO-DATE reviews-cache marker so this dedup-focused call-count test stays isolated from the // reviews-staleness self-heal (#2537 follow-up) — that behavior has its own dedicated coverage below. @@ -1407,7 +1407,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); // A sync that predates an invalidation (STALE) and no other refresh trigger in play (slop evidence off, // manifest gate off, no pre-merge check paths configured) — proves the sweep's own visit, not some unrelated @@ -1453,7 +1453,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 8, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a8" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); // No reviewsInvalidatedAt at all -- the marker comparison alone would read this as permanently up to date. await upsertPullRequestDetailSyncState(env, { @@ -1493,7 +1493,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); await upsertPullRequestDetailSyncState(env, { repoFullName: "owner/agent-repo", pullNumber: 7, status: "complete", reviewsSyncedAt: new Date().toISOString() }); // mockRejectedValue (not -Once): an earlier getPullRequestDetailSyncState read inside the resync/readiness @@ -1532,7 +1532,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), GITHUB_PUBLIC_TOKEN: "public-token" }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", approve: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", approve: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Clean PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); let gateFinalized = false; let failedMaintenanceMint = false; @@ -1586,7 +1586,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Pending CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); const requiredContextsSpy = vi .spyOn(backfillModule, "fetchRequiredStatusContexts") @@ -1631,7 +1631,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Still running CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -1679,7 +1679,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Missing aggregate CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); const requiredContextsSpy = vi.spyOn(backfillModule, "fetchRequiredStatusContexts").mockResolvedValue(null); const liveCiSpy = vi.spyOn(backfillModule, "fetchLiveCiAggregatePreferGraphQl").mockResolvedValue({ @@ -1723,7 +1723,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Stale optional CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -1782,7 +1782,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Permanently stuck CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -1858,7 +1858,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Permanently stuck CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -1928,7 +1928,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 8, title: "Permanently stuck CI, audit write fails", state: "open", user: { login: "contributor" }, head: { sha: "b8" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -1982,7 +1982,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 9, title: "Permanently stuck CI, repeat defer audit write fails", state: "open", user: { login: "contributor" }, head: { sha: "c9" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -2044,7 +2044,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Stale missing aggregate CI", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); await env.SELFHOST_TRANSIENT_CACHE?.set( @@ -2095,7 +2095,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Missing required context, within cap", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); // 1 minute elapsed: under the new 2-minute missing-required-context cap AND under the old 30-minute cap — @@ -2151,7 +2151,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Missing required context, past short cap", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); vi.setSystemTime(new Date("2026-05-28T02:00:00.000Z")); // 3 minutes elapsed: past the 2-minute missing-required-context surfacing cap, but nowhere near the old @@ -2209,7 +2209,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "CI completeness unverified", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); const requiredContextsSpy = vi.spyOn(backfillModule, "fetchRequiredStatusContexts").mockResolvedValue(null); const liveCiSpy = vi.spyOn(backfillModule, "fetchLiveCiAggregatePreferGraphQl").mockResolvedValue({ @@ -2251,7 +2251,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "CI fully verified", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); const requiredContextsSpy = vi.spyOn(backfillModule, "fetchRequiredStatusContexts").mockResolvedValue(new Set(["trusted-required-ci"])); const liveCiSpy = vi.spyOn(backfillModule, "fetchLiveCiAggregatePreferGraphQl").mockResolvedValue({ @@ -2305,7 +2305,7 @@ describe("queue processors", () => { autonomy: { close: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off", @@ -2465,7 +2465,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", issues: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { close: "auto", review_state_label: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "No hard rule enabled", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #9" }); const requiredContextsSpy = requiredContextsMock(); const liveCiSpy = liveCiMock(); @@ -2499,7 +2499,7 @@ describe("queue processors", () => { // keeps both passes comparable: it satisfies isAgentConfigured, but the action executor STAGES the merge // for approval instead of ever calling the GitHub merge endpoint, so the PR stays open with the same // head_sha across both passes. - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto_with_approval", update_branch: "auto_with_approval" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto_with_approval", update_branch: "auto_with_approval" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Cross-job CI cache", state: "open", user: { login: "contributor" }, head: { sha: headSha }, base: { ref: "main" }, labels: [], body: "Closes #1" }); return { env }; } @@ -2872,7 +2872,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Fold-all vs configured", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); let branchProtectionGets = 0; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { @@ -2931,7 +2931,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, autoMaintain: { requireApprovals: 0, mergeMethod: "squash" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Configured + clean", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); await upsertPullRequestDetailSyncState(env, { repoFullName: "owner/agent-repo", pullNumber: 7, status: "complete", reviewsSyncedAt: new Date().toISOString() }); // gate.expectedCiContexts is satisfied by a real, passing check-run — so CI resolves cleanly and the pass @@ -2978,7 +2978,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Branch protection drift", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); // expectedCiContexts is configured ONCE and never changes across the two calls below -- only branch protection // (the OTHER input to mergeRequiredCiContexts) drifts between them. @@ -3027,7 +3027,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: { pull_requests: "write", checks: "write" }, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto", update_branch: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Spaced context drift", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, base: { ref: "main" }, labels: [], body: "Closes #1" }); await upsertRepoFocusManifest(env, "owner/agent-repo", { gate: { expectedCiContexts: ["lint"] } }); let requiredContextsFromBranchProtection: Array = []; @@ -3072,7 +3072,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Drifted PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); // The live head drifted (b8 ≠ a7), so the resync upsert fires — but it REJECTS. The `.catch(() => undefined)` // must swallow it so the sweep proceeds on the stored `pr` rather than stalling (#sweep-resync fail-open). @@ -3102,7 +3102,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Current PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); await repositoriesModule.markPullRequestSurfacePublished(env, "owner/agent-repo", 7, "a7"); // marker says current, but GitHub may still show a stale/partial panel let checkRunsFetched = false; @@ -3127,7 +3127,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), GITTENSORY_REVIEW_REPOS: "owner/agent-repo" }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Current PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); await repositoriesModule.markPullRequestSurfacePublished(env, "owner/agent-repo", 7, "a7"); let checkRunsFetched = false; @@ -3205,7 +3205,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // Links issue #1 — the issue the "labeled" event below fires on. await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1", created_at: "2026-07-03T10:00:00.000Z" }); let fetchCount = 0; @@ -3248,7 +3248,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem(), GITTENSORY_REVIEW_REPOS: "owner/agent-repo" }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); // Links issue #99 — the "labeled" event below fires on issue #1, which this PR does NOT link. await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Unrelated PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #99" }); let checkRunsFetched = false; @@ -3293,7 +3293,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1", created_at: "2026-07-03T10:00:00.000Z" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3336,7 +3336,7 @@ describe("queue processors", () => { await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); // Every autonomy class left at the deny-by-default "observe" floor — isAgentConfigured is false, same as // isConvergenceRepoAllowed, so this repo has genuinely opted into nothing. - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { review: "observe" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { review: "observe" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3405,7 +3405,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1", created_at: "2026-07-03T10:00:00.000Z" }); // A CI completion for this exact PR claimed the CI-completion window moments earlier — a wholly separate // trigger from the issue-side label change below. @@ -3457,7 +3457,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1", created_at: "2026-07-03T10:00:00.000Z" }); let fetchCallCount = 0; vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { @@ -3517,7 +3517,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (let number = 1; number <= SWEEP_MAX_PRS + 2; number += 1) { await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Linking PR ${number}`, state: "open", user: { login: "contributor" }, head: { sha: `a${number}` }, labels: [], body: "Closes #1" }); } @@ -3569,7 +3569,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (let number = 1; number <= ISSUE_WAKE_MAX_PRS + 2; number += 1) { await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Linking PR ${number}`, state: "open", user: { login: "contributor" }, head: { sha: `a${number}` }, labels: [], body: "Closes #1" }); } @@ -3610,7 +3610,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (const number of [10, 11, 12]) { await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Sibling PR ${number}`, state: "open", user: { login: "contributor" }, head: { sha: `sib${number}` }, labels: [], body: "No linked issue.", created_at: `2026-07-0${number - 9}T00:00:00.000Z` }); } @@ -3658,7 +3658,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (const number of [10, 11, 12]) { await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Sibling PR ${number}`, state: "open", user: { login: "contributor" }, head: { sha: `sib${number}` }, labels: [], body: "No linked issue." }); } @@ -3701,7 +3701,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); for (let number = 1; number <= MERGE_WAKE_MAX_PRS + 2; number += 1) { await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number, title: `Sibling PR ${number}`, state: "open", user: { login: "contributor" }, head: { sha: `sib${number}` }, labels: [], body: "No linked issue." }); } @@ -3754,7 +3754,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3816,7 +3816,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3867,7 +3867,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Linking PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -3914,7 +3914,7 @@ describe("queue processors", () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "off", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Rebased PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); await repositoriesModule.markPullRequestSurfacePublished(env, "owner/agent-repo", 7, "a7"); // published at the OLD head a7 let checkRunsFetchedAtNewHead = false; @@ -3944,7 +3944,7 @@ describe("queue processors", () => { it("#4 over-publish dedup: a failing surface-published stamp is swallowed (fail-open) — the publish still completes", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); const stampSpy = vi.spyOn(repositoriesModule, "markPullRequestSurfacePublished").mockRejectedValueOnce(new Error("D1 stamp failed")); let commentPosted = false; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { @@ -3984,7 +3984,7 @@ describe("queue processors", () => { it("REGRESSION (registry-never-synced lane fix): a contributor PR panel does not show the lane-unavailable hold when no registry snapshot has ever synced", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); let commentBody = ""; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { const url = input.toString(); @@ -4047,7 +4047,7 @@ describe("queue processors", () => { ), ); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); let commentBody = ""; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { const url = input.toString(); @@ -4099,7 +4099,7 @@ describe("queue processors", () => { it("#regate-churn: a failing markAiReviewPublished stamp is swallowed (fail-open) — the publish still completes", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: false, owner: { login: "JSONbored" } }, 123); - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", gateCheckMode: "enabled", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", commentMode: "all_prs", publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "off", reviewCheckMode: "required", aiReviewMode: "off", gatePack: "oss-anti-slop" }); const markSpy = vi.spyOn(repositoriesModule, "markAiReviewPublished").mockRejectedValueOnce(new Error("D1 stamp failed")); let commentPosted = false; vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { @@ -4154,7 +4154,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", ...overrides, @@ -4648,7 +4648,7 @@ describe("queue processors", () => { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", linkedIssueGateMode: "block", requireLinkedIssue: true, autonomy: { merge: "observe", request_changes: "observe" }, @@ -4909,7 +4909,7 @@ describe("queue processors", () => { publicSurface: "comment_only", autoLabelEnabled: false, checkRunMode: "enabled", - gateCheckMode: "enabled", reviewCheckMode: "required", + reviewCheckMode: "required", aiReviewMode: "block", gatePack: "oss-anti-slop", }); @@ -7106,7 +7106,7 @@ describe("queue processors", () => { }); await upsertInstallation(env, { action: "created", installation: { id: 9001, account: { login: "owner", id: 1, type: "Organization" }, target_type: "Organization", repository_selection: "selected", permissions: {}, events: [] } }); await upsertRepositoryFromGitHub(env, { name: "agent-repo", full_name: "owner/agent-repo", private: false, owner: { login: "owner" } }, 9001); - await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "block", gatePack: "oss-anti-slop", gateCheckMode: "enabled", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); + await upsertRepositorySettings(env, { repoFullName: "owner/agent-repo", autonomy: { merge: "auto" }, aiReviewMode: "block", gatePack: "oss-anti-slop", reviewCheckMode: "required", checkRunMode: "off", commentMode: "off", publicSurface: "off" }); await upsertPullRequestFromGitHub(env, "owner/agent-repo", { number: 7, title: "Stale PR", state: "open", user: { login: "contributor" }, head: { sha: "a7" }, labels: [], body: "Closes #1" }); await upsertPullRequestFile(env, { repoFullName: "owner/agent-repo", pullNumber: 7, path: "src/a.ts", status: "modified", additions: 1, deletions: 0, changes: 1, payload: { patch: "@@\n+export const ok = value.length;" } }); // Pre-seed the AI review for this exact head SHA + mode → the sweep's block-mode review must reuse it, not re-run. diff --git a/test/unit/registration-readiness.test.ts b/test/unit/registration-readiness.test.ts index 23e0d6e4c9..4e0046ef47 100644 --- a/test/unit/registration-readiness.test.ts +++ b/test/unit/registration-readiness.test.ts @@ -41,7 +41,6 @@ function settingsFor(repoFullName: string, overrides: Partial { it("describes a quiet public surface while keeping the opt-in gate check enabled", () => { const repo = repoFor("octo/quiet-gate", configFor({ repo: "octo/quiet-gate" })); - const settings = settingsFor(repo.fullName, { publicSurface: "off", gateCheckMode: "enabled", reviewCheckMode: "required" }); + const settings = settingsFor(repo.fullName, { publicSurface: "off", reviewCheckMode: "required" }); const report = buildRegistrationReadiness({ repoFullName: repo.fullName, repo, diff --git a/test/unit/repo-policy-readiness.test.ts b/test/unit/repo-policy-readiness.test.ts index f686cc2c13..c26aeeb76d 100644 --- a/test/unit/repo-policy-readiness.test.ts +++ b/test/unit/repo-policy-readiness.test.ts @@ -19,7 +19,6 @@ function settings(overrides: Partial = {}): RepositorySettin publicSignalLevel: "standard", checkRunMode: "enabled", checkRunDetailLevel: "standard", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", diff --git a/test/unit/repo-profile.test.ts b/test/unit/repo-profile.test.ts index 0a9fdf1d72..15645f7da7 100644 --- a/test/unit/repo-profile.test.ts +++ b/test/unit/repo-profile.test.ts @@ -249,7 +249,6 @@ describe("extractRepoProfile (#2999)", () => { await seedChunk(env, "src/widget.ts", "x"); await upsertRepositorySettings(env, { repoFullName: REPO, - gateCheckMode: "off", checkRunMode: "off", reviewCheckMode: "required", }); @@ -267,7 +266,6 @@ describe("extractRepoProfile (#2999)", () => { // gate.checkMode still gets reported as publishing one. await upsertRepositorySettings(env, { repoFullName: REPO, - gateCheckMode: "enabled", checkRunMode: "enabled", reviewCheckMode: "disabled", }); diff --git a/test/unit/repository-settings-enforcement.test.ts b/test/unit/repository-settings-enforcement.test.ts index f66aa29651..3b92e580f0 100644 --- a/test/unit/repository-settings-enforcement.test.ts +++ b/test/unit/repository-settings-enforcement.test.ts @@ -15,7 +15,6 @@ function settings(over: Partial = {}): RepositorySettings { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "standard", - gateCheckMode: "enabled", regateSweepOrderMode: "staleness", reviewCheckMode: "required", gatePack: "gittensor", diff --git a/test/unit/reputation-wiring.test.ts b/test/unit/reputation-wiring.test.ts index 40ce114508..d044f1a11c 100644 --- a/test/unit/reputation-wiring.test.ts +++ b/test/unit/reputation-wiring.test.ts @@ -475,7 +475,7 @@ describe("processGitHubWebhook records the reputation outcome on a terminal PR ( // GITTENSORY_REVIEW_UNIFIED_COMMENT on so the closing-PR comment path takes the unified-renderer branch. const env = createTestEnv({ GITTENSORY_REVIEW_REPUTATION: "true", GITTENSORY_REVIEW_UNIFIED_COMMENT: "true" }); // Gate enabled so the closing-PR public-surface path (skipped-gate + unified closed comment) executes. - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "enabled" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory" }); // External calls (token/miner/github) are best-effort + caught; stub them so nothing throws. vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); @@ -580,7 +580,7 @@ describe("processGitHubWebhook records the reputation outcome on a terminal PR ( // Reputation ON, but the PR is still OPEN and the gate does not route it to manual → undefined outcome. const env = createTestEnv({ GITTENSORY_REVIEW_REPUTATION: "true" }); // Gate OFF for this repo so the open PR's gate is `undefined` (not failure/action_required) → no "manual". - await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", gateCheckMode: "off", publicSurface: "off", commentMode: "off" }); + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", publicSurface: "off", commentMode: "off" }); vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { const url = input.toString(); if (url.includes("/access_tokens")) return Response.json({ token: "installation-token" }); diff --git a/test/unit/safety.test.ts b/test/unit/safety.test.ts index 759e8eb857..8dd01427e4 100644 --- a/test/unit/safety.test.ts +++ b/test/unit/safety.test.ts @@ -67,7 +67,6 @@ async function seedGateEnabledRepo(env: Env): Promise { publicSurface: "off", autoLabelEnabled: false, checkRunMode: "off", - gateCheckMode: "enabled", reviewCheckMode: "required", slopGateMode: "advisory", // turns the shared gateFiles load on so the reuse branch is hit }); diff --git a/test/unit/self-dogfood-registration-pack.test.ts b/test/unit/self-dogfood-registration-pack.test.ts index 043ad8e8d4..0a468e2d0f 100644 --- a/test/unit/self-dogfood-registration-pack.test.ts +++ b/test/unit/self-dogfood-registration-pack.test.ts @@ -54,7 +54,6 @@ function settingsFor(repoFullName: string, overrides: Partial = {}): RepositorySettin publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "standard", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", @@ -303,7 +302,7 @@ describe("buildRepoSettingsPreview", () => { const gateOff = buildSampleCheckRunReadiness({ repoFullName: repo.fullName, repo, - settings: settings({ checkRunMode: "enabled", checkRunDetailLevel: "standard", gateCheckMode: "off" }), + settings: settings({ checkRunMode: "enabled", checkRunDetailLevel: "standard" }), issues, pullRequests, sample: { authorLogin: "miner", authorAssociation: "CONTRIBUTOR", minerStatus: "confirmed", title: "Sample", labels: [], linkedIssues: [] }, @@ -313,12 +312,12 @@ describe("buildRepoSettingsPreview", () => { const gateOn = buildSampleCheckRunReadiness({ repoFullName: repo.fullName, repo, - settings: settings({ checkRunMode: "enabled", checkRunDetailLevel: "standard", gateCheckMode: "enabled" }), + settings: settings({ checkRunMode: "enabled", checkRunDetailLevel: "standard" }), issues, pullRequests, sample: { authorLogin: "miner", authorAssociation: "CONTRIBUTOR", minerStatus: "confirmed", title: "Sample", labels: [], linkedIssues: [] }, body: null, - decision: decidePublicSurface({ settings: settings({ checkRunMode: "enabled", gateCheckMode: "enabled" }), authorLogin: "miner", minerStatus: "confirmed" }), + decision: decidePublicSurface({ settings: settings({ checkRunMode: "enabled" }), authorLogin: "miner", minerStatus: "confirmed" }), }); expect(gateOff?.components.length).toBeGreaterThan(0); expect(gateOn?.components.length).toBeGreaterThan(0); @@ -342,7 +341,7 @@ describe("buildRepoSettingsPreview", () => { it("explains a missing Checks: write permission when the opt-in gate is enabled", () => { const preview = buildRepoSettingsPreview({env: {}, ...base, - settings: settings({ publicSurface: "off", commentMode: "off", autoLabelEnabled: false, gateCheckMode: "enabled", reviewCheckMode: "required" }), + settings: settings({ publicSurface: "off", commentMode: "off", autoLabelEnabled: false, reviewCheckMode: "required" }), installation: { ...healthyInstall, status: "needs_attention", missingPermissions: ["checks"] }, sample: { authorLogin: "contributor", minerStatus: "not_found" }, }); diff --git a/test/unit/signals-coverage.test.ts b/test/unit/signals-coverage.test.ts index d658591e6f..2f22e630d7 100644 --- a/test/unit/signals-coverage.test.ts +++ b/test/unit/signals-coverage.test.ts @@ -801,27 +801,27 @@ describe("signal coverage edge cases", () => { const KEYS = ["linkedIssue", "relatedWork", "reviewLoad", "validationEvidence", "openPrQueue", "contributorContext", "gateResult"]; // Provided gate is authoritative; gate enabled → a real gate action (not the advisory-only copy). - const provided = buildPublicPrPanelSignalRows({ ...baseArgs, settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled", reviewCheckMode: "required" }, gate: { conclusion: "success", summary: "Passing" } }); + const provided = buildPublicPrPanelSignalRows({ ...baseArgs, settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" }, gate: { conclusion: "success", summary: "Passing" } }); expect(provided.rows.map((r) => r.key)).toEqual(KEYS); expect(typeof provided.readinessTotal).toBe("number"); const providedGate = provided.rows.find((r) => r.key === "gateResult")!; expect(providedGate.cells[2]).not.toBe("Advisory only."); // Gate check NOT enabled → fallback success conclusion + the advisory-only action/next-step. - const advisory = buildPublicPrPanelSignalRows({ ...baseArgs, settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" } }); + const advisory = buildPublicPrPanelSignalRows({ ...baseArgs, settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" } }); const advisoryGate = advisory.rows.find((r) => r.key === "gateResult")!; expect(advisoryGate.cells[2]).toBe("Advisory only."); expect(advisoryGate.cells[3]).toBe("No action."); // No gate + enabled + unknown repo → neutral fallback (distinct from the passing cell). - const neutral = buildPublicPrPanelSignalRows({ ...baseArgs, repo: null, settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled", reviewCheckMode: "required" } }); + const neutral = buildPublicPrPanelSignalRows({ ...baseArgs, repo: null, settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" } }); expect(neutral.rows.find((r) => r.key === "gateResult")!.cells[1]).not.toBe(providedGate.cells[1]); // No gate + enabled + a hard linked-issue block (no linked issue, no rationale) → failure fallback. const blocked = buildPublicPrPanelSignalRows({ ...baseArgs, pr: pr(directRepo.fullName, 71, "No issue", { authorLogin: "miner", linkedIssues: [], body: "just a change" }), - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled", reviewCheckMode: "required", linkedIssueGateMode: "block" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required", linkedIssueGateMode: "block" }, }); expect(blocked.rows).toHaveLength(7); expect(blocked.rows.find((r) => r.key === "gateResult")!.cells[1]).not.toBe(providedGate.cells[1]); @@ -836,7 +836,7 @@ describe("signal coverage edge cases", () => { ...baseArgs, collisions: dupCollisions, queueHealth: buildQueueHealth(directRepo, [dupIssue], [baseArgs.pr, dupPr], dupCollisions), - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled", reviewCheckMode: "required", duplicatePrGateMode: "block" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required", duplicatePrGateMode: "block" }, }); expect(duplicateBlocked.rows).toHaveLength(7); // The duplicate cluster surfaces in the related-work row, and the gate falls back to the failing cell. @@ -1141,7 +1141,7 @@ describe("signal coverage edge cases", () => { }); const collisions = buildCollisionReport(directRepo.fullName, [dupIssue], [winnerPr, loserPr]); const queueHealth = buildQueueHealth(directRepo, [dupIssue], [winnerPr, loserPr], collisions); - const blockSettings = { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled" as const, reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }; + const blockSettings = { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }; const profile = buildContributorProfile("miner", { login: "miner", topLanguages: ["TypeScript"], source: "github" }, [], []); const detection = { detected: true, source: "official_gittensor_api" as const, reason: "Confirmed.", priorPullRequests: 1, priorMergedPullRequests: 0, priorIssues: 0 }; const preflightFor = (target: PullRequestRecord) => @@ -1233,7 +1233,7 @@ describe("signal coverage edge cases", () => { queueHealth: buildQueueHealth(directRepo, [duplicateIssue], [winnerPr, siblingPr], collisions), collisions, preflight: buildPreflightResult({ repoFullName: directRepo.fullName, title: winnerPr.title, body: winnerPr.body ?? undefined, linkedIssues: winnerPr.linkedIssues }, directRepo, [duplicateIssue], [winnerPr, siblingPr]), - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled" as const, reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }, duplicateWinnerEnabled: true, }; const retainedSameIssueView = buildDuplicateWinnerRelatedWorkView({ @@ -1288,7 +1288,7 @@ describe("signal coverage edge cases", () => { ); const profile = buildContributorProfile("dev", { login: "dev", topLanguages: ["TypeScript"], source: "github" }, [currentPr], []); const detection = { detected: true, source: "github_cache" as const, reason: "cached contributor", priorPullRequests: 1, priorMergedPullRequests: 0, priorIssues: 0 }; - const gateSettings = { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled" as const, reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }; + const gateSettings = { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" as const, duplicatePrGateMode: "block" as const }; const collisionComment = buildPublicPrIntelligenceComment({env: {}, repo: directRepo, @@ -1410,7 +1410,7 @@ describe("signal coverage edge cases", () => { queueHealth: buildQueueHealth(directRepo, [], [currentPr], buildCollisionReport(directRepo.fullName, [], [currentPr])), collisions: buildCollisionReport(directRepo.fullName, [], [currentPr]), preflight: buildPreflightResult({ repoFullName: directRepo.fullName, title: "Fix isolated issue", body: "Fixes #99", linkedIssues: [99] }, directRepo, [], [currentPr]), - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, aiReview: { notes: "The change is currently unsafe to merge.\n\n**Blockers**\n- `src/a.ts` has a syntax error.\n\n**Nits (1)**\n- Add a regression test." }, }); expect(aiBlockedComment).toContain("> [!CAUTION]"); @@ -1426,7 +1426,7 @@ describe("signal coverage edge cases", () => { queueHealth: buildQueueHealth(directRepo, [], [currentPr], buildCollisionReport(directRepo.fullName, [], [currentPr])), collisions: buildCollisionReport(directRepo.fullName, [], [currentPr]), preflight: buildPreflightResult({ repoFullName: directRepo.fullName, title: "Fix isolated issue", body: "Fixes #99", linkedIssues: [99] }, directRepo, [], [currentPr]), - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, aiReview: { notes: "The change is focused.\n\n**Blockers**\n- None.\n\n**Nits (1)**\n- Add a regression test." }, }); expect(aiExplicitNoBlockersComment).toContain("> [!TIP]"); @@ -1450,7 +1450,7 @@ describe("signal coverage edge cases", () => { ), findings: [{ code: "public_warning", severity: "warning", title: "Validation note missing", detail: "Validation evidence is not cached yet." }], }, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, }); expect(advisoryOnlyComment).toContain("> [!WARNING]"); @@ -1486,7 +1486,7 @@ describe("signal coverage edge cases", () => { queueHealth, collisions, preflight, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, }); expect(duplicateAdvisoryComment).toContain("Same-issue duplicate risk found against #8."); expect(duplicateAdvisoryComment).toContain("> | Related work | ⚠️ Same linked issue: #8 | Another open PR references the same linked issue. | Compare #8. |"); @@ -1514,7 +1514,7 @@ describe("signal coverage edge cases", () => { collisions: scopedClusters, findings: [], }, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, }); expect(scopedComment).toContain("> | Related work | ⚠️ 3 scoped overlaps | Top overlaps are listed below; lower-confidence bulk is hidden. | Review top overlaps. |"); expect(scopedComment).toContain("Additional title-only matches omitted; title-only overlap does not block."); @@ -1561,7 +1561,7 @@ describe("signal coverage edge cases", () => { collisions: preflightClusters, findings: [], }, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, }); // PR-specific clusters = {pr-cluster} (1); preflight clusters = 2 disjoint -> 3 distinct overlaps. // Old code used Math.max(1, 2) = 2; the union (3) is the correct count feeding the related-work row. @@ -1596,7 +1596,7 @@ describe("signal coverage edge cases", () => { queueHealth, collisions, preflight, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled", reviewCheckMode: "required" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" }, }); expect(comment).toContain("> | Related work | ✅ No active overlap found | No same-issue or scoped active PR overlap found. | No action. |"); @@ -1655,7 +1655,7 @@ describe("signal coverage edge cases", () => { queueHealth: buildQueueHealth(directRepo, [], [currentPr], buildCollisionReport(directRepo.fullName, [], [currentPr])), collisions: buildCollisionReport(directRepo.fullName, [], [currentPr]), preflight: basePreflight, - settings: { ...repoSettings(directRepo.fullName), publicAudienceMode: "gittensor_only", gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), publicAudienceMode: "gittensor_only", reviewCheckMode: "disabled" }, }); expect(officialComment).toContain("Confirmed Gittensor contributor context was checked"); expect(officialComment).toContain("Official Gittensor activity: 4 PR(s), 3 issue(s)."); @@ -1679,7 +1679,7 @@ describe("signal coverage edge cases", () => { queueHealth: buildQueueHealth(directRepo, [], [currentPr], edgeCollisions), collisions: edgeCollisions, preflight: basePreflight, - settings: { ...repoSettings(directRepo.fullName), gateCheckMode: "off", reviewCheckMode: "disabled" }, + settings: { ...repoSettings(directRepo.fullName), reviewCheckMode: "disabled" }, }); expect(edgeComment).toContain("Related work: Only this PR is present."); expect(edgeComment).toContain("merged PR #11"); @@ -1733,7 +1733,7 @@ describe("signal coverage edge cases", () => { Array.from({ length: 16 }, (_, index) => pr(directRepo.fullName, 100 + index, `Open PR ${index}`)), buildCollisionReport(directRepo.fullName, [], []), ); - const settings = { ...repoSettings(directRepo.fullName), gateCheckMode: "enabled" as const, reviewCheckMode: "required" as const, qualityGateMode: "block" as const, qualityGateMinScore: 95 }; + const settings = { ...repoSettings(directRepo.fullName), reviewCheckMode: "required" as const, qualityGateMode: "block" as const, qualityGateMinScore: 95 }; const comment = buildPublicPrIntelligenceComment({env: {}, repo: directRepo, pr: currentPr, @@ -2451,7 +2451,6 @@ function repoSettings(repoFullName: string): RepositorySettings { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", diff --git a/test/unit/signals-v2.test.ts b/test/unit/signals-v2.test.ts index 284306c207..12fad755a8 100644 --- a/test/unit/signals-v2.test.ts +++ b/test/unit/signals-v2.test.ts @@ -2101,7 +2101,6 @@ describe("v2 signal builders", () => { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", diff --git a/test/unit/signals.test.ts b/test/unit/signals.test.ts index 05e874b273..88418bc253 100644 --- a/test/unit/signals.test.ts +++ b/test/unit/signals.test.ts @@ -502,7 +502,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "standard" as const, checkRunMode: "off" as const, checkRunDetailLevel: "minimal" as const, - gateCheckMode: "off" as const, regateSweepOrderMode: "staleness" as const, reviewCheckMode: "disabled" as const, gatePack: "gittensor" as const, @@ -557,7 +556,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "standard" as const, checkRunMode: "off" as const, checkRunDetailLevel: "minimal" as const, - gateCheckMode: "off" as const, regateSweepOrderMode: "staleness" as const, reviewCheckMode: "disabled" as const, gatePack: "gittensor" as const, @@ -632,7 +630,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", @@ -716,7 +713,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", @@ -833,7 +829,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "minimal", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", @@ -904,7 +899,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "minimal", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", @@ -1019,7 +1013,6 @@ describe("world-class backend signals", () => { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor", diff --git a/test/unit/unified-comment-parity.test.ts b/test/unit/unified-comment-parity.test.ts index b496f0d2a2..19a30fb02b 100644 --- a/test/unit/unified-comment-parity.test.ts +++ b/test/unit/unified-comment-parity.test.ts @@ -52,7 +52,6 @@ const settings: RepositorySettings = { publicSignalLevel: "standard", checkRunMode: "off", checkRunDetailLevel: "minimal", - gateCheckMode: "off", regateSweepOrderMode: "staleness", reviewCheckMode: "disabled", gatePack: "gittensor",