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
@@ -1,4 +1,4 @@
import { Hono, type Context } from "hono";

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Open PR queue is busy

This repo has a busy open PR queue in the local Gittensory cache.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

PR author has maintainer association

This PR appears to come from a maintainer-associated account.
import { z } from "zod";
import { analyzePRQueue, type AuthorRole, type ChecksStatus } from "../queue-intelligence";
import { completeGitHubWebOAuth, createSessionFromGitHubToken, pollGitHubDeviceFlow, startGitHubDeviceFlow, startGitHubWebOAuth } from "../auth/github-oauth";
Expand Down Expand Up @@ -3972,6 +3972,7 @@

const EXTENSION_PULL_CONTEXT_PATH = "/v1/extension/pull-context";
const EXTENSION_PULL_CONTEXT_SCOPE = "extension:pull_context";
const LINT_PR_TEXT_PATH = "/v1/lint/pr-text";

type ProtectedRouteContext = {
env: Env;
Expand Down Expand Up @@ -4012,6 +4013,7 @@
if (isRepoAiConfigPath(path)) return true;
if (isRepoCheckBeforeStartPath(path)) return true;
if (isRepoContributorIssueDraftGeneratePath(path)) return true;
if (path === LINT_PR_TEXT_PATH) return true;
if (path === EXTENSION_PULL_CONTEXT_PATH && isExtensionScopedSession(identity)) return true;
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions test/integration/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

Check notice on line 1 in test/integration/api.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.

Check notice on line 1 in test/integration/api.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Open PR queue is busy

This repo has a busy open PR queue in the local Gittensory cache.

Check notice on line 1 in test/integration/api.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

PR author has maintainer association

This PR appears to come from a maintainer-associated account.
import { createSessionForGitHubUser, hashToken } from "../../src/auth/security";
import {
upsertBounty,
Expand Down Expand Up @@ -958,6 +958,19 @@
expect(lintPrTextBody).toMatchObject({ verdict: "weak", fixes: expect.any(Array) });
expect(JSON.stringify(lintPrTextBody)).not.toMatch(/hotkey|coldkey|wallet|payout|reward/i);

const { token: lintSessionToken } = await createSessionForGitHubUser(env, { login: "ordinary-mcp-user", id: 4242 });
const sessionLintPrText = await app.request(
"/v1/lint/pr-text",
{
method: "POST",
headers: { authorization: `Bearer ${lintSessionToken}`, "content-type": "application/json" },
body: JSON.stringify({ commitMessages: ["fix: handle cache reconnect"], prBody: "Fixes #7\n\nValidated with npm test." }),
},
env,
);
expect(sessionLintPrText.status).toBe(200);
await expect(sessionLintPrText.json()).resolves.toMatchObject({ verdict: expect.stringMatching(/strong|adequate|weak/) });

const invalidLintPrText = await app.request("/v1/lint/pr-text", { method: "POST", headers: apiHeaders(env), body: JSON.stringify({ linkedIssue: -1 }) }, env);
expect(invalidLintPrText.status).toBe(400);

Expand Down