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
145 changes: 145 additions & 0 deletions apps/loopover-ui/public/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14652,6 +14652,80 @@
"privateSummary"
]
},
"PullRequestAiReviewFindings": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"ready",
"not_found",
"ai_review_off"
]
},
"repoFullName": {
"type": "string"
},
"pullNumber": {
"type": "number"
},
"login": {
"type": "string"
},
"headSha": {
"type": "string",
"nullable": true
},
"findings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"category": {
"type": "string"
},
"path": {
"type": "string"
},
"severity": {
"type": "string",
"enum": [
"blocker",
"nit"
]
},
"line": {
"type": "number"
},
"body": {
"type": "string"
}
},
"required": [
"category",
"path",
"severity",
"line",
"body"
]
}
},
"categoryCounts": {
"type": "object",
"additionalProperties": {
"type": "number"
}
}
},
"required": [
"status",
"repoFullName",
"pullNumber",
"login",
"findings",
"categoryCounts"
]
},
"FindingTaxonomyDocument": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -17050,6 +17124,77 @@
]
}
},
"/v1/repos/{owner}/{repo}/pulls/{number}/ai-review-findings": {
"get": {
"summary": "A PR author's own structured, published AI-review findings",
"parameters": [
{
"schema": {
"type": "string"
},
"required": true,
"name": "owner",
"in": "path"
},
{
"schema": {
"type": "string"
},
"required": true,
"name": "repo",
"in": "path"
},
{
"schema": {
"type": "string"
},
"required": true,
"name": "number",
"in": "path"
},
{
"schema": {
"type": "string",
"minLength": 1,
"example": "jsonbored"
},
"required": true,
"description": "GitHub login of the pull request's author -- the caller must be this same login.",
"name": "login",
"in": "query"
}
],
"responses": {
"200": {
"description": "Structured, published AI-review findings for the caller's own pull request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PullRequestAiReviewFindings"
}
}
}
},
"400": {
"description": "Missing login"
},
"403": {
"description": "The pull request belongs to a different contributor"
},
"404": {
"description": "Pull request not found"
}
},
"security": [
{
"LoopOverBearer": []
},
{
"LoopOverSessionCookie": []
}
]
}
},
"/v1/contributors/{login}/profile": {
"get": {
"summary": "Contributor evidence profile",
Expand Down
20 changes: 20 additions & 0 deletions src/openapi/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2822,6 +2822,26 @@ export const PullRequestReviewabilitySchema = z
})
.openapi("PullRequestReviewability");

export const PullRequestAiReviewFindingsSchema = z
.object({
status: z.enum(["ready", "not_found", "ai_review_off"]),
repoFullName: z.string(),
pullNumber: z.number(),
login: z.string(),
headSha: z.string().nullable().optional(),
findings: z.array(
z.object({
category: z.string(),
path: z.string(),
severity: z.enum(["blocker", "nit"]),
line: z.number(),
body: z.string(),
}),
),
categoryCounts: z.record(z.string(), z.number()),
})
.openapi("PullRequestAiReviewFindings");

export const RegistryChangeReportSchema = z
.object({
generatedAt: z.string(),
Expand Down
22 changes: 22 additions & 0 deletions src/openapi/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
MaintainerNoiseReportSchema,
AmsMinerCohortComparisonSchema,
McpCompatibilitySchema,
PullRequestAiReviewFindingsSchema,
PullRequestMaintainerPacketSchema,
PullRequestReviewIntelligenceSchema,
PullRequestReviewabilitySchema,
Expand Down Expand Up @@ -173,6 +174,7 @@ export function buildOpenApiSpec() {
registry.register("MaintainerNoiseReport", MaintainerNoiseReportSchema);
registry.register("AmsMinerCohortComparison", AmsMinerCohortComparisonSchema);
registry.register("PullRequestReviewability", PullRequestReviewabilitySchema);
registry.register("PullRequestAiReviewFindings", PullRequestAiReviewFindingsSchema);

registry.registerPath({
method: "get",
Expand Down Expand Up @@ -758,6 +760,26 @@ export function buildOpenApiSpec() {
200: { description: "Private PR reviewability score and maintainer action", content: { "application/json": { schema: PullRequestReviewabilitySchema } } },
},
});
registry.registerPath({
method: "get",
path: "/v1/repos/{owner}/{repo}/pulls/{number}/ai-review-findings",
summary: "A PR author's own structured, published AI-review findings",
request: {
params: z.object({ owner: z.string(), repo: z.string(), number: z.string() }),
query: z.object({
login: z.string().min(1).openapi({
param: { description: "GitHub login of the pull request's author -- the caller must be this same login." },
example: "jsonbored",
}),
}),
},
responses: {
200: { description: "Structured, published AI-review findings for the caller's own pull request", content: { "application/json": { schema: PullRequestAiReviewFindingsSchema } } },
400: { description: "Missing login" },
403: { description: "The pull request belongs to a different contributor" },
404: { description: "Pull request not found" },
},
});
registry.registerPath({
method: "get",
path: "/v1/contributors/{login}/profile",
Expand Down
3 changes: 3 additions & 0 deletions test/unit/openapi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("OpenAPI contract", () => {
expect(spec.paths["/v1/repos/{owner}/{repo}/gittensor-config-recommendation"]).toBeDefined();
expect(spec.paths["/v1/repos/{owner}/{repo}/pulls/{number}/maintainer-packet"]).toBeDefined();
expect(spec.paths["/v1/repos/{owner}/{repo}/pulls/{number}/reviewability"]).toBeDefined();
expect(spec.paths["/v1/repos/{owner}/{repo}/pulls/{number}/ai-review-findings"]).toBeDefined();
expect(spec.paths["/v1/contributors/{login}/profile"]).toBeDefined();
expect(spec.paths["/v1/contributors/{login}/decision-pack"]).toBeDefined();
expect(spec.paths["/v1/contributors/{login}/open-pr-monitor"]).toBeDefined();
Expand Down Expand Up @@ -100,6 +101,8 @@ describe("OpenAPI contract", () => {
expect(spec.components?.schemas?.GittensorConfigRecommendation).toBeDefined();
expect(spec.components?.schemas?.PullRequestMaintainerPacket).toBeDefined();
expect(spec.components?.schemas?.PullRequestReviewability).toBeDefined();
expect(spec.components?.schemas?.PullRequestAiReviewFindings).toBeDefined();
expect(JSON.stringify(spec.components?.schemas?.PullRequestAiReviewFindings)).toContain("categoryCounts");
expect(spec.components?.schemas?.LocalBranchAnalysis).toBeDefined();
expect(spec.components?.schemas?.RepoSettingsPreview).toBeDefined();
expect(spec.components?.schemas?.InstallationRepair).toBeDefined();
Expand Down
Loading