Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ const repositorySettingsSchema = z.object({
checkRunMode: z.enum(["off", "enabled"]).default("off"),
checkRunDetailLevel: z.enum(["minimal", "standard", "deep"]).default("standard"),
gateCheckMode: z.enum(["off", "enabled"]).default("off"),
gatePack: z.enum(["gittensor", "oss-anti-slop"]).default("gittensor"),
linkedIssueGateMode: z.enum(["off", "advisory", "block"]).default("advisory"),
duplicatePrGateMode: z.enum(["off", "advisory", "block"]).default("block"),
qualityGateMode: z.enum(["off", "advisory", "block"]).default("advisory"),
Expand Down Expand Up @@ -2602,6 +2603,7 @@ export function createApp() {
checkRunMode: parsed.data.checkRunMode,
checkRunDetailLevel: parsed.data.checkRunDetailLevel,
gateCheckMode: parsed.data.gateCheckMode,
gatePack: parsed.data.gatePack,
linkedIssueGateMode: parsed.data.linkedIssueGateMode,
duplicatePrGateMode: parsed.data.duplicatePrGateMode,
qualityGateMode: parsed.data.qualityGateMode,
Expand Down
1 change: 1 addition & 0 deletions src/db/repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ export async function upsertRepositorySettings(env: Env, settings: Partial<Repos
checkRunMode: resolved.checkRunMode,
checkRunDetailLevel: resolved.checkRunDetailLevel,
gateCheckMode: resolved.gateCheckMode,
gatePack: resolved.gatePack,
linkedIssueGateMode: resolved.linkedIssueGateMode,
duplicatePrGateMode: resolved.duplicatePrGateMode,
qualityGateMode: resolved.qualityGateMode,
Expand Down
4 changes: 3 additions & 1 deletion test/integration/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5596,6 +5596,7 @@ describe("api routes", () => {
body: JSON.stringify({
commentMode: "detected_contributors_only",
publicSignalLevel: "minimal",
gatePack: "oss-anti-slop",
commandAuthorization: { default: ["maintainer"], commands: { preflight: ["pr_author"], "queue-summary": ["maintainer", "collaborator"] } },
}),
},
Expand All @@ -5605,12 +5606,13 @@ describe("api routes", () => {
await expect(updated.json()).resolves.toMatchObject({
commentMode: "detected_contributors_only",
publicSignalLevel: "minimal",
gatePack: "oss-anti-slop",
commandAuthorization: { default: ["maintainer"], commands: expect.objectContaining({ preflight: ["pr_author"] }) },
});

const settings = await app.request("/v1/repos/entrius/allways-ui/settings", { headers: apiHeaders(env) }, env);
expect(settings.status).toBe(200);
await expect(settings.json()).resolves.toMatchObject({ commentMode: "detected_contributors_only", commandAuthorization: { commands: expect.objectContaining({ preflight: ["pr_author"] }) } });
await expect(settings.json()).resolves.toMatchObject({ commentMode: "detected_contributors_only", gatePack: "oss-anti-slop", commandAuthorization: { commands: expect.objectContaining({ preflight: ["pr_author"] }) } });

const preview = await app.request(
"/v1/repos/entrius/allways-ui/settings-preview",
Expand Down
2 changes: 2 additions & 0 deletions test/unit/data-spine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ describe("data spine repositories", () => {
// gatePack (#692) round-trips and defaults to gittensor.
await upsertRepositorySettings(env, { repoFullName: "owner/repo", gatePack: "oss-anti-slop" });
expect((await getRepositorySettings(env, "owner/repo")).gatePack).toBe("oss-anti-slop");
await upsertRepositorySettings(env, { repoFullName: "owner/repo", gatePack: "gittensor", linkedIssueGateMode: "block" });
expect(await getRepositorySettings(env, "owner/repo")).toMatchObject({ gatePack: "gittensor", linkedIssueGateMode: "block" });
await upsertRepositorySettings(env, { repoFullName: "owner/defaultpack" });
expect((await getRepositorySettings(env, "owner/defaultpack")).gatePack).toBe("gittensor");
// slop gate (#530/#532) round-trips and defaults to off.
Expand Down