From c3ea3b0dd2d19768f2ff9659d5bbddad879e9fcb Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 10:18:07 +0200 Subject: [PATCH 1/5] feat: add command response previews --- apps/gittensory-ui/public/openapi.json | 289 +++++++++++++++++-- src/api/routes.ts | 379 ++++++++++++++++++++++++- src/openapi/schemas.ts | 63 ++++ src/openapi/spec.ts | 15 +- test/integration/api.test.ts | 350 ++++++++++++++++++++++- test/unit/openapi.test.ts | 2 + 6 files changed, 1059 insertions(+), 39 deletions(-) diff --git a/apps/gittensory-ui/public/openapi.json b/apps/gittensory-ui/public/openapi.json index 867e3ced1d..31bb455e42 100644 --- a/apps/gittensory-ui/public/openapi.json +++ b/apps/gittensory-ui/public/openapi.json @@ -7327,6 +7327,269 @@ "summary" ] }, + "CommandPreviewResponse": { + "type": "object", + "properties": { + "generatedAt": { + "type": "string" + }, + "command": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "command": { + "type": "string" + }, + "audience": { + "type": "string" + }, + "boundary": { + "type": "string" + }, + "description": { + "type": "string" + }, + "endpoint": { + "type": "string" + } + }, + "required": [ + "id", + "command", + "audience", + "boundary", + "description", + "endpoint" + ] + }, + "request": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "preview": { + "type": "object", + "properties": { + "boundary": { + "type": "string", + "enum": [ + "public", + "public-safe", + "private-api", + "private-mcp" + ] + }, + "endpoint": { + "type": "string" + }, + "target": { + "type": "string" + }, + "body": { + "type": "string" + }, + "missingPermissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "permissionDiagnostics": { + "type": "array", + "items": { + "type": "object", + "properties": { + "permission": { + "type": "string" + }, + "requiredAccess": { + "type": "string" + }, + "currentAccess": { + "type": "string" + }, + "ok": { + "type": "boolean" + }, + "action": { + "type": "string" + } + }, + "required": [ + "permission", + "requiredAccess", + "currentAccess", + "ok", + "action" + ] + } + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "decision": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "ready", + "skipped", + "missing_permission", + "private_api" + ] + }, + "willComment": { + "type": "boolean" + }, + "willLabel": { + "type": "boolean" + }, + "willCheckRun": { + "type": "boolean" + }, + "skipped": { + "type": "boolean" + }, + "skipReason": { + "type": "string", + "nullable": true + }, + "actions": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "comment", + "label", + "check_run", + "skip", + "none" + ] + } + }, + "summary": { + "type": "string" + } + }, + "required": [ + "status", + "willComment", + "willLabel", + "willCheckRun", + "skipped", + "skipReason", + "actions", + "summary" + ] + }, + "sample": { + "type": "object", + "properties": { + "pullNumber": { + "type": "number" + }, + "authorLogin": { + "type": "string" + }, + "authorType": { + "type": "string" + }, + "authorAssociation": { + "type": "string" + }, + "commenterLogin": { + "type": "string" + }, + "commenterAssociation": { + "type": "string" + }, + "minerStatus": { + "type": "string", + "enum": [ + "confirmed", + "not_found", + "unavailable" + ] + }, + "title": { + "type": "string" + }, + "body": { + "type": "string", + "nullable": true + }, + "labels": { + "type": "array", + "items": { + "type": "string" + } + }, + "linkedIssues": { + "type": "array", + "items": { + "type": "number" + } + } + }, + "required": [ + "pullNumber", + "authorLogin", + "authorType", + "authorAssociation", + "commenterLogin", + "commenterAssociation", + "minerStatus", + "title", + "body", + "labels", + "linkedIssues" + ] + }, + "sanitizer": { + "type": "object", + "properties": { + "passed": { + "type": "boolean" + }, + "forbiddenTerms": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "passed", + "forbiddenTerms" + ] + } + }, + "required": [ + "boundary", + "endpoint", + "target", + "body", + "missingPermissions", + "permissionDiagnostics", + "warnings", + "decision" + ] + } + }, + "required": [ + "generatedAt", + "command", + "request", + "preview" + ] + }, "AgentRun": { "type": "object", "properties": { @@ -11646,27 +11909,11 @@ "post": { "responses": { "200": { - "description": "Live app mutation or preview response", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - } - } - }, - "201": { - "description": "Created", + "description": "Maintainer dry-run preview of a sanitized @gittensory command response (no GitHub mutation)", "content": { "application/json": { "schema": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "$ref": "#/components/schemas/CommandPreviewResponse" } } } @@ -11676,6 +11923,12 @@ }, "401": { "description": "Unauthorized" + }, + "403": { + "description": "Insufficient app role" + }, + "404": { + "description": "Command not found" } }, "security": [ diff --git a/src/api/routes.ts b/src/api/routes.ts index 44b7f71c9f..1abcb399ca 100644 --- a/src/api/routes.ts +++ b/src/api/routes.ts @@ -95,9 +95,16 @@ import { } from "../github/backfill"; import { contributorRepoStatsFromGittensor, fetchGittensorContributorSnapshot } from "../gittensor/api"; import { fetchPublicContributorProfile } from "../github/public"; -import { GITTENSORY_MENTION_COMMAND_CATALOG } from "../github/commands"; +import { + buildPublicAgentCommandComment, + buildMaintainerQueueDigest, + GITTENSORY_MENTION_COMMAND_CATALOG, + isAuthorizedCommandActor, + isMaintainerOnlyCommand, + sanitizePublicComment, + type GittensoryMentionCommandName, +} from "../github/commands"; import { handleGitHubWebhook } from "../github/webhook"; -import { sanitizePublicComment } from "../github/commands"; import { handleMcpRequest } from "../mcp/server"; import { buildOpenApiSpec } from "../openapi/spec"; import { generateSignalSnapshots } from "../queue/processors"; @@ -171,6 +178,7 @@ import type { JsonValue, ProductUsageOutcome, ProductUsageSurface, + PullRequestRecord, RepoSyncSegmentRecord, RepositoryRecord, } from "../types"; @@ -414,6 +422,23 @@ const commandPreviewSchema = z repoFullName: z.string().min(3).max(MAX_LOCAL_BRANCH_REF_CHARS).optional(), pullNumber: z.number().int().positive().optional(), login: z.string().min(1).max(MAX_LOCAL_BRANCH_REF_CHARS).optional(), + sample: z + .object({ + authorLogin: z.string().trim().min(1).max(100).optional(), + authorType: z.enum(["User", "Bot"]).optional(), + authorAssociation: z.enum(["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MANNEQUIN", "NONE"]).optional(), + commenterLogin: z.string().trim().min(1).max(100).optional(), + commenterAssociation: z.enum(["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR", "FIRST_TIMER", "FIRST_TIME_CONTRIBUTOR", "MANNEQUIN", "NONE"]).optional(), + minerStatus: z.enum(["confirmed", "not_found", "unavailable"]).optional(), + title: z.string().max(300).optional(), + body: z.string().max(10000).nullable().optional(), + labels: z.array(z.string().max(100)).max(50).optional(), + linkedIssues: z.array(z.number().int().positive()).max(50).optional(), + permissions: z.record(z.string()).optional(), + missingPermissions: z.array(z.string().max(100)).max(50).optional(), + }) + .strict() + .optional(), }) .strict(); @@ -959,13 +984,23 @@ export function createApp() { ); app.post("/v1/app/commands/preview", async (c) => { + const forbidden = await requireAppRole(c, ["maintainer", "owner", "operator"]); + if (forbidden) return forbidden; const body = await c.req.json().catch(() => null); const parsed = commandPreviewSchema.safeParse(body); if (!parsed.success) return c.json({ error: "invalid_command_preview_request", issues: parsed.error.issues }, 400); const command = APP_COMMANDS.find((candidate) => candidate.command === parsed.data.command || candidate.id === parsed.data.command.replace(/^@gittensory\s+/, "")); if (!command) return c.json({ error: "command_not_found" }, 404); - const identity = await authenticateRequestIdentity(c).catch(() => null); - const preview = buildCommandPreview(command, parsed.data); + const identity = await authenticateRequestIdentity(c); + const [repo, pullRequest] = await Promise.all([ + parsed.data.repoFullName ? getRepository(c.env, parsed.data.repoFullName) : Promise.resolve(null), + parsed.data.repoFullName && parsed.data.pullNumber ? getPullRequest(c.env, parsed.data.repoFullName, parsed.data.pullNumber) : Promise.resolve(null), + ]); + const repoForbidden = await requireCommandPreviewRepoAccess(c, identity, parsed.data.repoFullName, repo); + if (repoForbidden) return repoForbidden; + const installationId = repo?.installationId ?? null; + const installation = installationId !== null ? await getInstallationHealth(c.env, installationId) : null; + const preview = buildCommandPreview(command, parsed.data, { repo, installation, pullRequest }); await recordRouteProductUsage(c, { surface: "control_panel", eventName: "command_previewed", @@ -2144,7 +2179,7 @@ const APP_COMMANDS = [ endpoint: "/v1/app/commands/preview", }, ...GITTENSORY_MENTION_COMMAND_CATALOG.filter( - (command) => !["help", "preflight", "blockers", "packet", "queue-summary", "review-now", "needs-author", "confirmed-miners", "duplicate-clusters"].includes(command.id), + (command) => !["preflight", "blockers", "packet", "queue-summary", "review-now", "needs-author", "confirmed-miners", "duplicate-clusters"].includes(command.id), ).map((command) => ({ id: command.id, command: `@gittensory ${command.id}`, @@ -2271,18 +2306,324 @@ function buildMaintainerSettingsPreview() { }; } -function buildCommandPreview(command: (typeof APP_COMMANDS)[number], request: z.infer) { +const PREVIEWABLE_MENTION_COMMANDS = new Set(GITTENSORY_MENTION_COMMAND_CATALOG.map((command) => command.id)); + +type CommandPreviewDecision = { + status: "ready" | "skipped" | "missing_permission" | "private_api"; + willComment: boolean; + willLabel: boolean; + willCheckRun: boolean; + skipped: boolean; + skipReason: string | null; + actions: Array<"comment" | "label" | "check_run" | "skip" | "none">; + summary: string; +}; + +function buildCommandPreview( + command: (typeof APP_COMMANDS)[number], + request: z.infer, + context: { repo: RepositoryRecord | null; installation: InstallationHealthRecord | null; pullRequest: PullRequestRecord | null }, +) { const target = request.repoFullName ? `${request.repoFullName}${request.pullNumber ? `#${request.pullNumber}` : ""}` : "selected target"; - if (command.id === "public-summary") { + const mentionCommandName = previewableMentionCommandName(command.id); + if (!mentionCommandName) { + return buildPrivateApiCommandPreview(command, request, target); + } + + const sample = buildCommandPreviewSample(request, context.pullRequest); + const missingPermissions = commandPreviewMissingPermissions(request, context.installation); + const permissionWarnings = commandPreviewPermissionWarnings(missingPermissions); + const officialAuthorDetection = + sample.minerStatus === "confirmed" + ? { status: "confirmed" as const, snapshot: sampleMinerSnapshot(sample.authorLogin) } + : sample.minerStatus === "unavailable" + ? { status: "unavailable" as const, error: "Official miner detection is unavailable in this preview scenario." } + : { status: "not_found" as const }; + const authorization = isAuthorizedCommandActor({ + commandName: mentionCommandName, + commenterLogin: sample.commenterLogin, + commenterAssociation: sample.commenterAssociation, + pullRequestAuthorLogin: sample.authorLogin, + officialAuthorDetection, + }); + + const base = { + boundary: "public" as const, + endpoint: "GitHub issue comment", + target, + sample, + missingPermissions, + permissionDiagnostics: permissionWarnings.map((warning) => ({ + permission: warning.permission, + requiredAccess: warning.requiredAccess, + currentAccess: warning.currentAccess, + ok: false, + action: warning.action, + })), + warnings: permissionWarnings.map((warning) => warning.message), + }; + + if (!request.repoFullName || !request.pullNumber) { + const summary = commandPreviewSkipSummary("missing_target"); + const body = sanitizePublicComment(`Gittensory would not post a public command response for ${target}: ${summary}`); + return { + ...base, + body, + sanitizer: commandPreviewSanitizer(body), + decision: commandPreviewDecision({ + status: "skipped", + willComment: false, + skipReason: "missing_target", + summary, + }), + }; + } + + if (!authorization.authorized) { + const body = sanitizePublicComment(`Gittensory would not post a public command response for ${target}: ${commandPreviewSkipSummary(authorization.reason)}.`); + return { + ...base, + body, + sanitizer: commandPreviewSanitizer(body), + decision: commandPreviewDecision({ + status: "skipped", + willComment: false, + skipReason: authorization.reason, + summary: commandPreviewSkipSummary(authorization.reason), + }), + }; + } + + if (missingPermissions.includes("issues")) { + const summary = "GitHub App permission Issues: write is required before a command response can be posted."; + const body = sanitizePublicComment(`Gittensory preview is ready for ${target}, but ${summary}`); return { - boundary: "public", - body: `Gittensory can summarize public-safe context for ${target}. Private scorer details stay out of the PR thread.`, + ...base, + body, + sanitizer: commandPreviewSanitizer(body), + decision: commandPreviewDecision({ + status: "missing_permission", + willComment: false, + skipReason: "missing_permission", + summary, + }), }; } + + const issue = { + number: sample.pullNumber, + title: sample.title, + state: "open", + ...(request.repoFullName && request.pullNumber ? { html_url: `https://github.com/${request.repoFullName}/pull/${request.pullNumber}` } : {}), + user: { login: sample.authorLogin }, + author_association: sample.authorAssociation, + labels: sample.labels.map((name) => ({ name })), + body: sample.body, + pull_request: {}, + }; + const pullRequest = buildCommandPreviewPullRequest(request, sample, context.pullRequest); + const body = + command.id === "public-summary" + ? `Gittensory can summarize public-safe context for ${target}. Private scorer details stay out of the PR thread.` + : buildPublicAgentCommandComment({ + command: { name: mentionCommandName, raw: `@gittensory ${mentionCommandName}` }, + repo: context.repo, + issue, + pullRequest, + actorKind: authorization.actorKind === "maintainer" ? "maintainer" : "author", + officialMiner: officialAuthorDetection.status === "confirmed" ? officialAuthorDetection.snapshot : null, + maintainerDigest: isMaintainerOnlyCommand(mentionCommandName) + ? buildMaintainerQueueDigest({ + repo: context.repo, + issues: [], + pullRequests: [pullRequest], + confirmedMinerLogins: sample.minerStatus === "confirmed" ? [sample.authorLogin] : [], + }) + : null, + }); + + return { + ...base, + body, + sanitizer: commandPreviewSanitizer(body), + decision: commandPreviewDecision({ + status: "ready", + willComment: true, + skipReason: null, + summary: "Gittensory would post this sanitized command response and would not create labels or check runs.", + }), + }; +} + +function buildPrivateApiCommandPreview(command: (typeof APP_COMMANDS)[number], request: z.infer, target: string) { return { boundary: command.boundary, endpoint: command.endpoint, + target, body: `${command.command} will call ${command.endpoint} for ${target}${request.login ? ` as ${request.login}` : ""}.`, + missingPermissions: [], + permissionDiagnostics: [], + warnings: [], + decision: commandPreviewDecision({ + status: "private_api", + willComment: false, + skipReason: null, + summary: "Private API preview only; no GitHub comment, label, or check run would be created.", + }), + }; +} + +function previewableMentionCommandName(commandId: string): GittensoryMentionCommandName | null { + if (PREVIEWABLE_MENTION_COMMANDS.has(commandId as GittensoryMentionCommandName)) return commandId as GittensoryMentionCommandName; + if (commandId === "public-summary") return "help"; + return null; +} + +function commandPreviewDecision(args: { + status: CommandPreviewDecision["status"]; + willComment: boolean; + skipReason: string | null; + summary: string; +}): CommandPreviewDecision { + return { + status: args.status, + willComment: args.willComment, + willLabel: false, + willCheckRun: false, + skipped: args.status === "skipped" || args.status === "missing_permission", + skipReason: args.skipReason, + actions: args.willComment ? ["comment"] : args.status === "private_api" ? ["none"] : ["skip"], + summary: args.summary, + }; +} + +function buildCommandPreviewSample(request: z.infer, pullRequest: PullRequestRecord | null) { + const sample = request.sample ?? {}; + const authorLogin = sample.authorLogin?.trim() || pullRequest?.authorLogin || request.login || "sample-contributor"; + const commenterAssociation = + sample.commenterAssociation ?? (isMaintainerOnlyCommand(previewableMentionCommandName(request.command.replace(/^@gittensory\s+/, "")) ?? "help") ? "OWNER" : "NONE"); + return { + pullNumber: request.pullNumber ?? pullRequest?.number ?? 1, + authorLogin, + authorType: sample.authorType ?? "User", + authorAssociation: sample.authorAssociation ?? pullRequest?.authorAssociation ?? "NONE", + commenterLogin: sample.commenterLogin?.trim() || request.login || authorLogin, + commenterAssociation, + minerStatus: sample.minerStatus ?? "confirmed", + title: sample.title?.trim() || pullRequest?.title || "Sample pull request", + body: sample.body ?? pullRequest?.body ?? null, + labels: sample.labels ?? pullRequest?.labels ?? [], + linkedIssues: sample.linkedIssues ?? pullRequest?.linkedIssues ?? [], + }; +} + +function buildCommandPreviewPullRequest( + request: z.infer, + sample: ReturnType, + pullRequest: PullRequestRecord | null, +): PullRequestRecord { + return { + repoFullName: request.repoFullName ?? pullRequest?.repoFullName ?? "selected/repository", + number: sample.pullNumber, + title: sample.title, + state: pullRequest?.state ?? "open", + authorLogin: sample.authorLogin, + authorAssociation: sample.authorAssociation, + headSha: pullRequest?.headSha ?? "preview-head-sha", + headRef: pullRequest?.headRef ?? "preview-branch", + baseRef: pullRequest?.baseRef ?? "main", + htmlUrl: pullRequest?.htmlUrl ?? (request.repoFullName && sample.pullNumber ? `https://github.com/${request.repoFullName}/pull/${sample.pullNumber}` : null), + mergedAt: null, + isDraft: pullRequest?.isDraft ?? false, + mergeableState: pullRequest?.mergeableState ?? null, + reviewDecision: pullRequest?.reviewDecision ?? null, + body: sample.body, + createdAt: pullRequest?.createdAt ?? nowIso(), + updatedAt: pullRequest?.updatedAt ?? nowIso(), + labels: sample.labels, + linkedIssues: sample.linkedIssues, + }; +} + +function commandPreviewMissingPermissions(request: z.infer, installation: InstallationHealthRecord | null): string[] { + const configured = new Set([...(installation?.missingPermissions ?? []), ...(request.sample?.missingPermissions ?? [])]); + const permissions = request.sample?.permissions ?? installation?.permissions; + if (permissions && permissions.issues !== "write") configured.add("issues"); + return [...configured].sort(); +} + +function commandPreviewPermissionWarnings(missingPermissions: string[]) { + return missingPermissions.map((permission) => { + const requiredAccess = "write"; + const currentAccess = "missing"; + return { + permission, + requiredAccess, + currentAccess, + action: `Set repository permission ${permission} to ${requiredAccess}, then approve the GitHub App permission change.`, + message: + permission === "issues" + ? "Command responses require GitHub App permission Issues: write; preview will not post while it is missing." + : `GitHub App permission ${permission}: ${requiredAccess} is missing for this preview scenario.`, + }; + }); +} + +function commandPreviewSanitizer(body: string) { + const forbiddenTerms = [ + "wallet", + "hotkey", + "raw trust", + "trust score", + "payout", + "reward estimate", + "farming", + "scoreability", + "public score estimate", + ].filter((term) => new RegExp(term, "i").test(body)); + return { passed: forbiddenTerms.length === 0, forbiddenTerms }; +} + +function commandPreviewSkipSummary(reason: string): string { + const summaries: Record = { + missing_target: "public command previews require a repository and pull request number.", + maintainer_command_requires_maintainer: "maintainer-only commands require an owner, member, or collaborator invocation.", + not_maintainer_or_pr_author: "the commenter is neither a maintainer nor the pull request author.", + miner_detection_unavailable: "official Gittensor miner detection is unavailable, so Gittensory would skip rather than guess.", + pr_author_not_confirmed_miner: "the pull request author is not a confirmed Gittensor miner.", + }; + return summaries[reason] ?? reason.replace(/_/g, " "); +} + +function sampleMinerSnapshot(login: string) { + return { + source: "gittensor_api" as const, + githubId: `preview-${login}`, + githubUsername: login, + isEligible: true, + credibility: 1, + eligibleRepoCount: 1, + issueDiscoveryScore: 0, + issueTokenScore: 0, + issueCredibility: 1, + isIssueEligible: false, + issueEligibleRepoCount: 0, + alphaPerDay: 0, + taoPerDay: 0, + usdPerDay: 0, + totals: { + pullRequests: 1, + mergedPullRequests: 0, + openPullRequests: 1, + closedPullRequests: 0, + openIssues: 0, + closedIssues: 0, + solvedIssues: 0, + validSolvedIssues: 0, + }, + repositories: [], + pullRequests: [], + issueLabels: [], }; } @@ -2684,6 +3025,26 @@ async function requireContributorAccess(c: ProtectedRouteContext, login: string) return null; } +async function requireCommandPreviewRepoAccess( + c: ProtectedRouteContext, + identity: AuthIdentity | null, + repoFullName: string | undefined, + repo: RepositoryRecord | null, +): Promise { + /* v8 ignore next -- The broad route role guard already authenticates protected preview requests. */ + if (!identity) return c.json({ error: "unauthorized" }, 401); + if (identity.kind !== "session" || !repoFullName) return null; + const summary = await loadControlPanelRoleSummary(c.env, identity.actor); + if (summary.roles.includes("operator")) return null; + const scope = await loadControlPanelAccessScope(c.env, identity.actor); + const requestedRepo = repoFullName.toLowerCase(); + const scopedRepoNames = new Set(scope.repositoryFullNames.map((name) => name.toLowerCase())); + if (scopedRepoNames.has(requestedRepo)) return null; + if (repo?.installationId !== undefined && repo.installationId !== null && scope.installationIds.includes(repo.installationId)) return null; + if (repo && scope.accountLogins.some((login) => login.toLowerCase() === repo.owner.toLowerCase())) return null; + return c.json({ error: "forbidden_repo" }, 403); +} + function requiresApiToken(path: string): boolean { if (path === "/health") return false; if (path === "/v1/mcp/compatibility") return false; diff --git a/src/openapi/schemas.ts b/src/openapi/schemas.ts index 4a1d5209cc..ae80156c26 100644 --- a/src/openapi/schemas.ts +++ b/src/openapi/schemas.ts @@ -598,6 +598,69 @@ export const RepoSettingsPreviewSchema = z }) .openapi("RepoSettingsPreview"); +export const CommandPreviewResponseSchema = z + .object({ + generatedAt: z.string(), + command: z.object({ + id: z.string(), + command: z.string(), + audience: z.string(), + boundary: z.string(), + description: z.string(), + endpoint: z.string(), + }), + request: z.record(z.unknown()), + preview: z.object({ + boundary: z.enum(["public", "public-safe", "private-api", "private-mcp"]), + endpoint: z.string(), + target: z.string(), + body: z.string(), + missingPermissions: z.array(z.string()), + permissionDiagnostics: z.array( + z.object({ + permission: z.string(), + requiredAccess: z.string(), + currentAccess: z.string(), + ok: z.boolean(), + action: z.string(), + }), + ), + warnings: z.array(z.string()), + decision: z.object({ + status: z.enum(["ready", "skipped", "missing_permission", "private_api"]), + willComment: z.boolean(), + willLabel: z.boolean(), + willCheckRun: z.boolean(), + skipped: z.boolean(), + skipReason: z.string().nullable(), + actions: z.array(z.enum(["comment", "label", "check_run", "skip", "none"])), + summary: z.string(), + }), + sample: z + .object({ + pullNumber: z.number(), + authorLogin: z.string(), + authorType: z.string(), + authorAssociation: z.string(), + commenterLogin: z.string(), + commenterAssociation: z.string(), + minerStatus: z.enum(["confirmed", "not_found", "unavailable"]), + title: z.string(), + body: z.string().nullable(), + labels: z.array(z.string()), + linkedIssues: z.array(z.number()), + }) + .optional(), + sanitizer: z + .object({ + passed: z.boolean(), + forbiddenTerms: z.array(z.string()), + }) + .optional(), + }), + }) + .openapi("CommandPreviewResponse"); + export const RepoSyncStateSchema = z .object({ repoFullName: z.string(), diff --git a/src/openapi/spec.ts b/src/openapi/spec.ts index ff0929ad38..cf0f52ac79 100644 --- a/src/openapi/spec.ts +++ b/src/openapi/spec.ts @@ -12,6 +12,7 @@ import { BurdenForecastSchema, CollisionReportSchema, ConfigQualitySchema, + CommandPreviewResponseSchema, ContributorFitSchema, ContributorIntakeHealthSchema, ContributorOutcomeHistorySchema, @@ -114,6 +115,7 @@ export function buildOpenApiSpec() { registry.register("BountyLifecycleEvents", BountyLifecycleEventsSchema); registry.register("RepositorySettings", RepositorySettingsSchema); registry.register("RepoSettingsPreview", RepoSettingsPreviewSchema); + registry.register("CommandPreviewResponse", CommandPreviewResponseSchema); registry.register("AgentRun", AgentRunSchema); registry.register("AgentAction", AgentActionSchema); registry.register("AgentContextSnapshot", AgentContextSnapshotSchema); @@ -594,7 +596,18 @@ export function buildOpenApiSpec() { }, }); } - for (const path of ["/v1/app/commands/preview", "/v1/app/commands/feedback", "/v1/app/digest/subscriptions"]) { + registry.registerPath({ + method: "post", + path: "/v1/app/commands/preview", + responses: { + 200: { description: "Maintainer dry-run preview of a sanitized @gittensory command response (no GitHub mutation)", content: { "application/json": { schema: CommandPreviewResponseSchema } } }, + 400: { description: "Invalid request" }, + 401: { description: "Unauthorized" }, + 403: { description: "Insufficient app role" }, + 404: { description: "Command not found" }, + }, + }); + for (const path of ["/v1/app/commands/feedback", "/v1/app/digest/subscriptions"]) { registry.registerPath({ method: "post", path, diff --git a/test/integration/api.test.ts b/test/integration/api.test.ts index 18a2075676..ee3c311629 100644 --- a/test/integration/api.test.ts +++ b/test/integration/api.test.ts @@ -1362,6 +1362,48 @@ describe("api routes", () => { ownerEnv, ); expect(ownerExtensionMissingPull.status).toBe(400); + const ownerRepoPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: ownerHeaders, + body: JSON.stringify({ command: "plan-next-work", repoFullName: "repo-owner/owned-repo" }), + }, + ownerEnv, + ); + expect(ownerRepoPreview.status).toBe(200); + const ownerGenericPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: ownerHeaders, + body: JSON.stringify({ command: "plan-next-work" }), + }, + ownerEnv, + ); + expect(ownerGenericPreview.status).toBe(200); + const forbiddenVictimPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: ownerHeaders, + body: JSON.stringify({ command: "plan-next-work", repoFullName: "victim-org/secret-repo" }), + }, + ownerEnv, + ); + expect(forbiddenVictimPreview.status).toBe(403); + await expect(forbiddenVictimPreview.json()).resolves.toMatchObject({ error: "forbidden_repo" }); + const { token: operatorToken } = await createSessionForGitHubUser(ownerEnv, { login: "jsonbored", id: 1 }); + const operatorVictimPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: { cookie: `gittensory_session=${operatorToken}`, "content-type": "application/json" }, + body: JSON.stringify({ command: "plan-next-work", repoFullName: "victim-org/secret-repo" }), + }, + ownerEnv, + ); + expect(operatorVictimPreview.status).toBe(200); const minerNeedsRefresh = await app.request("/v1/app/miner-dashboard?login=oktofeesh1", { headers: apiHeaders(env) }, env); expect(minerNeedsRefresh.status).toBe(200); @@ -1644,7 +1686,7 @@ describe("api routes", () => { const commands = await app.request("/v1/app/commands", { headers: apiHeaders(env) }, env); expect(commands.status).toBe(200); await expect(commands.json()).resolves.toMatchObject({ - commands: expect.arrayContaining([expect.objectContaining({ id: "public-summary" })]), + commands: expect.arrayContaining([expect.objectContaining({ id: "help" }), expect.objectContaining({ id: "public-summary" })]), }); const publicPreview = await app.request( @@ -1657,22 +1699,168 @@ describe("api routes", () => { env, ); expect(publicPreview.status).toBe(200); - await expect(publicPreview.json()).resolves.toMatchObject({ - preview: { boundary: "public", body: expect.stringContaining("entrius/allways-ui#12") }, + const publicPreviewBody = await publicPreview.json(); + expect(publicPreviewBody).toMatchObject({ + preview: { boundary: "public", body: expect.stringContaining("entrius/allways-ui#12"), decision: { status: "ready", willComment: true, willLabel: false, willCheckRun: false } }, + }); + + const commandResponsePreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", pullNumber: 12, login: "oktofeesh1" }), + }, + env, + ); + expect(commandResponsePreview.status).toBe(200); + const commandResponsePreviewBody = (await commandResponsePreview.json()) as { preview: { body: string } }; + expect(commandResponsePreviewBody).toMatchObject({ + preview: { + boundary: "public", + endpoint: "GitHub issue comment", + decision: { status: "ready", willComment: true, willLabel: false, willCheckRun: false }, + sanitizer: { passed: true, forbiddenTerms: [] }, + body: expect.stringContaining("### Gittensory preflight"), + }, + }); + expect(commandResponsePreviewBody.preview.body).toContain("Scope: entrius/allways-ui#12"); + expect(commandResponsePreviewBody.preview.body).not.toMatch(/wallet|hotkey|raw trust|payout|reward estimate|farming|scoreability|public score estimate/i); + + const nonMinerPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "miner-context", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { minerStatus: "not_found" } }), + }, + env, + ); + expect(nonMinerPreview.status).toBe(200); + await expect(nonMinerPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "skipped", willComment: false, skipReason: "pr_author_not_confirmed_miner" }, body: expect.stringContaining("not a confirmed Gittensor miner") }, + }); + + const missingPermissionPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { missingPermissions: ["issues"] } }), + }, + env, + ); + expect(missingPermissionPreview.status).toBe(200); + await expect(missingPermissionPreview.json()).resolves.toMatchObject({ + preview: { + decision: { status: "missing_permission", willComment: false, skipReason: "missing_permission" }, + missingPermissions: ["issues"], + permissionDiagnostics: [expect.objectContaining({ permission: "issues", requiredAccess: "write", ok: false })], + warnings: [expect.stringMatching(/Issues: write/i)], + }, + }); + + const permissionMapPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { permissions: { metadata: "read", pull_requests: "read" } } }), + }, + env, + ); + expect(permissionMapPreview.status).toBe(200); + await expect(permissionMapPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "missing_permission", skipReason: "missing_permission" }, missingPermissions: ["issues"] }, + }); + + const checksWarningPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { missingPermissions: ["checks"] } }), + }, + env, + ); + expect(checksWarningPreview.status).toBe(200); + await expect(checksWarningPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "ready", willComment: true, willCheckRun: false }, missingPermissions: ["checks"], warnings: [expect.stringMatching(/checks: write/i)] }, + }); + + const unavailableMinerPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "miner-context", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { minerStatus: "unavailable" } }), + }, + env, + ); + expect(unavailableMinerPreview.status).toBe(200); + await expect(unavailableMinerPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "skipped", skipReason: "miner_detection_unavailable" }, body: expect.stringContaining("detection is unavailable") }, + }); + + const wrongActorPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "next-action", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { authorLogin: "sample-author", commenterLogin: "other-user" } }), + }, + env, + ); + expect(wrongActorPreview.status).toBe(200); + await expect(wrongActorPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "skipped", skipReason: "not_maintainer_or_pr_author" }, body: expect.stringContaining("neither a maintainer nor the pull request author") }, + }); + + const helpPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "help", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { authorLogin: "sample-author", commenterLogin: "sample-author" } }), + }, + env, + ); + expect(helpPreview.status).toBe(200); + await expect(helpPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "ready", willComment: true }, body: expect.stringContaining("### Gittensory command help") }, }); - const privatePreview = await app.request( + const maintainerCommandPreview = await app.request( "/v1/app/commands/preview", { method: "POST", headers: apiHeaders(env), - body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", login: "oktofeesh1" }), + body: JSON.stringify({ + command: "queue-summary", + repoFullName: "entrius/allways-ui", + pullNumber: 12, + sample: { authorAssociation: "OWNER", minerStatus: "not_found" }, + }), }, env, ); - expect(privatePreview.status).toBe(200); - await expect(privatePreview.json()).resolves.toMatchObject({ - preview: { boundary: "private-api", endpoint: "/v1/agent/preflight-branch" }, + expect(maintainerCommandPreview.status).toBe(200); + await expect(maintainerCommandPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "ready", willComment: true }, body: expect.stringContaining("### Gittensory maintainer queue summary") }, + }); + + const maintainerMinerContextPreview = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "miner-context", repoFullName: "entrius/allways-ui", pullNumber: 12, sample: { commenterAssociation: "OWNER", minerStatus: "not_found" } }), + }, + env, + ); + expect(maintainerMinerContextPreview.status).toBe(200); + await expect(maintainerMinerContextPreview.json()).resolves.toMatchObject({ + preview: { decision: { status: "ready", willComment: true }, body: expect.stringContaining("Official miner context is unavailable") }, }); const privatePreviewWithoutTarget = await app.request( @@ -1680,13 +1868,27 @@ describe("api routes", () => { { method: "POST", headers: apiHeaders(env), - body: JSON.stringify({ command: "preflight" }), + body: JSON.stringify({ command: "plan-next-work" }), }, env, ); expect(privatePreviewWithoutTarget.status).toBe(200); await expect(privatePreviewWithoutTarget.json()).resolves.toMatchObject({ - preview: { body: expect.stringContaining("selected target") }, + preview: { boundary: "private-api", body: expect.stringContaining("selected target"), decision: { status: "private_api", willComment: false } }, + }); + + const privatePreviewWithLogin = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "plan-next-work", repoFullName: "entrius/allways-ui", login: "oktofeesh1" }), + }, + env, + ); + expect(privatePreviewWithLogin.status).toBe(200); + await expect(privatePreviewWithLogin.json()).resolves.toMatchObject({ + preview: { target: "entrius/allways-ui", body: expect.stringContaining("as oktofeesh1") }, }); const previewWithoutRepo = await app.request( @@ -1699,6 +1901,37 @@ describe("api routes", () => { env, ); expect(previewWithoutRepo.status).toBe(200); + await expect(previewWithoutRepo.json()).resolves.toMatchObject({ + preview: { decision: { status: "skipped", willComment: false, skipReason: "missing_target" }, body: expect.stringContaining("require a repository and pull request number") }, + }); + + const publicPreviewWithoutTarget = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "help", sample: { authorLogin: "sample-author", commenterLogin: "sample-author" } }), + }, + env, + ); + expect(publicPreviewWithoutTarget.status).toBe(200); + await expect(publicPreviewWithoutTarget.json()).resolves.toMatchObject({ + preview: { decision: { status: "skipped", willComment: false, skipReason: "missing_target" }, body: expect.stringContaining("require a repository and pull request number") }, + }); + + const publicPreviewWithoutPull = await app.request( + "/v1/app/commands/preview", + { + method: "POST", + headers: apiHeaders(env), + body: JSON.stringify({ command: "help", repoFullName: "entrius/allways-ui", sample: { authorLogin: "sample-author", commenterLogin: "sample-author" } }), + }, + env, + ); + expect(publicPreviewWithoutPull.status).toBe(200); + await expect(publicPreviewWithoutPull.json()).resolves.toMatchObject({ + preview: { target: "entrius/allways-ui", decision: { status: "skipped", willComment: false, skipReason: "missing_target" } }, + }); const telemetryDownPreviewEnv = withProductUsageInsertFailure(createTestEnv()); const telemetryDownPreview = await app.request( @@ -1943,6 +2176,77 @@ describe("api routes", () => { const invalidMissingOwnerExtensionContext = await app.request("/v1/extension/pull-context?repo=allways-ui&pullNumber=12", { headers: { authorization: `Bearer ${extensionSessionBody.token}` } }, env); expect(invalidMissingOwnerExtensionContext.status).toBe(400); + await upsertPullRequestFromGitHub(env, "entrius/allways-ui", { + number: 14, + title: "Maintainer queue cleanup", + state: "open", + html_url: "https://github.com/entrius/allways-ui/pull/14", + user: { login: "repo-maintainer" }, + author_association: "OWNER", + head: { sha: "owner123", ref: "maintainer-cleanup" }, + base: { ref: "test" }, + labels: [{ name: "feature" }], + body: "Fixes #8", + }); + await upsertPullRequestFromGitHub(env, "entrius/allways-ui", { + number: 15, + title: "Closed cleanup attempt", + state: "closed", + html_url: "https://github.com/entrius/allways-ui/pull/15", + user: { login: "outside-contributor" }, + author_association: "NONE", + head: { sha: "closed123", ref: "closed-cleanup" }, + base: { ref: "test" }, + labels: [{ name: "feature" }], + body: "Fixes #8", + }); + await upsertPullRequestFromGitHub(env, "entrius/allways-ui", { + number: 16, + title: "Broad unlinked rewrite", + state: "open", + html_url: "https://github.com/entrius/allways-ui/pull/16", + user: { login: "outside-contributor" }, + author_association: "NONE", + head: { sha: "watch123", ref: "broad-rewrite" }, + base: { ref: "test" }, + labels: [{ name: "feature" }], + body: "Large rewrite without linked issue context.", + }); + await upsertPullRequestFile(env, { + repoFullName: "entrius/allways-ui", + pullNumber: 16, + path: "src/broad-rewrite.ts", + additions: 900, + deletions: 10, + changes: 910, + payload: {}, + }); + await upsertCheckSummary(env, { + id: "entrius/allways-ui#watch123#test", + repoFullName: "entrius/allways-ui", + pullNumber: 16, + headSha: "watch123", + name: "test", + status: "completed", + conclusion: "failure", + payload: {}, + }); + + for (const [pullNumber, expectedPacketText] of [ + [14, "Public status: maintainer follow-up recommended."], + [15, "Public status: triage may be needed before review."], + [16, "Public status: keep monitoring the public PR context."], + ] as const) { + const variantContext = await app.request( + `/v1/extension/pull-context?owner=entrius&repo=allways-ui&pullNumber=${pullNumber}`, + { headers: { authorization: `Bearer ${extensionSessionBody.token}` } }, + env, + ); + expect(variantContext.status).toBe(200); + const variantPayload = (await variantContext.json()) as { actions: Array<{ id: string; markdown?: string }> }; + expect(variantPayload.actions.find((action) => action.id === "copy_public_safe_packet")?.markdown).toContain(expectedPacketText); + } + const extensionContext = await app.request( "/v1/extension/pull-context?owner=entrius&repo=allways-ui&pullNumber=12", { headers: { authorization: `Bearer ${extensionSessionBody.token}` } }, @@ -2054,7 +2358,7 @@ describe("api routes", () => { occurredAt: "2026-05-28T00:00:00.000Z", }); - const productUsageEvents = await listProductUsageEvents(env, { limit: 20 }); + const productUsageEvents = await listProductUsageEvents(env, { limit: 40 }); expect(productUsageEvents).toEqual( expect.arrayContaining([ expect.objectContaining({ surface: "control_panel", eventName: "command_previewed", outcome: "success" }), @@ -2349,6 +2653,30 @@ describe("api routes", () => { expect(mutatingCalls).toEqual([]); }); + it("command response preview never mutates GitHub state", async () => { + const app = createApp(); + const env = createTestEnv(); + await seedSignalData(env); + const calls: Array<{ method: string; url: string }> = []; + vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => { + calls.push({ method: (init?.method ?? "GET").toUpperCase(), url: input.toString() }); + return new Response("not found", { status: 404 }); + }); + const response = await app.request( + "/v1/app/commands/preview", + { method: "POST", headers: apiHeaders(env), body: JSON.stringify({ command: "preflight", repoFullName: "entrius/allways-ui", pullNumber: 12, login: "oktofeesh1" }) }, + env, + ); + expect(response.status).toBe(200); + await expect(response.json()).resolves.toMatchObject({ + preview: { decision: { status: "ready", willComment: true, willLabel: false, willCheckRun: false } }, + }); + const githubCalls = calls.filter((call) => /github\.com/.test(call.url)); + expect(githubCalls).toEqual([]); + const mutatingCalls = calls.filter((call) => call.method !== "GET" && call.method !== "HEAD"); + expect(mutatingCalls).toEqual([]); + }); + it("returns 404 for unknown repos and serves cached snapshot with freshness for known repos", async () => { const app = createApp(); const env = createTestEnv(); diff --git a/test/unit/openapi.test.ts b/test/unit/openapi.test.ts index 57a2369aaf..b8d86ef496 100644 --- a/test/unit/openapi.test.ts +++ b/test/unit/openapi.test.ts @@ -93,6 +93,7 @@ describe("OpenAPI contract", () => { expect(spec.components?.schemas?.PullRequestReviewability).toBeDefined(); expect(spec.components?.schemas?.LocalBranchAnalysis).toBeDefined(); expect(spec.components?.schemas?.RepoSettingsPreview).toBeDefined(); + expect(spec.components?.schemas?.CommandPreviewResponse).toBeDefined(); expect(spec.components?.schemas?.AgentRunBundle).toBeDefined(); expect(spec.components?.schemas?.AgentAction).toBeDefined(); expect(spec.components?.schemas?.UpstreamStatus).toBeDefined(); @@ -100,6 +101,7 @@ describe("OpenAPI contract", () => { expect(spec.components?.schemas?.UpstreamDriftReport).toBeDefined(); expect(JSON.stringify(spec.components?.schemas?.ScorePreviewResult)).toContain("scenarioPreviews"); expect(JSON.stringify(spec.components?.schemas?.RepoIntelligence)).toContain("burdenForecastFreshness"); + expect(JSON.stringify(spec.components?.schemas?.CommandPreviewResponse)).toContain("missing_permission"); expect(JSON.stringify(spec.components?.schemas?.ContributorOutcomeHistory)).toContain("reconciliation"); expect(JSON.stringify(spec.components?.schemas?.LocalBranchAnalysis)).toContain("baseFreshness"); expect(JSON.stringify(spec.components?.schemas?.LocalBranchAnalysis)).toContain("recommendedRerunCondition"); From 8c20dab29470e5598d9c3cd7bf2d3d6b1fb40365 Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:25:45 +0200 Subject: [PATCH 2/5] fix: make command preview schema zod4-compatible --- apps/gittensory-ui/public/openapi.json | 7095 ++++++++++++------------ src/api/routes.ts | 2 +- src/openapi/schemas.ts | 2 +- 3 files changed, 3548 insertions(+), 3551 deletions(-) diff --git a/apps/gittensory-ui/public/openapi.json b/apps/gittensory-ui/public/openapi.json index 6007993495..31bb455e42 100644 --- a/apps/gittensory-ui/public/openapi.json +++ b/apps/gittensory-ui/public/openapi.json @@ -146,6 +146,59 @@ "generatedAt" ] }, + "RegistryRepo": { + "type": "object", + "properties": { + "repo": { + "type": "string" + }, + "emissionShare": { + "type": "number" + }, + "issueDiscoveryShare": { + "type": "number" + }, + "labelMultipliers": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "trustedLabelPipeline": { + "type": "boolean", + "nullable": true + }, + "maintainerCut": { + "type": "number" + }, + "defaultLabelMultiplier": { + "type": "number", + "nullable": true + }, + "fixedBaseScore": { + "type": "number", + "nullable": true + }, + "eligibilityMode": { + "type": "string", + "nullable": true + }, + "raw": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "required": [ + "repo", + "emissionShare", + "issueDiscoveryShare", + "labelMultipliers", + "maintainerCut", + "raw" + ] + }, "RegistrySnapshot": { "type": "object", "properties": { @@ -207,59 +260,6 @@ "repositories" ] }, - "RegistryRepo": { - "type": "object", - "properties": { - "repo": { - "type": "string" - }, - "emissionShare": { - "type": "number" - }, - "issueDiscoveryShare": { - "type": "number" - }, - "labelMultipliers": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "trustedLabelPipeline": { - "type": "boolean", - "nullable": true - }, - "maintainerCut": { - "type": "number" - }, - "defaultLabelMultiplier": { - "type": "number", - "nullable": true - }, - "fixedBaseScore": { - "type": "number", - "nullable": true - }, - "eligibilityMode": { - "type": "string", - "nullable": true - }, - "raw": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "repo", - "emissionShare", - "issueDiscoveryShare", - "labelMultipliers", - "maintainerCut", - "raw" - ] - }, "Repository": { "type": "object", "properties": { @@ -313,6 +313,40 @@ "isPrivate" ] }, + "Finding": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "title": { + "type": "string" + }, + "severity": { + "type": "string", + "enum": [ + "info", + "warning", + "critical" + ] + }, + "detail": { + "type": "string" + }, + "action": { + "type": "string" + }, + "publicText": { + "type": "string" + } + }, + "required": [ + "code", + "title", + "severity", + "detail" + ] + }, "Advisory": { "type": "object", "properties": { @@ -387,40 +421,6 @@ "generatedAt" ] }, - "Finding": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "title": { - "type": "string" - }, - "severity": { - "type": "string", - "enum": [ - "info", - "warning", - "critical" - ] - }, - "detail": { - "type": "string" - }, - "action": { - "type": "string" - }, - "publicText": { - "type": "string" - } - }, - "required": [ - "code", - "title", - "severity", - "detail" - ] - }, "WorkboardItem": { "type": "object", "properties": { @@ -560,6 +560,68 @@ "findings" ] }, + "CollisionItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "issue", + "pull_request" + ] + }, + "number": { + "type": "number" + }, + "title": { + "type": "string" + }, + "authorLogin": { + "type": "string", + "nullable": true + }, + "htmlUrl": { + "type": "string", + "nullable": true + } + }, + "required": [ + "type", + "number", + "title" + ] + }, + "CollisionCluster": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "risk": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "reason": { + "type": "string" + }, + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollisionItem" + } + } + }, + "required": [ + "id", + "risk", + "reason", + "items" + ] + }, "CollisionReport": { "type": "object", "properties": { @@ -602,66 +664,44 @@ "clusters" ] }, - "CollisionCluster": { + "LaneAdvice": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "risk": { + "lane": { "type": "string", "enum": [ - "low", - "medium", - "high" + "direct_pr", + "issue_discovery", + "split", + "inactive", + "unknown" ] }, - "reason": { + "repoFullName": { "type": "string" }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CollisionItem" - } - } - }, - "required": [ - "id", - "risk", - "reason", - "items" - ] - }, - "CollisionItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "issue", - "pull_request" - ] + "issueDiscoveryShare": { + "type": "number" }, - "number": { + "directPrShare": { "type": "number" }, - "title": { + "summary": { "type": "string" }, - "authorLogin": { - "type": "string", - "nullable": true + "contributorGuidance": { + "type": "string" }, - "htmlUrl": { - "type": "string", - "nullable": true + "maintainerGuidance": { + "type": "string" } }, "required": [ - "type", - "number", - "title" + "lane", + "repoFullName", + "summary", + "contributorGuidance", + "maintainerGuidance" ] }, "ConfigQuality": { @@ -725,46 +765,6 @@ "findings" ] }, - "LaneAdvice": { - "type": "object", - "properties": { - "lane": { - "type": "string", - "enum": [ - "direct_pr", - "issue_discovery", - "split", - "inactive", - "unknown" - ] - }, - "repoFullName": { - "type": "string" - }, - "issueDiscoveryShare": { - "type": "number" - }, - "directPrShare": { - "type": "number" - }, - "summary": { - "type": "string" - }, - "contributorGuidance": { - "type": "string" - }, - "maintainerGuidance": { - "type": "string" - } - }, - "required": [ - "lane", - "repoFullName", - "summary", - "contributorGuidance", - "maintainerGuidance" - ] - }, "LabelAudit": { "type": "object", "properties": { @@ -1901,208 +1901,91 @@ "summary" ] }, - "ContributorDecisionPack": { + "DecisionPackFreshness": { + "type": "string", + "enum": [ + "fresh", + "stale", + "rebuilding", + "missing" + ] + }, + "ContributorOpenPrNextStepPacket": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "ready" - ] - }, - "source": { - "type": "string", - "enum": [ - "computed", - "snapshot" - ] - }, - "login": { - "type": "string" - }, - "generatedAt": { + "repoFullName": { "type": "string" }, - "snapshotAgeSeconds": { + "number": { "type": "number" }, - "stale": { - "type": "boolean" - }, - "freshness": { - "$ref": "#/components/schemas/DecisionPackFreshness" - }, - "rebuildEnqueued": { - "type": "boolean" - }, - "scoringModelSnapshotId": { + "title": { "type": "string" }, - "profile": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "outcomeHistory": { - "$ref": "#/components/schemas/ContributorOutcomeHistory" - }, - "roleContexts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RoleContext" - } - }, - "opportunities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContributorOpportunity" - } - }, - "repoDecisions": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "topActions": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } + "classification": { + "type": "string", + "enum": [ + "approved", + "blocked", + "stale", + "needs_author", + "failing_checks", + "missing_tests", + "duplicate_prone", + "reviewable", + "should_close_or_withdraw", + "maintainer_lane", + "draft" + ] }, - "cleanupFirst": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } + "summary": { + "type": "string" }, - "pursueRepos": { + "reasons": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } }, - "avoidRepos": { + "nextSteps": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } + } + }, + "required": [ + "repoFullName", + "number", + "title", + "classification", + "summary", + "reasons", + "nextSteps" + ] + }, + "ContributorOpenPrMonitor": { + "type": "object", + "properties": { + "login": { + "type": "string" }, - "maintainerLaneRepos": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } + "generatedAt": { + "type": "string" }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } + "openPrCount": { + "type": "number" }, - "evidenceGraph": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "registeredRepoCount": { + "type": "number" }, - "dataQuality": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "cleanupFirst": { + "type": "boolean" }, "summary": { "type": "string" }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - }, - "openPrMonitor": { - "$ref": "#/components/schemas/ContributorOpenPrMonitor" - } - }, - "required": [ - "status", - "source", - "login", - "generatedAt", - "stale", - "freshness", - "rebuildEnqueued", - "scoringModelSnapshotId", - "profile", - "outcomeHistory", - "roleContexts", - "opportunities", - "repoDecisions", - "topActions", - "cleanupFirst", - "pursueRepos", - "avoidRepos", - "maintainerLaneRepos", - "scoreBlockers", - "dataQuality", - "summary", - "nextActions" - ] - }, - "DecisionPackFreshness": { - "type": "string", - "enum": [ - "fresh", - "stale", - "rebuilding", - "missing" - ] - }, - "ContributorOpenPrMonitor": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "openPrCount": { - "type": "number" - }, - "registeredRepoCount": { - "type": "number" - }, - "cleanupFirst": { - "type": "boolean" - }, - "summary": { - "type": "string" - }, - "guidance": { + "guidance": { "type": "array", "items": { "type": "string" @@ -2213,58 +2096,175 @@ "pullRequests" ] }, - "ContributorOpenPrNextStepPacket": { + "ContributorDecisionPack": { "type": "object", "properties": { - "repoFullName": { + "status": { + "type": "string", + "enum": [ + "ready" + ] + }, + "source": { + "type": "string", + "enum": [ + "computed", + "snapshot" + ] + }, + "login": { "type": "string" }, - "number": { + "generatedAt": { + "type": "string" + }, + "snapshotAgeSeconds": { "type": "number" }, - "title": { - "type": "string" + "stale": { + "type": "boolean" }, - "classification": { - "type": "string", - "enum": [ - "approved", - "blocked", - "stale", - "needs_author", - "failing_checks", - "missing_tests", - "duplicate_prone", - "reviewable", - "should_close_or_withdraw", - "maintainer_lane", - "draft" - ] + "freshness": { + "$ref": "#/components/schemas/DecisionPackFreshness" }, - "summary": { + "rebuildEnqueued": { + "type": "boolean" + }, + "scoringModelSnapshotId": { "type": "string" }, - "reasons": { + "profile": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "outcomeHistory": { + "$ref": "#/components/schemas/ContributorOutcomeHistory" + }, + "roleContexts": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/RoleContext" } }, - "nextSteps": { + "opportunities": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContributorOpportunity" + } + }, + "repoDecisions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "topActions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "cleanupFirst": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "pursueRepos": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "avoidRepos": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "maintainerLaneRepos": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "scoreBlockers": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "evidenceGraph": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "dataQuality": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "summary": { + "type": "string" + }, + "nextActions": { "type": "array", "items": { "type": "string" } + }, + "openPrMonitor": { + "$ref": "#/components/schemas/ContributorOpenPrMonitor" } }, "required": [ - "repoFullName", - "number", - "title", - "classification", + "status", + "source", + "login", + "generatedAt", + "stale", + "freshness", + "rebuildEnqueued", + "scoringModelSnapshotId", + "profile", + "outcomeHistory", + "roleContexts", + "opportunities", + "repoDecisions", + "topActions", + "cleanupFirst", + "pursueRepos", + "avoidRepos", + "maintainerLaneRepos", + "scoreBlockers", + "dataQuality", "summary", - "reasons", - "nextSteps" + "nextActions" ] }, "DecisionPackRefreshNeeded": { @@ -2366,20 +2366,80 @@ "dataQuality" ] }, - "RepoIntelligence": { + "BurdenForecast": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "ready" - ] + "repoFullName": { + "type": "string" }, - "source": { - "type": "string", - "enum": [ - "computed", - "snapshot" + "generatedAt": { + "type": "string" + }, + "horizonDays": { + "anyOf": [ + { + "type": "number", + "enum": [ + 7 + ] + }, + { + "type": "number", + "enum": [ + 30 + ] + } + ] + }, + "level": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "critical" + ] + }, + "forecast": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "findings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + }, + "summary": { + "type": "string" + } + }, + "required": [ + "repoFullName", + "generatedAt", + "horizonDays", + "level", + "forecast", + "findings", + "summary" + ] + }, + "RepoIntelligence": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "ready" + ] + }, + "source": { + "type": "string", + "enum": [ + "computed", + "snapshot" ] }, "repoFullName": { @@ -2500,64 +2560,52 @@ "dataQuality" ] }, - "BurdenForecast": { + "RepoOutcomeEvidenceCompleteness": { "type": "object", "properties": { - "repoFullName": { - "type": "string" + "pullRequestsAnalyzed": { + "type": "number" }, - "generatedAt": { - "type": "string" + "withFileDetail": { + "type": "number" }, - "horizonDays": { - "anyOf": [ - { - "type": "number", - "enum": [ - 7 - ] - }, - { - "type": "number", - "enum": [ - 30 - ] - } - ] + "withReviewDetail": { + "type": "number" }, - "level": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "critical" - ] + "withCheckDetail": { + "type": "number" }, - "forecast": { - "type": "object", - "additionalProperties": { - "type": "number" - } + "filesCompletenessRatio": { + "type": "number" }, - "findings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } + "reviewsCompletenessRatio": { + "type": "number" }, - "summary": { - "type": "string" + "checksCompletenessRatio": { + "type": "number" + }, + "fullyDecidedWithDetail": { + "type": "number" + }, + "status": { + "type": "string", + "enum": [ + "complete", + "partial", + "missing" + ] } }, "required": [ - "repoFullName", - "generatedAt", - "horizonDays", - "level", - "forecast", - "findings", - "summary" + "pullRequestsAnalyzed", + "withFileDetail", + "withReviewDetail", + "withCheckDetail", + "filesCompletenessRatio", + "reviewsCompletenessRatio", + "checksCompletenessRatio", + "fullyDecidedWithDetail", + "status" ] }, "RepoOutcomePatterns": { @@ -2655,54 +2703,6 @@ "summary" ] }, - "RepoOutcomeEvidenceCompleteness": { - "type": "object", - "properties": { - "pullRequestsAnalyzed": { - "type": "number" - }, - "withFileDetail": { - "type": "number" - }, - "withReviewDetail": { - "type": "number" - }, - "withCheckDetail": { - "type": "number" - }, - "filesCompletenessRatio": { - "type": "number" - }, - "reviewsCompletenessRatio": { - "type": "number" - }, - "checksCompletenessRatio": { - "type": "number" - }, - "fullyDecidedWithDetail": { - "type": "number" - }, - "status": { - "type": "string", - "enum": [ - "complete", - "partial", - "missing" - ] - } - }, - "required": [ - "pullRequestsAnalyzed", - "withFileDetail", - "withReviewDetail", - "withCheckDetail", - "filesCompletenessRatio", - "reviewsCompletenessRatio", - "checksCompletenessRatio", - "fullyDecidedWithDetail", - "status" - ] - }, "RepoOutcomePatternsResponse": { "type": "object", "properties": { @@ -3274,1489 +3274,613 @@ } ] }, - "LocalBranchAnalysis": { + "ScorePreviewResult": { "type": "object", "properties": { - "login": { - "type": "string" - }, "repoFullName": { "type": "string" }, "generatedAt": { "type": "string" }, - "baseRef": { + "scoringModelSnapshotId": { "type": "string" }, - "headRef": { - "type": "string" + "activeModel": { + "type": "string", + "enum": [ + "current_density_model", + "pending_saturation_model", + "exponential_saturation_model", + "unknown" + ] }, - "branchName": { - "type": "string" + "privateOnly": { + "type": "boolean", + "enum": [ + true + ] }, - "baseFreshness": { + "laneMath": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "scoreEstimate": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "fresh", - "stale", - "possibly_stale", - "unknown" - ] + "baseScore": { + "type": "number" }, - "baseRef": { - "type": "string" + "densityMultiplier": { + "type": "number" }, - "baseSha": { - "type": "string" + "contributionBonus": { + "type": "number" }, - "headSha": { - "type": "string" + "labelMultiplier": { + "type": "number" }, - "mergeBaseSha": { - "type": "string" + "issueMultiplier": { + "type": "number" }, - "remoteTrackingSha": { - "type": "string" + "credibilityMultiplier": { + "type": "number" }, - "changedFileCount": { + "reviewPenaltyMultiplier": { "type": "number" }, - "testFileCount": { + "openPrMultiplier": { "type": "number" }, - "passedValidationCount": { + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } + }, + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { "type": "number" }, + "reason": { + "type": "string" + }, "warnings": { "type": "array", "items": { "type": "string" } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" }, - "recommendation": { + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "branchEligibility": { + "type": "object", + "properties": { + "required": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "eligible", + "ineligible", + "unknown", + "not_required" + ] + }, + "evidence": { + "type": "string", + "enum": [ + "provided", + "missing" + ] + }, + "source": { + "type": "string", + "enum": [ + "github_metadata", + "local_metadata", + "registry", + "user_supplied", + "missing" + ] + }, + "reason": { + "type": "string" + }, + "checkedAt": { "type": "string" + }, + "stale": { + "type": "boolean" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ + "required", "status", - "changedFileCount", - "testFileCount", - "passedValidationCount", + "evidence", + "source", + "stale", "warnings" ] }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "roleContext": { - "$ref": "#/components/schemas/RoleContext" + "effectiveEstimatedScore": { + "type": "number" }, - "preflight": { - "$ref": "#/components/schemas/LocalDiffPreflightResult" + "underlyingPotentialScore": { + "type": "number" }, - "scorePreview": { - "$ref": "#/components/schemas/ScorePreviewResult" + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } }, - "scenarioScorePreview": { - "type": "object", - "properties": { - "current": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" + "gateDeltas": { + "type": "array", + "items": { + "type": "object", + "properties": { + "gate": { + "type": "string", + "enum": [ + "open_pr_threshold", + "credibility_floor", + "linked_issue_multiplier" + ] + }, + "current": { + "type": "string" + }, + "projected": { + "type": "string" + }, + "explanation": { + "type": "string" + } + }, + "required": [ + "gate", + "current", + "projected", + "explanation" + ] + } + }, + "scenarioPreviews": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" } }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } }, - "gates": { + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { "type": "object", "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] }, - "credibilityFloor": { - "type": "number" + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] }, - "credibilityObserved": { - "type": "number" + "detail": { + "type": "string" } }, "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" + "code", + "severity", + "detail" ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { "type": "number" - }, - "appliedMultiplier": { + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } } }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } }, - "deltaExplanation": { - "type": "string" - } + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" + "deltaExplanation": { + "type": "string" + } + }, + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + } + }, + "scoreabilityStatus": { + "type": "string", + "enum": [ + "blocked", + "conditionally_scoreable", + "scoreable", + "hold" + ] + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "recommendation": { + "type": "object", + "properties": { + "level": { + "type": "string", + "enum": [ + "strong_fit", + "reasonable_fit", + "needs_work", + "hold" ] }, - "bestReasonableCase": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" - } - }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - }, - "afterPendingMerges": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" - } - }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - }, - "afterApprovedPrsMerge": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" - } - }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - }, - "afterStalePrsClose": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" - } - }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - }, - "gateDeltas": { - "type": "array", - "items": { - "type": "object", - "properties": { - "gate": { - "type": "string", - "enum": [ - "open_pr_threshold", - "credibility_floor", - "linked_issue_multiplier" - ] - }, - "current": { - "type": "string" - }, - "projected": { - "type": "string" - }, - "explanation": { - "type": "string" - } - }, - "required": [ - "gate", - "current", - "projected", - "explanation" - ] - } - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - } - }, - "required": [ - "current", - "bestReasonableCase", - "gateDeltas", - "blockedBy" - ] - }, - "observedPullRequestScenarios": { - "type": "object", - "properties": { - "approvedOrMergeable": { - "type": "number" - }, - "stale": { - "type": "number" - }, - "closed": { - "type": "number" - }, - "draft": { - "type": "number" - }, - "blocked": { - "type": "number" - }, - "maintainerLane": { - "type": "number" - }, - "notes": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "approvedOrMergeable", - "stale", - "closed", - "draft", - "blocked", - "maintainerLane", - "notes" - ] - }, - "githubBranchStatus": { - "type": "object", - "properties": { - "source": { - "type": "string", - "enum": [ - "cached_github_data" - ] - }, - "status": { - "type": "string", - "enum": [ - "approved", - "failing_checks", - "needs_author", - "blocked", - "pending_review", - "no_pr", - "unknown" - ] - }, - "pullNumber": { - "type": "number" - }, - "title": { - "type": "string" - }, - "reviewDecision": { - "type": "string", - "nullable": true - }, - "mergeableState": { - "type": "string", - "nullable": true - }, - "notes": { + "actions": { "type": "array", "items": { "type": "string" @@ -4764,382 +3888,267 @@ } }, "required": [ - "source", - "status", - "notes" + "level", + "actions" ] - }, - "branchEligibility": { - "type": "object", - "properties": { - "required": { - "type": "boolean" - }, - "status": { - "type": "string", - "enum": [ - "eligible", - "ineligible", - "unknown", - "not_required" - ] - }, - "evidence": { - "type": "string", - "enum": [ - "provided", - "missing" - ] - }, - "source": { - "type": "string", - "enum": [ - "github_metadata", - "local_metadata", - "registry", - "user_supplied", - "missing" - ] - }, - "reason": { - "type": "string" - }, - "checkedAt": { - "type": "string" - }, - "stale": { - "type": "boolean" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "required", - "status", - "evidence", - "source", - "stale", - "warnings" + } + }, + "required": [ + "repoFullName", + "generatedAt", + "scoringModelSnapshotId", + "activeModel", + "privateOnly", + "laneMath", + "scoreEstimate", + "linkedIssueMultiplier", + "gates", + "branchEligibility", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "gateDeltas", + "scenarioPreviews", + "scoreabilityStatus", + "warnings", + "assumptions", + "recommendation" + ] + }, + "RewardRiskAction": { + "type": "object", + "properties": { + "actionKind": { + "type": "string", + "enum": [ + "cleanup_existing_prs", + "land_existing_prs", + "close_or_withdraw_low_fit_prs", + "open_new_direct_pr", + "file_issue_discovery", + "maintainer_lane_improve_repo", + "maintainer_cut_readiness" ] }, - "rewardRisk": { - "$ref": "#/components/schemas/RepoRewardRisk" + "repoFullName": { + "type": "string" }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "string" - } + "priorityScore": { + "type": "number" }, - "branchQualityBlockers": { + "laneValueScore": { + "type": "number" + }, + "scoreabilityScore": { + "type": "number" + }, + "personalFitScore": { + "type": "number" + }, + "riskPenalty": { + "type": "number" + }, + "maintainerFrictionPenalty": { + "type": "number" + }, + "actionLeverageScore": { + "type": "number" + }, + "whyThisHelps": { "type": "array", "items": { "type": "string" } }, - "accountStateBlockers": { + "nextActions": { "type": "array", "items": { "type": "string" } + } + }, + "required": [ + "actionKind", + "repoFullName", + "priorityScore", + "laneValueScore", + "scoreabilityScore", + "personalFitScore", + "riskPenalty", + "maintainerFrictionPenalty", + "actionLeverageScore", + "whyThisHelps", + "nextActions" + ] + }, + "RepoRewardRisk": { + "type": "object", + "properties": { + "login": { + "type": "string" }, - "recommendedRerunCondition": { + "repoFullName": { "type": "string" }, - "localFindings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } + "generatedAt": { + "type": "string" }, - "maintainerFit": { - "type": "object", - "properties": { - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] - }, - "reviewBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "role": { - "type": "string", - "enum": [ - "outside_contributor", - "repo_maintainer", - "org_member", - "collaborator", - "owner", - "unknown" - ] - }, - "maintainerLane": { - "type": "boolean" - }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } - }, - "risks": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "recommendation", - "reviewBurden", - "role", - "maintainerLane", - "reasons", - "risks" + "roleContext": { + "$ref": "#/components/schemas/RoleContext" + }, + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "recommendation": { + "type": "string", + "enum": [ + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", + "unknown" ] }, - "manifestGuidance": { + "rewardUpside": { "type": "object", "properties": { - "present": { - "type": "boolean" - }, - "source": { + "relevantLane": { "type": "string", "enum": [ - "repo_file", - "api_record", + "direct_pr", + "issue_discovery", + "maintainer_lane", "none" ] }, - "linkedIssuePolicy": { - "type": "string", - "enum": [ - "required", - "preferred", - "optional" - ] - }, - "issueDiscoveryPolicy": { - "type": "string", - "enum": [ - "encouraged", - "neutral", - "discouraged" - ] - }, - "matchedWantedPaths": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchedBlockedPaths": { - "type": "array", - "items": { - "type": "string" - } + "repoSlice": { + "type": "number" }, - "preferredLabelHits": { - "type": "array", - "items": { - "type": "string" - } + "directPrSlice": { + "type": "number" }, - "findings": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "severity": { - "type": "string", - "enum": [ - "info", - "warning", - "critical" - ] - }, - "title": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "action": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "title", - "detail" - ] - } + "issueDiscoverySlice": { + "type": "number" }, - "publicNextSteps": { - "type": "array", - "items": { - "type": "string" - } + "maintainerCutSlice": { + "type": "number" }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } + "labelMultiplier": { + "type": "number" }, - "summary": { - "type": "string" + "issueMultiplier": { + "type": "number" + }, + "estimatedScoreIfClean": { + "type": "number" + }, + "currentEstimatedScore": { + "type": "number" } }, "required": [ - "present", - "source", - "linkedIssuePolicy", - "issueDiscoveryPolicy", - "matchedWantedPaths", - "matchedBlockedPaths", - "preferredLabelHits", - "findings", - "publicNextSteps", - "warnings", - "summary" + "relevantLane", + "repoSlice", + "directPrSlice", + "issueDiscoverySlice", + "maintainerCutSlice", + "labelMultiplier", + "issueMultiplier", + "estimatedScoreIfClean", + "currentEstimatedScore" ] }, - "prPacket": { + "scoreBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "riskBreakdown": { "type": "object", "properties": { - "titleSuggestion": { - "type": "string" + "queueBurden": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "critical" + ] }, - "markdown": { - "type": "string" + "queueBurdenScore": { + "type": "number" }, - "bodySections": { - "type": "array", - "items": { - "type": "object", - "properties": { - "heading": { - "type": "string" - }, - "lines": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "heading", - "lines" - ] - } + "duplicateClusters": { + "type": "number" }, - "reviewerNotes": { - "type": "array", - "items": { - "type": "string" - } + "highRiskDuplicateClusters": { + "type": "number" }, - "validationSummary": { - "type": "object", - "properties": { - "passed": { - "type": "number" - }, - "failed": { - "type": "number" - }, - "notRun": { - "type": "number" - }, - "commands": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "passed", - "failed", - "not_run", - "skipped", - "focused", - "unknown" - ] - }, - "summary": { - "type": "string" - }, - "durationMs": { - "type": "number" - }, - "exitCode": { - "type": "number" - } - }, - "required": [ - "command", - "status" - ] - } - } - }, - "required": [ - "passed", - "failed", - "notRun", - "commands" - ] + "closedPullRequestRate": { + "type": "number" }, - "publicSafeWarnings": { - "type": "array", - "items": { - "type": "string" - } + "openPullRequests": { + "type": "number" + }, + "credibility": { + "type": "number" + }, + "reviewChurnRisk": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] } }, "required": [ - "titleSuggestion", - "markdown", - "bodySections", - "reviewerNotes", - "validationSummary", - "publicSafeWarnings" + "queueBurden", + "queueBurdenScore", + "duplicateClusters", + "highRiskDuplicateClusters", + "closedPullRequestRate", + "openPullRequests", + "credibility", + "reviewChurnRisk" ] }, - "nextActions": { + "actionImpact": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "currentPreview": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "afterCleanupPreview": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "actions": { "type": "array", "items": { "$ref": "#/components/schemas/RewardRiskAction" } }, - "workspaceIntelligence": { - "$ref": "#/components/schemas/LocalWorkspaceIntelligence" + "whyThisHelps": { + "type": "array", + "items": { + "type": "string" + } + }, + "nextActions": { + "type": "array", + "items": { + "type": "string" + } }, "summary": { "type": "string" @@ -5149,997 +4158,1824 @@ "login", "repoFullName", "generatedAt", - "baseFreshness", - "lane", "roleContext", - "preflight", - "scorePreview", - "scenarioScorePreview", - "observedPullRequestScenarios", - "githubBranchStatus", - "branchEligibility", - "rewardRisk", - "scoreBlockers", - "branchQualityBlockers", - "accountStateBlockers", - "recommendedRerunCondition", - "localFindings", - "maintainerFit", - "manifestGuidance", - "prPacket", - "nextActions", - "workspaceIntelligence", - "summary" - ] - }, - "ScorePreviewResult": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "scoringModelSnapshotId": { - "type": "string" - }, - "activeModel": { - "type": "string", - "enum": [ - "current_density_model", - "pending_saturation_model", - "exponential_saturation_model", - "unknown" - ] - }, - "privateOnly": { - "type": "boolean", + "lane", + "recommendation", + "rewardUpside", + "scoreBlockers", + "riskBreakdown", + "actionImpact", + "currentPreview", + "afterCleanupPreview", + "actions", + "whyThisHelps", + "nextActions", + "summary" + ] + }, + "LocalWorkspaceIntelligence": { + "type": "object", + "properties": { + "version": { + "type": "number", "enum": [ - true + 2 ] }, - "laneMath": { + "sourceUpload": { "type": "object", - "additionalProperties": { - "type": "number" - } + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + false + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "enabled", + "detail" + ] }, - "scoreEstimate": { + "branch": { "type": "object", "properties": { - "baseScore": { - "type": "number" + "name": { + "type": "string" }, - "densityMultiplier": { - "type": "number" + "baseRef": { + "type": "string" }, - "contributionBonus": { - "type": "number" + "headSha": { + "type": "string" }, - "labelMultiplier": { + "pendingCommitCount": { "type": "number" - }, - "issueMultiplier": { + } + }, + "required": [ + "pendingCommitCount" + ] + }, + "changedFiles": { + "type": "object", + "properties": { + "total": { "type": "number" }, - "credibilityMultiplier": { + "added": { "type": "number" }, - "reviewPenaltyMultiplier": { + "modified": { "type": "number" }, - "openPrMultiplier": { + "deleted": { "type": "number" }, - "estimatedMergedScore": { + "renamed": { "type": "number" }, - "pendingSaturationScore": { + "binary": { "type": "number" + }, + "paths": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" + "total", + "added", + "modified", + "deleted", + "renamed", + "binary", + "paths" ] }, - "linkedIssueMultiplier": { + "testEvidence": { "type": "object", "properties": { - "mode": { + "level": { "type": "string", "enum": [ - "none", - "standard", - "maintainer" + "test_files", + "validation_commands", + "both", + "none" ] }, + "testFileCount": { + "type": "number" + }, + "passedValidationCount": { + "type": "number" + }, + "commands": { + "type": "array", + "items": { + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "passed", + "failed", + "not_run" + ] + }, + "summary": { + "type": "string" + } + }, + "required": [ + "command", + "status" + ] + } + } + }, + "required": [ + "level", + "testFileCount", + "passedValidationCount", + "commands" + ] + }, + "linkedIssues": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseFreshness": { + "type": "object", + "properties": { "status": { "type": "string", "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" + "fresh", + "stale", + "possibly_stale", + "unknown" ] }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] + "baseRef": { + "type": "string" }, - "eligible": { - "type": "boolean" + "baseSha": { + "type": "string" }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } + "headSha": { + "type": "string" }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } + "mergeBaseSha": { + "type": "string" }, - "baseMultiplier": { + "remoteTrackingSha": { + "type": "string" + }, + "changedFileCount": { "type": "number" }, - "appliedMultiplier": { + "testFileCount": { "type": "number" }, - "reason": { - "type": "string" + "passedValidationCount": { + "type": "number" }, "warnings": { "type": "array", "items": { "type": "string" } + }, + "recommendation": { + "type": "string" } }, "required": [ - "mode", "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", + "changedFileCount", + "testFileCount", + "passedValidationCount", "warnings" ] }, - "gates": { + "ciStatusHints": { + "type": "array", + "items": { + "type": "string" + } + }, + "localScorerDiagnostics": { "type": "object", "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" + "mode": { + "type": "string" }, - "collateralFraction": { - "type": "number" + "activeModel": { + "type": "string" }, - "credibilityFloor": { - "type": "number" + "warnings": { + "type": "array", + "items": { + "type": "string" + } }, - "credibilityObserved": { - "type": "number" + "metadataOnly": { + "type": "boolean" } }, "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" + "mode", + "warnings", + "metadataOnly" ] }, - "branchEligibility": { + "blockers": { "type": "object", "properties": { - "required": { - "type": "boolean" + "branchQuality": { + "type": "array", + "items": { + "type": "string" + } }, + "accountState": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "branchQuality", + "accountState" + ] + }, + "rerunWhen": { + "type": "string" + } + }, + "required": [ + "version", + "sourceUpload", + "branch", + "changedFiles", + "testEvidence", + "linkedIssues", + "baseFreshness", + "ciStatusHints", + "blockers", + "rerunWhen" + ] + }, + "LocalBranchAnalysis": { + "type": "object", + "properties": { + "login": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "baseRef": { + "type": "string" + }, + "headRef": { + "type": "string" + }, + "branchName": { + "type": "string" + }, + "baseFreshness": { + "type": "object", + "properties": { "status": { "type": "string", "enum": [ - "eligible", - "ineligible", - "unknown", - "not_required" + "fresh", + "stale", + "possibly_stale", + "unknown" ] }, - "evidence": { - "type": "string", - "enum": [ - "provided", - "missing" - ] + "baseRef": { + "type": "string" }, - "source": { - "type": "string", - "enum": [ - "github_metadata", - "local_metadata", - "registry", - "user_supplied", - "missing" - ] + "baseSha": { + "type": "string" }, - "reason": { + "headSha": { "type": "string" }, - "checkedAt": { + "mergeBaseSha": { "type": "string" }, - "stale": { - "type": "boolean" + "remoteTrackingSha": { + "type": "string" + }, + "changedFileCount": { + "type": "number" + }, + "testFileCount": { + "type": "number" + }, + "passedValidationCount": { + "type": "number" }, "warnings": { "type": "array", "items": { "type": "string" } + }, + "recommendation": { + "type": "string" } }, "required": [ - "required", "status", - "evidence", - "source", - "stale", + "changedFileCount", + "testFileCount", + "passedValidationCount", "warnings" ] }, - "effectiveEstimatedScore": { - "type": "number" + "lane": { + "$ref": "#/components/schemas/LaneAdvice" }, - "underlyingPotentialScore": { - "type": "number" + "roleContext": { + "$ref": "#/components/schemas/RoleContext" }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } + "preflight": { + "$ref": "#/components/schemas/LocalDiffPreflightResult" }, - "gateDeltas": { - "type": "array", - "items": { - "type": "object", - "properties": { - "gate": { - "type": "string", - "enum": [ - "open_pr_threshold", - "credibility_floor", - "linked_issue_multiplier" - ] - }, - "current": { - "type": "string" - }, - "projected": { - "type": "string" + "scorePreview": { + "$ref": "#/components/schemas/ScorePreviewResult" + }, + "scenarioScorePreview": { + "type": "object", + "properties": { + "current": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } + }, + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { + "type": "string" + } }, - "explanation": { - "type": "string" - } + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] }, - "required": [ - "gate", - "current", - "projected", - "explanation" - ] - } - }, - "scenarioPreviews": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { + "bestReasonableCase": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } + }, + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { "type": "string" } }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + }, + "afterPendingMerges": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } }, - "labelMultiplier": { - "type": "number" + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } }, - "issueMultiplier": { - "type": "number" + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } }, - "credibilityMultiplier": { - "type": "number" + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { + "type": "string" + } + }, + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + }, + "afterApprovedPrsMerge": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } }, - "reviewPenaltyMultiplier": { - "type": "number" + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } }, - "openPrMultiplier": { - "type": "number" + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } }, - "estimatedMergedScore": { - "type": "number" + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { + "type": "string" + } + }, + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + }, + "afterStalePrsClose": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } }, - "pendingSaturationScore": { - "type": "number" - } + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } }, - "credibilityObserved": { - "type": "number" + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] } }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { + "linkedIssueMultiplier": { "type": "object", "properties": { - "code": { + "mode": { "type": "string", "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" + "none", + "standard", + "maintainer" ] }, - "severity": { + "status": { "type": "string", "enum": [ - "blocker", - "reducer", - "context" + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" ] }, - "detail": { + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "code", - "severity", - "detail" + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" ] + }, + "deltaExplanation": { + "type": "string" } }, - "linkedIssueMultiplier": { + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + }, + "gateDeltas": { + "type": "array", + "items": { "type": "object", "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { + "gate": { "type": "string", "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" + "open_pr_threshold", + "credibility_floor", + "linked_issue_multiplier" ] }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" + "current": { + "type": "string" }, - "reason": { + "projected": { "type": "string" }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } + "explanation": { + "type": "string" } }, "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" + "gate", + "current", + "projected", + "explanation" ] - }, - "deltaExplanation": { - "type": "string" } }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - } - }, - "scoreabilityStatus": { - "type": "string", - "enum": [ - "blocked", - "conditionally_scoreable", - "scoreable", - "hold" - ] - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommendation": { - "type": "object", - "properties": { - "level": { - "type": "string", - "enum": [ - "strong_fit", - "reasonable_fit", - "needs_work", - "hold" - ] - }, - "actions": { + "blockedBy": { "type": "array", "items": { - "type": "string" - } - } - }, - "required": [ - "level", - "actions" - ] - } - }, - "required": [ - "repoFullName", - "generatedAt", - "scoringModelSnapshotId", - "activeModel", - "privateOnly", - "laneMath", - "scoreEstimate", - "linkedIssueMultiplier", - "gates", - "branchEligibility", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "gateDeltas", - "scenarioPreviews", - "scoreabilityStatus", - "warnings", - "assumptions", - "recommendation" - ] - }, - "RepoRewardRisk": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "roleContext": { - "$ref": "#/components/schemas/RoleContext" - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] - }, - "rewardUpside": { - "type": "object", - "properties": { - "relevantLane": { - "type": "string", - "enum": [ - "direct_pr", - "issue_discovery", - "maintainer_lane", - "none" - ] - }, - "repoSlice": { - "type": "number" - }, - "directPrSlice": { - "type": "number" - }, - "issueDiscoverySlice": { - "type": "number" - }, - "maintainerCutSlice": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "estimatedScoreIfClean": { - "type": "number" - }, - "currentEstimatedScore": { - "type": "number" + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } } }, "required": [ - "relevantLane", - "repoSlice", - "directPrSlice", - "issueDiscoverySlice", - "maintainerCutSlice", - "labelMultiplier", - "issueMultiplier", - "estimatedScoreIfClean", - "currentEstimatedScore" + "current", + "bestReasonableCase", + "gateDeltas", + "blockedBy" ] }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "riskBreakdown": { + "observedPullRequestScenarios": { "type": "object", "properties": { - "queueBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "critical" - ] - }, - "queueBurdenScore": { + "approvedOrMergeable": { "type": "number" }, - "duplicateClusters": { + "stale": { "type": "number" }, - "highRiskDuplicateClusters": { + "closed": { "type": "number" }, - "closedPullRequestRate": { + "draft": { "type": "number" }, - "openPullRequests": { + "blocked": { "type": "number" }, - "credibility": { + "maintainerLane": { "type": "number" }, - "reviewChurnRisk": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "notes": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "queueBurden", - "queueBurdenScore", - "duplicateClusters", - "highRiskDuplicateClusters", - "closedPullRequestRate", - "openPullRequests", - "credibility", - "reviewChurnRisk" - ] - }, - "actionImpact": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "currentPreview": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "afterCleanupPreview": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "actions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RewardRiskAction" - } - }, - "whyThisHelps": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - }, - "summary": { - "type": "string" - } - }, - "required": [ - "login", - "repoFullName", - "generatedAt", - "roleContext", - "lane", - "recommendation", - "rewardUpside", - "scoreBlockers", - "riskBreakdown", - "actionImpact", - "currentPreview", - "afterCleanupPreview", - "actions", - "whyThisHelps", - "nextActions", - "summary" - ] - }, - "RewardRiskAction": { - "type": "object", - "properties": { - "actionKind": { - "type": "string", - "enum": [ - "cleanup_existing_prs", - "land_existing_prs", - "close_or_withdraw_low_fit_prs", - "open_new_direct_pr", - "file_issue_discovery", - "maintainer_lane_improve_repo", - "maintainer_cut_readiness" - ] - }, - "repoFullName": { - "type": "string" - }, - "priorityScore": { - "type": "number" - }, - "laneValueScore": { - "type": "number" - }, - "scoreabilityScore": { - "type": "number" - }, - "personalFitScore": { - "type": "number" - }, - "riskPenalty": { - "type": "number" - }, - "maintainerFrictionPenalty": { - "type": "number" - }, - "actionLeverageScore": { - "type": "number" - }, - "whyThisHelps": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "actionKind", - "repoFullName", - "priorityScore", - "laneValueScore", - "scoreabilityScore", - "personalFitScore", - "riskPenalty", - "maintainerFrictionPenalty", - "actionLeverageScore", - "whyThisHelps", - "nextActions" - ] - }, - "LocalWorkspaceIntelligence": { - "type": "object", - "properties": { - "version": { - "type": "number", - "enum": [ - 2 + "approvedOrMergeable", + "stale", + "closed", + "draft", + "blocked", + "maintainerLane", + "notes" ] }, - "sourceUpload": { + "githubBranchStatus": { "type": "object", "properties": { - "enabled": { - "type": "boolean", + "source": { + "type": "string", "enum": [ - false + "cached_github_data" ] }, - "detail": { - "type": "string" - } - }, - "required": [ - "enabled", - "detail" - ] - }, - "branch": { - "type": "object", - "properties": { - "name": { - "type": "string" + "status": { + "type": "string", + "enum": [ + "approved", + "failing_checks", + "needs_author", + "blocked", + "pending_review", + "no_pr", + "unknown" + ] }, - "baseRef": { + "pullNumber": { + "type": "number" + }, + "title": { "type": "string" }, - "headSha": { - "type": "string" + "reviewDecision": { + "type": "string", + "nullable": true + }, + "mergeableState": { + "type": "string", + "nullable": true }, - "pendingCommitCount": { - "type": "number" + "notes": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "pendingCommitCount" + "source", + "status", + "notes" ] }, - "changedFiles": { + "branchEligibility": { "type": "object", "properties": { - "total": { - "type": "number" + "required": { + "type": "boolean" }, - "added": { - "type": "number" + "status": { + "type": "string", + "enum": [ + "eligible", + "ineligible", + "unknown", + "not_required" + ] }, - "modified": { - "type": "number" + "evidence": { + "type": "string", + "enum": [ + "provided", + "missing" + ] }, - "deleted": { - "type": "number" + "source": { + "type": "string", + "enum": [ + "github_metadata", + "local_metadata", + "registry", + "user_supplied", + "missing" + ] }, - "renamed": { - "type": "number" + "reason": { + "type": "string" }, - "binary": { - "type": "number" + "checkedAt": { + "type": "string" }, - "paths": { + "stale": { + "type": "boolean" + }, + "warnings": { "type": "array", "items": { "type": "string" @@ -6147,108 +5983,188 @@ } }, "required": [ - "total", - "added", - "modified", - "deleted", - "renamed", - "binary", - "paths" + "required", + "status", + "evidence", + "source", + "stale", + "warnings" ] }, - "testEvidence": { + "rewardRisk": { + "$ref": "#/components/schemas/RepoRewardRisk" + }, + "scoreBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "branchQualityBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "accountStateBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "recommendedRerunCondition": { + "type": "string" + }, + "localFindings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + }, + "maintainerFit": { "type": "object", "properties": { - "level": { + "recommendation": { "type": "string", "enum": [ - "test_files", - "validation_commands", - "both", - "none" + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", + "unknown" ] }, - "testFileCount": { - "type": "number" + "reviewBurden": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] }, - "passedValidationCount": { - "type": "number" + "role": { + "type": "string", + "enum": [ + "outside_contributor", + "repo_maintainer", + "org_member", + "collaborator", + "owner", + "unknown" + ] }, - "commands": { + "maintainerLane": { + "type": "boolean" + }, + "reasons": { "type": "array", "items": { - "type": "object", - "properties": { - "command": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "passed", - "failed", - "not_run" - ] - }, - "summary": { - "type": "string" - } - }, - "required": [ - "command", - "status" - ] + "type": "string" + } + }, + "risks": { + "type": "array", + "items": { + "type": "string" } } }, "required": [ - "level", - "testFileCount", - "passedValidationCount", - "commands" + "recommendation", + "reviewBurden", + "role", + "maintainerLane", + "reasons", + "risks" ] }, - "linkedIssues": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseFreshness": { + "manifestGuidance": { "type": "object", "properties": { - "status": { + "present": { + "type": "boolean" + }, + "source": { "type": "string", "enum": [ - "fresh", - "stale", - "possibly_stale", - "unknown" + "repo_file", + "api_record", + "none" ] }, - "baseRef": { - "type": "string" - }, - "baseSha": { - "type": "string" + "linkedIssuePolicy": { + "type": "string", + "enum": [ + "required", + "preferred", + "optional" + ] }, - "headSha": { - "type": "string" + "issueDiscoveryPolicy": { + "type": "string", + "enum": [ + "encouraged", + "neutral", + "discouraged" + ] }, - "mergeBaseSha": { - "type": "string" + "matchedWantedPaths": { + "type": "array", + "items": { + "type": "string" + } }, - "remoteTrackingSha": { - "type": "string" + "matchedBlockedPaths": { + "type": "array", + "items": { + "type": "string" + } }, - "changedFileCount": { - "type": "number" + "preferredLabelHits": { + "type": "array", + "items": { + "type": "string" + } }, - "testFileCount": { - "type": "number" + "findings": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "severity": { + "type": "string", + "enum": [ + "info", + "warning", + "critical" + ] + }, + "title": { + "type": "string" + }, + "detail": { + "type": "string" + }, + "action": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "title", + "detail" + ] + } }, - "passedValidationCount": { - "type": "number" + "publicNextSteps": { + "type": "array", + "items": { + "type": "string" + } }, "warnings": { "type": "array", @@ -6256,59 +6172,116 @@ "type": "string" } }, - "recommendation": { + "summary": { "type": "string" } }, "required": [ - "status", - "changedFileCount", - "testFileCount", - "passedValidationCount", - "warnings" + "present", + "source", + "linkedIssuePolicy", + "issueDiscoveryPolicy", + "matchedWantedPaths", + "matchedBlockedPaths", + "preferredLabelHits", + "findings", + "publicNextSteps", + "warnings", + "summary" ] }, - "ciStatusHints": { - "type": "array", - "items": { - "type": "string" - } - }, - "localScorerDiagnostics": { + "prPacket": { "type": "object", "properties": { - "mode": { + "titleSuggestion": { "type": "string" }, - "activeModel": { + "markdown": { "type": "string" }, - "warnings": { + "bodySections": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "heading": { + "type": "string" + }, + "lines": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "heading", + "lines" + ] } }, - "metadataOnly": { - "type": "boolean" - } - }, - "required": [ - "mode", - "warnings", - "metadataOnly" - ] - }, - "blockers": { - "type": "object", - "properties": { - "branchQuality": { + "reviewerNotes": { "type": "array", "items": { "type": "string" } }, - "accountState": { + "validationSummary": { + "type": "object", + "properties": { + "passed": { + "type": "number" + }, + "failed": { + "type": "number" + }, + "notRun": { + "type": "number" + }, + "commands": { + "type": "array", + "items": { + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "passed", + "failed", + "not_run", + "skipped", + "focused", + "unknown" + ] + }, + "summary": { + "type": "string" + }, + "durationMs": { + "type": "number" + }, + "exitCode": { + "type": "number" + } + }, + "required": [ + "command", + "status" + ] + } + } + }, + "required": [ + "passed", + "failed", + "notRun", + "commands" + ] + }, + "publicSafeWarnings": { "type": "array", "items": { "type": "string" @@ -6316,25 +6289,52 @@ } }, "required": [ - "branchQuality", - "accountState" + "titleSuggestion", + "markdown", + "bodySections", + "reviewerNotes", + "validationSummary", + "publicSafeWarnings" ] }, - "rerunWhen": { + "nextActions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RewardRiskAction" + } + }, + "workspaceIntelligence": { + "$ref": "#/components/schemas/LocalWorkspaceIntelligence" + }, + "summary": { "type": "string" } }, "required": [ - "version", - "sourceUpload", - "branch", - "changedFiles", - "testEvidence", - "linkedIssues", + "login", + "repoFullName", + "generatedAt", "baseFreshness", - "ciStatusHints", - "blockers", - "rerunWhen" + "lane", + "roleContext", + "preflight", + "scorePreview", + "scenarioScorePreview", + "observedPullRequestScenarios", + "githubBranchStatus", + "branchEligibility", + "rewardRisk", + "scoreBlockers", + "branchQualityBlockers", + "accountStateBlockers", + "recommendedRerunCondition", + "localFindings", + "maintainerFit", + "manifestGuidance", + "prPacket", + "nextActions", + "workspaceIntelligence", + "summary" ] }, "MaintainerPacket": { @@ -6410,56 +6410,6 @@ "suggestedActions" ] }, - "MaintainerLaneReport": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "maintainerCut": { - "type": "number" - }, - "maintainerCutConfigured": { - "type": "boolean" - }, - "queueHealth": { - "$ref": "#/components/schemas/QueueHealth" - }, - "configQuality": { - "$ref": "#/components/schemas/ConfigQuality" - }, - "contributorIntakeHealth": { - "$ref": "#/components/schemas/ContributorIntakeHealth" - }, - "summary": { - "type": "string" - }, - "findings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } - } - }, - "required": [ - "repoFullName", - "generatedAt", - "lane", - "maintainerCut", - "maintainerCutConfigured", - "queueHealth", - "configQuality", - "contributorIntakeHealth", - "summary", - "findings" - ] - }, "ContributorIntakeHealth": { "type": "object", "properties": { @@ -6525,6 +6475,56 @@ "findings" ] }, + "MaintainerLaneReport": { + "type": "object", + "properties": { + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "maintainerCut": { + "type": "number" + }, + "maintainerCutConfigured": { + "type": "boolean" + }, + "queueHealth": { + "$ref": "#/components/schemas/QueueHealth" + }, + "configQuality": { + "$ref": "#/components/schemas/ConfigQuality" + }, + "contributorIntakeHealth": { + "$ref": "#/components/schemas/ContributorIntakeHealth" + }, + "summary": { + "type": "string" + }, + "findings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + } + }, + "required": [ + "repoFullName", + "generatedAt", + "lane", + "maintainerCut", + "maintainerCutConfigured", + "queueHealth", + "configQuality", + "contributorIntakeHealth", + "summary", + "findings" + ] + }, "MaintainerCutReadiness": { "type": "object", "properties": { @@ -7240,8 +7240,7 @@ "bot_author", "maintainer_author", "miner_detection_unavailable", - "not_official_gittensor_miner", - null + "not_official_gittensor_miner" ] }, "actions": { @@ -8279,251 +8278,63 @@ }, "currentAccess": { "type": "string" - }, - "ok": { - "type": "boolean" - }, - "action": { - "type": "string" - } - }, - "required": [ - "permission", - "requiredAccess", - "currentAccess", - "ok", - "action" - ] - } - }, - "eventRemediation": { - "type": "array", - "items": { - "type": "object", - "properties": { - "event": { - "type": "string" - }, - "ok": { - "type": "boolean" - }, - "action": { - "type": "string" - } - }, - "required": [ - "event", - "ok", - "action" - ] - } - }, - "repairSteps": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "installationId", - "accountLogin", - "installedReposCount", - "registeredInstalledCount", - "status", - "missingPermissions", - "missingEvents", - "permissions", - "events", - "checkedAt" - ] - }, - "SyncStatus": { - "type": "object", - "properties": { - "generatedAt": { - "type": "string" - }, - "signalFidelity": { - "$ref": "#/components/schemas/SignalFidelity" - }, - "freshnessSlo": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "fresh", - "degraded", - "blocked" - ] - }, - "generatedAt": { - "type": "string" - }, - "staleCount": { - "type": "number" - }, - "degradedCount": { - "type": "number" - }, - "blockedCount": { - "type": "number" - }, - "missingCount": { - "type": "number" - }, - "launchBlockingCount": { - "type": "number" - }, - "repairRecommended": { - "type": "boolean" - }, - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "area": { - "type": "string" - }, - "targetKey": { - "type": "string" - }, - "status": { - "type": "string" - }, - "launchBlocking": { - "type": "boolean" - }, - "ageSeconds": { - "type": "number" - }, - "sloSeconds": { - "type": "number" - }, - "breachSeconds": { - "type": "number" - }, - "observedAt": { - "type": "string", - "nullable": true - }, - "summary": { - "type": "string" - } - }, - "required": [ - "area", - "targetKey", - "status", - "launchBlocking", - "sloSeconds", - "summary" - ] - } - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "status", - "generatedAt", - "staleCount", - "degradedCount", - "blockedCount", - "missingCount", - "launchBlockingCount", - "repairRecommended", - "items", - "warnings" - ] - }, - "coreSignalFidelity": { - "$ref": "#/components/schemas/CoreSignalFidelity" - }, - "upstreamDrift": { - "$ref": "#/components/schemas/UpstreamStatus" - }, - "historyCoverage": { - "type": "string", - "enum": [ - "sampled", - "counts_only", - "full" - ] - }, - "refreshingRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "waitingForRateLimitRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "repositories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncState" - } - }, - "segments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncSegment" - } - }, - "githubTotals": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoGithubTotalsSnapshot" + }, + "ok": { + "type": "boolean" + }, + "action": { + "type": "string" + } + }, + "required": [ + "permission", + "requiredAccess", + "currentAccess", + "ok", + "action" + ] } }, - "pullRequestDetailSync": { + "eventRemediation": { "type": "array", "items": { "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "installations": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InstallationHealth" + "properties": { + "event": { + "type": "string" + }, + "ok": { + "type": "boolean" + }, + "action": { + "type": "string" + } + }, + "required": [ + "event", + "ok", + "action" + ] } }, - "rateLimits": { + "repairSteps": { "type": "array", "items": { - "$ref": "#/components/schemas/GitHubRateLimitObservation" + "type": "string" } } }, "required": [ - "generatedAt", - "signalFidelity", - "freshnessSlo", - "coreSignalFidelity", - "upstreamDrift", - "historyCoverage", - "refreshingRepos", - "waitingForRateLimitRepos", - "repositories", - "segments", - "githubTotals", - "pullRequestDetailSync", - "installations", - "rateLimits" + "installationId", + "accountLogin", + "installedReposCount", + "registeredInstalledCount", + "status", + "missingPermissions", + "missingEvents", + "permissions", + "events", + "checkedAt" ] }, "CoreSignalFidelity": { @@ -8589,91 +8400,6 @@ "historyCoverage" ] }, - "UpstreamStatus": { - "type": "object", - "properties": { - "generatedAt": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "current", - "drift_detected", - "stale", - "unavailable" - ] - }, - "latestCommitSha": { - "type": "string", - "nullable": true - }, - "latestRulesetId": { - "type": "string", - "nullable": true - }, - "latestRulesetGeneratedAt": { - "type": "string", - "nullable": true - }, - "activeModel": { - "type": "string", - "nullable": true, - "enum": [ - "current_density_model", - "pending_saturation_model", - "exponential_saturation_model", - "unknown", - null - ] - }, - "highestSeverity": { - "type": "string", - "nullable": true, - "enum": [ - "low", - "medium", - "high", - "blocking", - null - ] - }, - "affectedAreas": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "registry", - "scoring_model", - "issue_discovery", - "mirror_linkage", - "language_weights", - "source" - ] - } - }, - "registryHyperparameterDrift": { - "$ref": "#/components/schemas/RegistryHyperparameterDriftSummary" - }, - "openReportCount": { - "type": "number" - }, - "reports": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UpstreamDriftReport" - } - } - }, - "required": [ - "generatedAt", - "status", - "affectedAreas", - "registryHyperparameterDrift", - "openReportCount", - "reports" - ] - }, "RegistryHyperparameterDriftSummary": { "type": "object", "properties": { @@ -8736,11 +8462,124 @@ "id": { "type": "string" }, - "fingerprint": { - "type": "string" + "fingerprint": { + "type": "string" + }, + "severity": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "blocking" + ] + }, + "status": { + "type": "string", + "enum": [ + "open", + "acknowledged", + "resolved", + "ignored" + ] + }, + "summary": { + "type": "string" + }, + "affectedAreas": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "registry", + "scoring_model", + "issue_discovery", + "mirror_linkage", + "language_weights", + "source" + ] + } + }, + "previousRulesetId": { + "type": "string", + "nullable": true + }, + "currentRulesetId": { + "type": "string", + "nullable": true + }, + "issueNumber": { + "type": "number", + "nullable": true + }, + "issueUrl": { + "type": "string", + "nullable": true + }, + "payload": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "generatedAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "fingerprint", + "severity", + "status", + "summary", + "affectedAreas", + "generatedAt", + "updatedAt" + ] + }, + "UpstreamStatus": { + "type": "object", + "properties": { + "generatedAt": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "current", + "drift_detected", + "stale", + "unavailable" + ] + }, + "latestCommitSha": { + "type": "string", + "nullable": true + }, + "latestRulesetId": { + "type": "string", + "nullable": true + }, + "latestRulesetGeneratedAt": { + "type": "string", + "nullable": true + }, + "activeModel": { + "type": "string", + "nullable": true, + "enum": [ + "current_density_model", + "pending_saturation_model", + "exponential_saturation_model", + "unknown" + ] }, - "severity": { + "highestSeverity": { "type": "string", + "nullable": true, "enum": [ "low", "medium", @@ -8748,18 +8587,6 @@ "blocking" ] }, - "status": { - "type": "string", - "enum": [ - "open", - "acknowledged", - "resolved", - "ignored" - ] - }, - "summary": { - "type": "string" - }, "affectedAreas": { "type": "array", "items": { @@ -8774,44 +8601,26 @@ ] } }, - "previousRulesetId": { - "type": "string", - "nullable": true - }, - "currentRulesetId": { - "type": "string", - "nullable": true - }, - "issueNumber": { - "type": "number", - "nullable": true + "registryHyperparameterDrift": { + "$ref": "#/components/schemas/RegistryHyperparameterDriftSummary" }, - "issueUrl": { - "type": "string", - "nullable": true + "openReportCount": { + "type": "number" }, - "payload": { - "type": "object", - "additionalProperties": { - "nullable": true + "reports": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpstreamDriftReport" } - }, - "generatedAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" } }, "required": [ - "id", - "fingerprint", - "severity", + "generatedAt", "status", - "summary", "affectedAreas", - "generatedAt", - "updatedAt" + "registryHyperparameterDrift", + "openReportCount", + "reports" ] }, "RepoGithubTotalsSnapshot": { @@ -8876,6 +8685,194 @@ "fetchedAt" ] }, + "SyncStatus": { + "type": "object", + "properties": { + "generatedAt": { + "type": "string" + }, + "signalFidelity": { + "$ref": "#/components/schemas/SignalFidelity" + }, + "freshnessSlo": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "fresh", + "degraded", + "blocked" + ] + }, + "generatedAt": { + "type": "string" + }, + "staleCount": { + "type": "number" + }, + "degradedCount": { + "type": "number" + }, + "blockedCount": { + "type": "number" + }, + "missingCount": { + "type": "number" + }, + "launchBlockingCount": { + "type": "number" + }, + "repairRecommended": { + "type": "boolean" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "area": { + "type": "string" + }, + "targetKey": { + "type": "string" + }, + "status": { + "type": "string" + }, + "launchBlocking": { + "type": "boolean" + }, + "ageSeconds": { + "type": "number" + }, + "sloSeconds": { + "type": "number" + }, + "breachSeconds": { + "type": "number" + }, + "observedAt": { + "type": "string", + "nullable": true + }, + "summary": { + "type": "string" + } + }, + "required": [ + "area", + "targetKey", + "status", + "launchBlocking", + "sloSeconds", + "summary" + ] + } + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "status", + "generatedAt", + "staleCount", + "degradedCount", + "blockedCount", + "missingCount", + "launchBlockingCount", + "repairRecommended", + "items", + "warnings" + ] + }, + "coreSignalFidelity": { + "$ref": "#/components/schemas/CoreSignalFidelity" + }, + "upstreamDrift": { + "$ref": "#/components/schemas/UpstreamStatus" + }, + "historyCoverage": { + "type": "string", + "enum": [ + "sampled", + "counts_only", + "full" + ] + }, + "refreshingRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "waitingForRateLimitRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "repositories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoSyncState" + } + }, + "segments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoSyncSegment" + } + }, + "githubTotals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoGithubTotalsSnapshot" + } + }, + "pullRequestDetailSync": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "installations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InstallationHealth" + } + }, + "rateLimits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GitHubRateLimitObservation" + } + } + }, + "required": [ + "generatedAt", + "signalFidelity", + "freshnessSlo", + "coreSignalFidelity", + "upstreamDrift", + "historyCoverage", + "refreshingRepos", + "waitingForRateLimitRepos", + "repositories", + "segments", + "githubTotals", + "pullRequestDetailSync", + "installations", + "rateLimits" + ] + }, "Readiness": { "type": "object", "properties": { diff --git a/src/api/routes.ts b/src/api/routes.ts index d0bdb99ee4..bc317a5c51 100644 --- a/src/api/routes.ts +++ b/src/api/routes.ts @@ -434,7 +434,7 @@ const commandPreviewSchema = z body: z.string().max(10000).nullable().optional(), labels: z.array(z.string().max(100)).max(50).optional(), linkedIssues: z.array(z.number().int().positive()).max(50).optional(), - permissions: z.record(z.string()).optional(), + permissions: z.record(z.string(), z.string()).optional(), missingPermissions: z.array(z.string().max(100)).max(50).optional(), }) .strict() diff --git a/src/openapi/schemas.ts b/src/openapi/schemas.ts index 62a90efc33..27b66c2c43 100644 --- a/src/openapi/schemas.ts +++ b/src/openapi/schemas.ts @@ -609,7 +609,7 @@ export const CommandPreviewResponseSchema = z description: z.string(), endpoint: z.string(), }), - request: z.record(z.unknown()), + request: z.record(z.string(), z.unknown()), preview: z.object({ boundary: z.enum(["public", "public-safe", "private-api", "private-mcp"]), endpoint: z.string(), From 07a04444f1430c72a8a4e84fdd2f9dceadb31b9c Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:29:27 +0200 Subject: [PATCH 3/5] test: cover invalid queue intelligence requests --- test/integration/api.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/integration/api.test.ts b/test/integration/api.test.ts index 5896061a37..1e318ede82 100644 --- a/test/integration/api.test.ts +++ b/test/integration/api.test.ts @@ -2568,6 +2568,12 @@ describe("api routes", () => { const invalidCommandPreview = await app.request("/v1/app/commands/preview", { method: "POST", headers: apiHeaders(env), body: "{" }, env); expect(invalidCommandPreview.status).toBe(400); + const invalidQueueJson = await app.request("/v1/internal/queue-intelligence", { method: "POST", headers: internalHeaders, body: "{" }, env); + expect(invalidQueueJson.status).toBe(400); + const invalidQueueShape = await app.request("/v1/internal/queue-intelligence", { method: "POST", headers: internalHeaders, body: "{}" }, env); + expect(invalidQueueShape.status).toBe(400); + await expect(invalidQueueShape.json()).resolves.toMatchObject({ error: "invalid_request", detail: "pullRequests array required" }); + const invalidDigestJson = await app.request("/v1/app/digest/subscriptions", { method: "POST", headers: { cookie: `gittensory_session=${noIdToken}` }, body: "{" }, env); expect(invalidDigestJson.status).toBe(400); From 72943345c9a07579e904c022de928423c910f41f Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:43:23 +0200 Subject: [PATCH 4/5] test: raise command preview coverage margin --- test/integration/api.test.ts | 3 +++ .../maintainer-settings-preview-ui.test.ts | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/test/integration/api.test.ts b/test/integration/api.test.ts index 1e318ede82..b833fde21f 100644 --- a/test/integration/api.test.ts +++ b/test/integration/api.test.ts @@ -1199,6 +1199,7 @@ describe("api routes", () => { roleCards: expect.arrayContaining([expect.objectContaining({ role: "operator", status: "active" })]), publicSafe: true, }); + expect((await app.request("/v1/app/roles", {}, env)).status).toBe(401); const emptyEnv = createTestEnv(); const emptyOverview = await app.request("/v1/app/overview", { headers: apiHeaders(emptyEnv) }, emptyEnv); @@ -1239,6 +1240,7 @@ describe("api routes", () => { const { token: otherToken } = await createSessionForGitHubUser(env, { login: "other", id: 987 }); const forbiddenMiner = await app.request("/v1/app/miner-dashboard?login=oktofeesh1", { headers: { cookie: `gittensory_session=${otherToken}` } }, env); expect(forbiddenMiner.status).toBe(403); + expect((await app.request("/v1/app/maintainer-dashboard", {}, env)).status).toBe(401); const unknownEnv = createTestEnv({ ADMIN_GITHUB_LOGINS: "jsonbored" }); const { token: unknownToken } = await createSessionForGitHubUser(unknownEnv, { login: "new-user", id: 2468 }); @@ -1257,6 +1259,7 @@ describe("api routes", () => { expect(unknownOverview.status).toBe(200); await expect(unknownOverview.json()).resolves.toMatchObject({ roleSummary: { roles: [], onboarding: { status: "needs_setup" } } }); expect((await app.request("/v1/app/operator-dashboard", { headers: unknownHeaders }, unknownEnv)).status).toBe(403); + expect((await app.request("/v1/app/maintainer-dashboard", { headers: unknownHeaders }, unknownEnv)).status).toBe(403); expect((await app.request("/v1/app/commands/usefulness", { headers: unknownHeaders }, unknownEnv)).status).toBe(403); expect( ( diff --git a/test/unit/maintainer-settings-preview-ui.test.ts b/test/unit/maintainer-settings-preview-ui.test.ts index bd6e1e9bbf..9e024d054b 100644 --- a/test/unit/maintainer-settings-preview-ui.test.ts +++ b/test/unit/maintainer-settings-preview-ui.test.ts @@ -63,6 +63,31 @@ describe("maintainer settings preview UI helpers", () => { }); }); + it("falls back to the default scenario and omits blank optional body text", () => { + expect(findPreviewScenario("unknown-scenario" as never)).toEqual(findPreviewScenario("confirmed-miner")); + + expect( + buildSettingsPreviewRequest({ + repoFullName: "JSONbored/gittensory", + scenarioId: "confirmed-miner", + title: "Review cache preview", + labels: "", + linkedIssues: "", + body: " ", + }), + ).toEqual({ + sample: { + authorLogin: "sample-miner", + authorType: "User", + authorAssociation: "CONTRIBUTOR", + minerStatus: "confirmed", + title: "Review cache preview", + labels: [], + linkedIssues: [], + }, + }); + }); + it("keeps all required simulator scenarios available", () => { expect(findPreviewScenario("confirmed-miner").sample).toMatchObject({ minerStatus: "confirmed", From 31a5932ce1a073c76f042b78cf5cfbbd3bdb21b5 Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:47:51 +0200 Subject: [PATCH 5/5] chore: refresh generated openapi artifact --- apps/gittensory-ui/public/openapi.json | 7245 ++++++++++++------------ 1 file changed, 3624 insertions(+), 3621 deletions(-) diff --git a/apps/gittensory-ui/public/openapi.json b/apps/gittensory-ui/public/openapi.json index 31bb455e42..6007993495 100644 --- a/apps/gittensory-ui/public/openapi.json +++ b/apps/gittensory-ui/public/openapi.json @@ -146,59 +146,6 @@ "generatedAt" ] }, - "RegistryRepo": { - "type": "object", - "properties": { - "repo": { - "type": "string" - }, - "emissionShare": { - "type": "number" - }, - "issueDiscoveryShare": { - "type": "number" - }, - "labelMultipliers": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "trustedLabelPipeline": { - "type": "boolean", - "nullable": true - }, - "maintainerCut": { - "type": "number" - }, - "defaultLabelMultiplier": { - "type": "number", - "nullable": true - }, - "fixedBaseScore": { - "type": "number", - "nullable": true - }, - "eligibilityMode": { - "type": "string", - "nullable": true - }, - "raw": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "repo", - "emissionShare", - "issueDiscoveryShare", - "labelMultipliers", - "maintainerCut", - "raw" - ] - }, "RegistrySnapshot": { "type": "object", "properties": { @@ -260,6 +207,59 @@ "repositories" ] }, + "RegistryRepo": { + "type": "object", + "properties": { + "repo": { + "type": "string" + }, + "emissionShare": { + "type": "number" + }, + "issueDiscoveryShare": { + "type": "number" + }, + "labelMultipliers": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "trustedLabelPipeline": { + "type": "boolean", + "nullable": true + }, + "maintainerCut": { + "type": "number" + }, + "defaultLabelMultiplier": { + "type": "number", + "nullable": true + }, + "fixedBaseScore": { + "type": "number", + "nullable": true + }, + "eligibilityMode": { + "type": "string", + "nullable": true + }, + "raw": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "required": [ + "repo", + "emissionShare", + "issueDiscoveryShare", + "labelMultipliers", + "maintainerCut", + "raw" + ] + }, "Repository": { "type": "object", "properties": { @@ -313,40 +313,6 @@ "isPrivate" ] }, - "Finding": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "title": { - "type": "string" - }, - "severity": { - "type": "string", - "enum": [ - "info", - "warning", - "critical" - ] - }, - "detail": { - "type": "string" - }, - "action": { - "type": "string" - }, - "publicText": { - "type": "string" - } - }, - "required": [ - "code", - "title", - "severity", - "detail" - ] - }, "Advisory": { "type": "object", "properties": { @@ -421,6 +387,40 @@ "generatedAt" ] }, + "Finding": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "title": { + "type": "string" + }, + "severity": { + "type": "string", + "enum": [ + "info", + "warning", + "critical" + ] + }, + "detail": { + "type": "string" + }, + "action": { + "type": "string" + }, + "publicText": { + "type": "string" + } + }, + "required": [ + "code", + "title", + "severity", + "detail" + ] + }, "WorkboardItem": { "type": "object", "properties": { @@ -560,68 +560,6 @@ "findings" ] }, - "CollisionItem": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "issue", - "pull_request" - ] - }, - "number": { - "type": "number" - }, - "title": { - "type": "string" - }, - "authorLogin": { - "type": "string", - "nullable": true - }, - "htmlUrl": { - "type": "string", - "nullable": true - } - }, - "required": [ - "type", - "number", - "title" - ] - }, - "CollisionCluster": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "risk": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "reason": { - "type": "string" - }, - "items": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CollisionItem" - } - } - }, - "required": [ - "id", - "risk", - "reason", - "items" - ] - }, "CollisionReport": { "type": "object", "properties": { @@ -664,44 +602,66 @@ "clusters" ] }, - "LaneAdvice": { + "CollisionCluster": { "type": "object", "properties": { - "lane": { + "id": { + "type": "string" + }, + "risk": { "type": "string", "enum": [ - "direct_pr", - "issue_discovery", - "split", - "inactive", - "unknown" + "low", + "medium", + "high" ] }, - "repoFullName": { + "reason": { "type": "string" }, - "issueDiscoveryShare": { - "type": "number" - }, - "directPrShare": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollisionItem" + } + } + }, + "required": [ + "id", + "risk", + "reason", + "items" + ] + }, + "CollisionItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "issue", + "pull_request" + ] + }, + "number": { "type": "number" }, - "summary": { + "title": { "type": "string" }, - "contributorGuidance": { - "type": "string" + "authorLogin": { + "type": "string", + "nullable": true }, - "maintainerGuidance": { - "type": "string" + "htmlUrl": { + "type": "string", + "nullable": true } }, "required": [ - "lane", - "repoFullName", - "summary", - "contributorGuidance", - "maintainerGuidance" + "type", + "number", + "title" ] }, "ConfigQuality": { @@ -765,6 +725,46 @@ "findings" ] }, + "LaneAdvice": { + "type": "object", + "properties": { + "lane": { + "type": "string", + "enum": [ + "direct_pr", + "issue_discovery", + "split", + "inactive", + "unknown" + ] + }, + "repoFullName": { + "type": "string" + }, + "issueDiscoveryShare": { + "type": "number" + }, + "directPrShare": { + "type": "number" + }, + "summary": { + "type": "string" + }, + "contributorGuidance": { + "type": "string" + }, + "maintainerGuidance": { + "type": "string" + } + }, + "required": [ + "lane", + "repoFullName", + "summary", + "contributorGuidance", + "maintainerGuidance" + ] + }, "LabelAudit": { "type": "object", "properties": { @@ -1901,129 +1901,246 @@ "summary" ] }, - "DecisionPackFreshness": { - "type": "string", - "enum": [ - "fresh", - "stale", - "rebuilding", - "missing" - ] - }, - "ContributorOpenPrNextStepPacket": { + "ContributorDecisionPack": { "type": "object", "properties": { - "repoFullName": { + "status": { + "type": "string", + "enum": [ + "ready" + ] + }, + "source": { + "type": "string", + "enum": [ + "computed", + "snapshot" + ] + }, + "login": { "type": "string" }, - "number": { + "generatedAt": { + "type": "string" + }, + "snapshotAgeSeconds": { "type": "number" }, - "title": { - "type": "string" + "stale": { + "type": "boolean" }, - "classification": { - "type": "string", - "enum": [ - "approved", - "blocked", - "stale", - "needs_author", - "failing_checks", - "missing_tests", - "duplicate_prone", - "reviewable", - "should_close_or_withdraw", - "maintainer_lane", - "draft" - ] + "freshness": { + "$ref": "#/components/schemas/DecisionPackFreshness" }, - "summary": { + "rebuildEnqueued": { + "type": "boolean" + }, + "scoringModelSnapshotId": { "type": "string" }, - "reasons": { + "profile": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "outcomeHistory": { + "$ref": "#/components/schemas/ContributorOutcomeHistory" + }, + "roleContexts": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/RoleContext" } }, - "nextSteps": { + "opportunities": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/ContributorOpportunity" } - } - }, - "required": [ - "repoFullName", - "number", - "title", - "classification", - "summary", - "reasons", - "nextSteps" - ] - }, - "ContributorOpenPrMonitor": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "generatedAt": { - "type": "string" }, - "openPrCount": { - "type": "number" + "repoDecisions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } }, - "registeredRepoCount": { - "type": "number" + "topActions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } }, "cleanupFirst": { - "type": "boolean" + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } }, - "summary": { - "type": "string" + "pursueRepos": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } }, - "guidance": { + "avoidRepos": { "type": "array", "items": { - "type": "string" + "type": "object", + "additionalProperties": { + "nullable": true + } } }, - "pendingScenarios": { + "maintainerLaneRepos": { "type": "array", "items": { "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "detection": { - "type": "object", - "properties": { - "source": { - "type": "string", - "enum": [ - "github_observed", - "user_supplied" - ] - }, - "pendingMergedPrCount": { - "type": "number" - }, - "pendingClosedPrCount": { - "type": "number" - }, - "approvedPrCount": { - "type": "number" - }, - "expectedOpenPrCountAfterMerge": { - "type": "number" - }, - "scenarioNotes": { - "type": "array", - "items": { + "additionalProperties": { + "nullable": true + } + } + }, + "scoreBlockers": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "evidenceGraph": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "dataQuality": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "summary": { + "type": "string" + }, + "nextActions": { + "type": "array", + "items": { + "type": "string" + } + }, + "openPrMonitor": { + "$ref": "#/components/schemas/ContributorOpenPrMonitor" + } + }, + "required": [ + "status", + "source", + "login", + "generatedAt", + "stale", + "freshness", + "rebuildEnqueued", + "scoringModelSnapshotId", + "profile", + "outcomeHistory", + "roleContexts", + "opportunities", + "repoDecisions", + "topActions", + "cleanupFirst", + "pursueRepos", + "avoidRepos", + "maintainerLaneRepos", + "scoreBlockers", + "dataQuality", + "summary", + "nextActions" + ] + }, + "DecisionPackFreshness": { + "type": "string", + "enum": [ + "fresh", + "stale", + "rebuilding", + "missing" + ] + }, + "ContributorOpenPrMonitor": { + "type": "object", + "properties": { + "login": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "openPrCount": { + "type": "number" + }, + "registeredRepoCount": { + "type": "number" + }, + "cleanupFirst": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "guidance": { + "type": "array", + "items": { + "type": "string" + } + }, + "pendingScenarios": { + "type": "array", + "items": { + "type": "object", + "properties": { + "repoFullName": { + "type": "string" + }, + "detection": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "github_observed", + "user_supplied" + ] + }, + "pendingMergedPrCount": { + "type": "number" + }, + "pendingClosedPrCount": { + "type": "number" + }, + "approvedPrCount": { + "type": "number" + }, + "expectedOpenPrCountAfterMerge": { + "type": "number" + }, + "scenarioNotes": { + "type": "array", + "items": { "type": "string" } }, @@ -2096,33 +2213,127 @@ "pullRequests" ] }, - "ContributorDecisionPack": { + "ContributorOpenPrNextStepPacket": { "type": "object", "properties": { - "status": { + "repoFullName": { + "type": "string" + }, + "number": { + "type": "number" + }, + "title": { + "type": "string" + }, + "classification": { "type": "string", "enum": [ - "ready" + "approved", + "blocked", + "stale", + "needs_author", + "failing_checks", + "missing_tests", + "duplicate_prone", + "reviewable", + "should_close_or_withdraw", + "maintainer_lane", + "draft" ] }, - "source": { + "summary": { + "type": "string" + }, + "reasons": { + "type": "array", + "items": { + "type": "string" + } + }, + "nextSteps": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "repoFullName", + "number", + "title", + "classification", + "summary", + "reasons", + "nextSteps" + ] + }, + "DecisionPackRefreshNeeded": { + "type": "object", + "properties": { + "status": { "type": "string", "enum": [ - "computed", - "snapshot" + "needs_snapshot_refresh" ] }, "login": { "type": "string" }, + "repoFullName": { + "type": "string" + }, "generatedAt": { "type": "string" }, - "snapshotAgeSeconds": { - "type": "number" + "reason": { + "type": "string", + "enum": [ + "missing_snapshot" + ] }, - "stale": { + "freshness": { + "type": "string", + "enum": [ + "missing" + ] + }, + "rebuildEnqueued": { "type": "boolean" + } + }, + "required": [ + "status", + "login", + "generatedAt", + "reason", + "freshness", + "rebuildEnqueued" + ] + }, + "RepoDecisionResponse": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "ready" + ] + }, + "login": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "source": { + "type": "string", + "enum": [ + "computed", + "snapshot" + ] }, "freshness": { "$ref": "#/components/schemas/DecisionPackFreshness" @@ -2130,95 +2341,110 @@ "rebuildEnqueued": { "type": "boolean" }, - "scoringModelSnapshotId": { - "type": "string" - }, - "profile": { + "decision": { "type": "object", "additionalProperties": { "nullable": true } }, - "outcomeHistory": { - "$ref": "#/components/schemas/ContributorOutcomeHistory" - }, - "roleContexts": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RoleContext" + "dataQuality": { + "type": "object", + "additionalProperties": { + "nullable": true } + } + }, + "required": [ + "status", + "login", + "repoFullName", + "generatedAt", + "source", + "freshness", + "rebuildEnqueued", + "decision", + "dataQuality" + ] + }, + "RepoIntelligence": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "ready" + ] }, - "opportunities": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContributorOpportunity" - } + "source": { + "type": "string", + "enum": [ + "computed", + "snapshot" + ] }, - "repoDecisions": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } + "repoFullName": { + "type": "string" }, - "topActions": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { + "generatedAt": { + "type": "string" + }, + "repo": { + "allOf": [ + { + "$ref": "#/components/schemas/Repository" + }, + { "nullable": true } + ] + }, + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "queueHealth": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true } }, - "cleanupFirst": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "collisions": { + "type": "object", + "additionalProperties": { + "nullable": true } }, - "pursueRepos": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "configQuality": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true } }, - "avoidRepos": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "labelAudit": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true } }, - "maintainerLaneRepos": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "maintainerLane": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true } }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "maintainerCutReadiness": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true } }, - "evidenceGraph": { + "contributorIntakeHealth": { "type": "object", + "nullable": true, "additionalProperties": { "nullable": true } @@ -2229,183 +2455,179 @@ "nullable": true } }, - "summary": { - "type": "string" - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } + "burdenForecast": { + "$ref": "#/components/schemas/BurdenForecast" }, - "openPrMonitor": { - "$ref": "#/components/schemas/ContributorOpenPrMonitor" + "burdenForecastFreshness": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "snapshot", + "computed" + ] + }, + "generatedAt": { + "type": "string" + }, + "ageSeconds": { + "type": "number" + }, + "freshness": { + "type": "string", + "enum": [ + "fresh", + "stale" + ] + } + }, + "required": [ + "source", + "generatedAt", + "ageSeconds", + "freshness" + ] } }, "required": [ "status", "source", - "login", + "repoFullName", "generatedAt", - "stale", - "freshness", - "rebuildEnqueued", - "scoringModelSnapshotId", - "profile", - "outcomeHistory", - "roleContexts", - "opportunities", - "repoDecisions", - "topActions", - "cleanupFirst", - "pursueRepos", - "avoidRepos", - "maintainerLaneRepos", - "scoreBlockers", - "dataQuality", - "summary", - "nextActions" + "repo", + "lane", + "dataQuality" ] }, - "DecisionPackRefreshNeeded": { + "BurdenForecast": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "needs_snapshot_refresh" - ] - }, - "login": { - "type": "string" - }, "repoFullName": { "type": "string" }, "generatedAt": { "type": "string" }, - "reason": { - "type": "string", - "enum": [ - "missing_snapshot" + "horizonDays": { + "anyOf": [ + { + "type": "number", + "enum": [ + 7 + ] + }, + { + "type": "number", + "enum": [ + 30 + ] + } ] }, - "freshness": { + "level": { "type": "string", "enum": [ - "missing" + "low", + "medium", + "high", + "critical" ] }, - "rebuildEnqueued": { - "type": "boolean" + "forecast": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "findings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + }, + "summary": { + "type": "string" } }, "required": [ - "status", - "login", + "repoFullName", "generatedAt", - "reason", - "freshness", - "rebuildEnqueued" + "horizonDays", + "level", + "forecast", + "findings", + "summary" ] }, - "RepoDecisionResponse": { + "RepoOutcomePatterns": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "ready" - ] - }, - "login": { - "type": "string" - }, "repoFullName": { "type": "string" }, "generatedAt": { "type": "string" }, - "source": { + "lane": { "type": "string", "enum": [ - "computed", - "snapshot" + "direct_pr", + "issue_discovery", + "split", + "inactive", + "unknown" ] }, - "freshness": { - "$ref": "#/components/schemas/DecisionPackFreshness" + "primaryLanguage": { + "type": "string", + "nullable": true }, - "rebuildEnqueued": { - "type": "boolean" + "sampleSize": { + "type": "number" }, - "decision": { + "totals": { "type": "object", "additionalProperties": { - "nullable": true + "type": "number" } }, - "dataQuality": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "status", - "login", - "repoFullName", - "generatedAt", - "source", - "freshness", - "rebuildEnqueued", - "decision", - "dataQuality" - ] - }, - "BurdenForecast": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" + "outsideContributorMergeRate": { + "type": "number" }, - "generatedAt": { - "type": "string" + "maintainerLaneMergeRate": { + "type": "number" }, - "horizonDays": { - "anyOf": [ - { - "type": "number", - "enum": [ - 7 - ] - }, - { - "type": "number", - "enum": [ - 30 - ] + "dimensions": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true } - ] + } }, - "level": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "critical" - ] + "successPatterns": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } }, - "forecast": { - "type": "object", - "additionalProperties": { - "type": "number" + "riskPatterns": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "nullable": true + } } }, + "evidenceCompleteness": { + "$ref": "#/components/schemas/RepoOutcomeEvidenceCompleteness" + }, "findings": { "type": "array", "items": { @@ -2419,14 +2641,69 @@ "required": [ "repoFullName", "generatedAt", - "horizonDays", - "level", - "forecast", + "lane", + "primaryLanguage", + "sampleSize", + "totals", + "outsideContributorMergeRate", + "maintainerLaneMergeRate", + "dimensions", + "successPatterns", + "riskPatterns", + "evidenceCompleteness", "findings", "summary" ] }, - "RepoIntelligence": { + "RepoOutcomeEvidenceCompleteness": { + "type": "object", + "properties": { + "pullRequestsAnalyzed": { + "type": "number" + }, + "withFileDetail": { + "type": "number" + }, + "withReviewDetail": { + "type": "number" + }, + "withCheckDetail": { + "type": "number" + }, + "filesCompletenessRatio": { + "type": "number" + }, + "reviewsCompletenessRatio": { + "type": "number" + }, + "checksCompletenessRatio": { + "type": "number" + }, + "fullyDecidedWithDetail": { + "type": "number" + }, + "status": { + "type": "string", + "enum": [ + "complete", + "partial", + "missing" + ] + } + }, + "required": [ + "pullRequestsAnalyzed", + "withFileDetail", + "withReviewDetail", + "withCheckDetail", + "filesCompletenessRatio", + "reviewsCompletenessRatio", + "checksCompletenessRatio", + "fullyDecidedWithDetail", + "status" + ] + }, + "RepoOutcomePatternsResponse": { "type": "object", "properties": { "status": { @@ -2438,8 +2715,8 @@ "source": { "type": "string", "enum": [ - "computed", - "snapshot" + "snapshot", + "computed" ] }, "repoFullName": { @@ -2448,2088 +2725,1142 @@ "generatedAt": { "type": "string" }, - "repo": { - "allOf": [ - { - "$ref": "#/components/schemas/Repository" - }, - { - "nullable": true - } + "ageSeconds": { + "type": "number" + }, + "freshness": { + "type": "string", + "enum": [ + "fresh", + "stale" ] }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" + "patterns": { + "$ref": "#/components/schemas/RepoOutcomePatterns" }, - "queueHealth": { + "dataQuality": { "type": "object", - "nullable": true, "additionalProperties": { "nullable": true } + } + }, + "required": [ + "status", + "source", + "repoFullName", + "generatedAt", + "ageSeconds", + "freshness", + "patterns" + ] + }, + "RegistrationReadiness": { + "type": "object", + "properties": { + "repoFullName": { + "type": "string" }, - "collisions": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "generatedAt": { + "type": "string" }, - "configQuality": { - "type": "object", - "nullable": true, - "additionalProperties": { - "nullable": true - } + "ready": { + "type": "boolean" }, - "labelAudit": { - "type": "object", - "nullable": true, - "additionalProperties": { - "nullable": true - } + "recommendedRegistrationMode": { + "type": "string", + "enum": [ + "direct_pr", + "issue_discovery", + "split" + ] }, - "maintainerLane": { + "issuePolicy": { + "type": "string", + "enum": [ + "issue_discovery_enabled", + "split_pr_and_issue_discovery_enabled", + "direct_pr_requires_linked_issue", + "direct_pr_no_issue_required" + ] + }, + "directPrReadiness": { + "type": "object", + "properties": { + "ready": { + "type": "boolean" + }, + "reasons": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "ready", + "reasons" + ] + }, + "issueDiscoveryReadiness": { + "type": "object", + "properties": { + "ready": { + "type": "boolean" + }, + "recommendation": { + "type": "string", + "enum": [ + "enabled", + "recommended", + "not_recommended" + ] + }, + "reasons": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "ready", + "recommendation", + "reasons" + ] + }, + "labelPolicy": { "type": "object", - "nullable": true, "additionalProperties": { "nullable": true } }, "maintainerCutReadiness": { "type": "object", - "nullable": true, "additionalProperties": { "nullable": true } }, + "testCoverageHealth": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "gate_ready", + "gate_unknown" + ] + }, + "trustedLabelPipelineReady": { + "type": "boolean" + }, + "checkRunMode": { + "type": "string", + "enum": [ + "off", + "enabled" + ] + }, + "requiredGate": { + "type": "array", + "items": { + "type": "string" + } + }, + "note": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "status", + "trustedLabelPipelineReady", + "checkRunMode", + "requiredGate", + "note", + "warnings" + ] + }, + "queueHealth": { + "type": "object", + "properties": { + "level": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "critical" + ] + }, + "burdenScore": { + "type": "number" + }, + "reviewablePullRequests": { + "type": "number" + }, + "summary": { + "type": "string" + } + }, + "required": [ + "level", + "burdenScore", + "reviewablePullRequests", + "summary" + ] + }, "contributorIntakeHealth": { "type": "object", - "nullable": true, "additionalProperties": { "nullable": true } }, - "dataQuality": { + "docsCompleteness": { "type": "object", "additionalProperties": { "nullable": true } }, - "burdenForecast": { - "$ref": "#/components/schemas/BurdenForecast" - }, - "burdenForecastFreshness": { + "githubApp": { "type": "object", "properties": { - "source": { + "installed": { + "type": "boolean" + }, + "publicSurface": { "type": "string", "enum": [ - "snapshot", - "computed" + "off", + "comment_and_label", + "comment_only", + "label_only" ] }, - "generatedAt": { - "type": "string" - }, - "ageSeconds": { - "type": "number" + "commentMode": { + "type": "string", + "enum": [ + "off", + "detected_contributors_only", + "all_prs" + ] }, - "freshness": { + "checkRunMode": { "type": "string", "enum": [ - "fresh", - "stale" + "off", + "enabled" ] + }, + "quietByDefault": { + "type": "boolean" + }, + "behavior": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "source", - "generatedAt", - "ageSeconds", - "freshness" + "installed", + "publicSurface", + "commentMode", + "checkRunMode", + "quietByDefault", + "behavior", + "warnings" ] + }, + "blockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "dataQuality": { + "type": "object", + "additionalProperties": { + "nullable": true + } } }, "required": [ - "status", - "source", "repoFullName", "generatedAt", - "repo", - "lane", + "ready", + "recommendedRegistrationMode", + "issuePolicy", + "directPrReadiness", + "issueDiscoveryReadiness", + "labelPolicy", + "maintainerCutReadiness", + "testCoverageHealth", + "queueHealth", + "contributorIntakeHealth", + "docsCompleteness", + "githubApp", + "blockers", + "warnings", "dataQuality" ] }, - "RepoOutcomeEvidenceCompleteness": { + "GittensorConfigRecommendation": { "type": "object", "properties": { - "pullRequestsAnalyzed": { - "type": "number" + "repoFullName": { + "type": "string" }, - "withFileDetail": { - "type": "number" + "generatedAt": { + "type": "string" }, - "withReviewDetail": { - "type": "number" + "privateOnly": { + "type": "boolean" }, - "withCheckDetail": { - "type": "number" + "current": { + "type": "object", + "nullable": true, + "additionalProperties": { + "nullable": true + } }, - "filesCompletenessRatio": { - "type": "number" + "recommended": { + "type": "object", + "additionalProperties": { + "nullable": true + } }, - "reviewsCompletenessRatio": { - "type": "number" + "tradeoffs": { + "type": "array", + "items": { + "type": "string" + } }, - "checksCompletenessRatio": { - "type": "number" + "reasons": { + "type": "array", + "items": { + "type": "string" + } }, - "fullyDecidedWithDetail": { - "type": "number" + "warnings": { + "type": "array", + "items": { + "type": "string" + } }, - "status": { - "type": "string", - "enum": [ - "complete", - "partial", - "missing" - ] + "dataQuality": { + "type": "object", + "additionalProperties": { + "nullable": true + } } }, "required": [ - "pullRequestsAnalyzed", - "withFileDetail", - "withReviewDetail", - "withCheckDetail", - "filesCompletenessRatio", - "reviewsCompletenessRatio", - "checksCompletenessRatio", - "fullyDecidedWithDetail", - "status" + "repoFullName", + "generatedAt", + "privateOnly", + "current", + "recommended", + "tradeoffs", + "reasons", + "warnings", + "dataQuality" ] }, - "RepoOutcomePatterns": { + "RepoFitRecommendation": { "type": "object", "properties": { + "login": { + "type": "string" + }, "repoFullName": { "type": "string" }, "generatedAt": { "type": "string" }, + "roleContext": { + "$ref": "#/components/schemas/RoleContext" + }, "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "recommendation": { "type": "string", "enum": [ - "direct_pr", - "issue_discovery", - "split", - "inactive", + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", "unknown" ] }, - "primaryLanguage": { + "confidence": { "type": "string", - "nullable": true - }, - "sampleSize": { - "type": "number" - }, - "totals": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "outsideContributorMergeRate": { - "type": "number" - }, - "maintainerLaneMergeRate": { - "type": "number" + "enum": [ + "high", + "medium", + "low" + ] }, - "dimensions": { + "reasons": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } }, - "successPatterns": { + "risks": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } }, - "riskPatterns": { + "nextActions": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } }, - "evidenceCompleteness": { - "$ref": "#/components/schemas/RepoOutcomeEvidenceCompleteness" + "rewardRisk": { + "type": "object", + "additionalProperties": { + "nullable": true + } }, - "findings": { + "reasoning": { "type": "array", "items": { - "$ref": "#/components/schemas/Finding" + "type": "string" } }, - "summary": { - "type": "string" + "actionImpact": { + "type": "object", + "additionalProperties": { + "nullable": true + } } }, "required": [ + "login", "repoFullName", "generatedAt", + "roleContext", "lane", - "primaryLanguage", - "sampleSize", - "totals", - "outsideContributorMergeRate", - "maintainerLaneMergeRate", - "dimensions", - "successPatterns", - "riskPatterns", - "evidenceCompleteness", - "findings", - "summary" + "recommendation", + "confidence", + "reasons", + "risks", + "nextActions" ] }, - "RepoOutcomePatternsResponse": { + "PreflightResult": { "type": "object", "properties": { - "status": { - "type": "string", - "enum": [ - "ready" - ] - }, - "source": { - "type": "string", - "enum": [ - "snapshot", - "computed" - ] - }, "repoFullName": { "type": "string" }, "generatedAt": { "type": "string" }, - "ageSeconds": { - "type": "number" + "status": { + "type": "string", + "enum": [ + "ready", + "needs_work", + "hold" + ] }, - "freshness": { + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "reviewBurden": { "type": "string", "enum": [ - "fresh", - "stale" + "low", + "medium", + "high" ] }, - "patterns": { - "$ref": "#/components/schemas/RepoOutcomePatterns" + "linkedIssues": { + "type": "array", + "items": { + "type": "number" + } }, - "dataQuality": { - "type": "object", - "additionalProperties": { - "nullable": true + "findings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + }, + "collisions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CollisionCluster" } } }, "required": [ - "status", - "source", "repoFullName", "generatedAt", - "ageSeconds", - "freshness", - "patterns" + "status", + "lane", + "reviewBurden", + "linkedIssues", + "findings", + "collisions" ] }, - "RegistrationReadiness": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "ready": { - "type": "boolean" - }, - "recommendedRegistrationMode": { - "type": "string", - "enum": [ - "direct_pr", - "issue_discovery", - "split" - ] - }, - "issuePolicy": { - "type": "string", - "enum": [ - "issue_discovery_enabled", - "split_pr_and_issue_discovery_enabled", - "direct_pr_requires_linked_issue", - "direct_pr_no_issue_required" - ] + "LocalDiffPreflightResult": { + "allOf": [ + { + "$ref": "#/components/schemas/PreflightResult" }, - "directPrReadiness": { + { "type": "object", "properties": { - "ready": { - "type": "boolean" - }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "ready", - "reasons" - ] - }, - "issueDiscoveryReadiness": { - "type": "object", - "properties": { - "ready": { - "type": "boolean" - }, - "recommendation": { - "type": "string", - "enum": [ - "enabled", - "recommended", - "not_recommended" + "localDiff": { + "type": "object", + "properties": { + "changedFileCount": { + "type": "number" + }, + "changedLineCount": { + "type": "number" + }, + "testFileCount": { + "type": "number" + }, + "codeFileCount": { + "type": "number" + }, + "inferredLinkedIssues": { + "type": "array", + "items": { + "type": "number" + } + }, + "summary": { + "type": "string" + } + }, + "required": [ + "changedFileCount", + "changedLineCount", + "testFileCount", + "codeFileCount", + "inferredLinkedIssues", + "summary" ] - }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } } }, "required": [ - "ready", - "recommendation", - "reasons" + "localDiff" ] + } + ] + }, + "LocalBranchAnalysis": { + "type": "object", + "properties": { + "login": { + "type": "string" }, - "labelPolicy": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "repoFullName": { + "type": "string" }, - "maintainerCutReadiness": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "generatedAt": { + "type": "string" }, - "testCoverageHealth": { + "baseRef": { + "type": "string" + }, + "headRef": { + "type": "string" + }, + "branchName": { + "type": "string" + }, + "baseFreshness": { "type": "object", "properties": { "status": { "type": "string", "enum": [ - "gate_ready", - "gate_unknown" + "fresh", + "stale", + "possibly_stale", + "unknown" ] }, - "trustedLabelPipelineReady": { - "type": "boolean" + "baseRef": { + "type": "string" }, - "checkRunMode": { - "type": "string", - "enum": [ - "off", - "enabled" - ] + "baseSha": { + "type": "string" }, - "requiredGate": { - "type": "array", - "items": { - "type": "string" - } + "headSha": { + "type": "string" }, - "note": { + "mergeBaseSha": { "type": "string" }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "status", - "trustedLabelPipelineReady", - "checkRunMode", - "requiredGate", - "note", - "warnings" - ] - }, - "queueHealth": { - "type": "object", - "properties": { - "level": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "critical" - ] + "remoteTrackingSha": { + "type": "string" }, - "burdenScore": { + "changedFileCount": { "type": "number" }, - "reviewablePullRequests": { + "testFileCount": { "type": "number" }, - "summary": { - "type": "string" - } - }, - "required": [ - "level", - "burdenScore", - "reviewablePullRequests", - "summary" - ] - }, - "contributorIntakeHealth": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "docsCompleteness": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "githubApp": { - "type": "object", - "properties": { - "installed": { - "type": "boolean" - }, - "publicSurface": { - "type": "string", - "enum": [ - "off", - "comment_and_label", - "comment_only", - "label_only" - ] - }, - "commentMode": { - "type": "string", - "enum": [ - "off", - "detected_contributors_only", - "all_prs" - ] - }, - "checkRunMode": { - "type": "string", - "enum": [ - "off", - "enabled" - ] - }, - "quietByDefault": { - "type": "boolean" - }, - "behavior": { - "type": "string" + "passedValidationCount": { + "type": "number" }, "warnings": { "type": "array", "items": { "type": "string" } + }, + "recommendation": { + "type": "string" } }, "required": [ - "installed", - "publicSurface", - "commentMode", - "checkRunMode", - "quietByDefault", - "behavior", + "status", + "changedFileCount", + "testFileCount", + "passedValidationCount", "warnings" ] }, - "blockers": { - "type": "array", - "items": { - "type": "string" - } + "lane": { + "$ref": "#/components/schemas/LaneAdvice" }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } + "roleContext": { + "$ref": "#/components/schemas/RoleContext" }, - "dataQuality": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "repoFullName", - "generatedAt", - "ready", - "recommendedRegistrationMode", - "issuePolicy", - "directPrReadiness", - "issueDiscoveryReadiness", - "labelPolicy", - "maintainerCutReadiness", - "testCoverageHealth", - "queueHealth", - "contributorIntakeHealth", - "docsCompleteness", - "githubApp", - "blockers", - "warnings", - "dataQuality" - ] - }, - "GittensorConfigRecommendation": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "privateOnly": { - "type": "boolean" - }, - "current": { - "type": "object", - "nullable": true, - "additionalProperties": { - "nullable": true - } - }, - "recommended": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "tradeoffs": { - "type": "array", - "items": { - "type": "string" - } - }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "dataQuality": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "repoFullName", - "generatedAt", - "privateOnly", - "current", - "recommended", - "tradeoffs", - "reasons", - "warnings", - "dataQuality" - ] - }, - "RepoFitRecommendation": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "roleContext": { - "$ref": "#/components/schemas/RoleContext" - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] - }, - "confidence": { - "type": "string", - "enum": [ - "high", - "medium", - "low" - ] - }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } - }, - "risks": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - }, - "rewardRisk": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "reasoning": { - "type": "array", - "items": { - "type": "string" - } - }, - "actionImpact": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "login", - "repoFullName", - "generatedAt", - "roleContext", - "lane", - "recommendation", - "confidence", - "reasons", - "risks", - "nextActions" - ] - }, - "PreflightResult": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "ready", - "needs_work", - "hold" - ] - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "reviewBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "linkedIssues": { - "type": "array", - "items": { - "type": "number" - } - }, - "findings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } - }, - "collisions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CollisionCluster" - } - } - }, - "required": [ - "repoFullName", - "generatedAt", - "status", - "lane", - "reviewBurden", - "linkedIssues", - "findings", - "collisions" - ] - }, - "LocalDiffPreflightResult": { - "allOf": [ - { - "$ref": "#/components/schemas/PreflightResult" - }, - { + "preflight": { + "$ref": "#/components/schemas/LocalDiffPreflightResult" + }, + "scorePreview": { + "$ref": "#/components/schemas/ScorePreviewResult" + }, + "scenarioScorePreview": { "type": "object", "properties": { - "localDiff": { + "current": { "type": "object", "properties": { - "changedFileCount": { - "type": "number" - }, - "changedLineCount": { - "type": "number" - }, - "testFileCount": { - "type": "number" + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] }, - "codeFileCount": { - "type": "number" + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] }, - "inferredLinkedIssues": { + "assumptions": { "type": "array", "items": { - "type": "number" + "type": "string" } }, - "summary": { + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } + }, + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { "type": "string" } }, "required": [ - "changedFileCount", - "changedLineCount", - "testFileCount", - "codeFileCount", - "inferredLinkedIssues", - "summary" + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" ] - } - }, - "required": [ - "localDiff" - ] - } - ] - }, - "ScorePreviewResult": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "scoringModelSnapshotId": { - "type": "string" - }, - "activeModel": { - "type": "string", - "enum": [ - "current_density_model", - "pending_saturation_model", - "exponential_saturation_model", - "unknown" - ] - }, - "privateOnly": { - "type": "boolean", - "enum": [ - true - ] - }, - "laneMath": { - "type": "object", - "additionalProperties": { - "type": "number" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "branchEligibility": { - "type": "object", - "properties": { - "required": { - "type": "boolean" - }, - "status": { - "type": "string", - "enum": [ - "eligible", - "ineligible", - "unknown", - "not_required" - ] - }, - "evidence": { - "type": "string", - "enum": [ - "provided", - "missing" - ] - }, - "source": { - "type": "string", - "enum": [ - "github_metadata", - "local_metadata", - "registry", - "user_supplied", - "missing" - ] - }, - "reason": { - "type": "string" - }, - "checkedAt": { - "type": "string" - }, - "stale": { - "type": "boolean" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "required", - "status", - "evidence", - "source", - "stale", - "warnings" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "gateDeltas": { - "type": "array", - "items": { - "type": "object", - "properties": { - "gate": { - "type": "string", - "enum": [ - "open_pr_threshold", - "credibility_floor", - "linked_issue_multiplier" - ] - }, - "current": { - "type": "string" - }, - "projected": { - "type": "string" - }, - "explanation": { - "type": "string" - } - }, - "required": [ - "gate", - "current", - "projected", - "explanation" - ] - } - }, - "scenarioPreviews": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } - }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } - }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" - } - }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - } - }, - "scoreabilityStatus": { - "type": "string", - "enum": [ - "blocked", - "conditionally_scoreable", - "scoreable", - "hold" - ] - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommendation": { - "type": "object", - "properties": { - "level": { - "type": "string", - "enum": [ - "strong_fit", - "reasonable_fit", - "needs_work", - "hold" - ] - }, - "actions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "level", - "actions" - ] - } - }, - "required": [ - "repoFullName", - "generatedAt", - "scoringModelSnapshotId", - "activeModel", - "privateOnly", - "laneMath", - "scoreEstimate", - "linkedIssueMultiplier", - "gates", - "branchEligibility", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "gateDeltas", - "scenarioPreviews", - "scoreabilityStatus", - "warnings", - "assumptions", - "recommendation" - ] - }, - "RewardRiskAction": { - "type": "object", - "properties": { - "actionKind": { - "type": "string", - "enum": [ - "cleanup_existing_prs", - "land_existing_prs", - "close_or_withdraw_low_fit_prs", - "open_new_direct_pr", - "file_issue_discovery", - "maintainer_lane_improve_repo", - "maintainer_cut_readiness" - ] - }, - "repoFullName": { - "type": "string" - }, - "priorityScore": { - "type": "number" - }, - "laneValueScore": { - "type": "number" - }, - "scoreabilityScore": { - "type": "number" - }, - "personalFitScore": { - "type": "number" - }, - "riskPenalty": { - "type": "number" - }, - "maintainerFrictionPenalty": { - "type": "number" - }, - "actionLeverageScore": { - "type": "number" - }, - "whyThisHelps": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "actionKind", - "repoFullName", - "priorityScore", - "laneValueScore", - "scoreabilityScore", - "personalFitScore", - "riskPenalty", - "maintainerFrictionPenalty", - "actionLeverageScore", - "whyThisHelps", - "nextActions" - ] - }, - "RepoRewardRisk": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "roleContext": { - "$ref": "#/components/schemas/RoleContext" - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] - }, - "rewardUpside": { - "type": "object", - "properties": { - "relevantLane": { - "type": "string", - "enum": [ - "direct_pr", - "issue_discovery", - "maintainer_lane", - "none" - ] - }, - "repoSlice": { - "type": "number" - }, - "directPrSlice": { - "type": "number" - }, - "issueDiscoverySlice": { - "type": "number" - }, - "maintainerCutSlice": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "estimatedScoreIfClean": { - "type": "number" - }, - "currentEstimatedScore": { - "type": "number" - } - }, - "required": [ - "relevantLane", - "repoSlice", - "directPrSlice", - "issueDiscoverySlice", - "maintainerCutSlice", - "labelMultiplier", - "issueMultiplier", - "estimatedScoreIfClean", - "currentEstimatedScore" - ] - }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "riskBreakdown": { - "type": "object", - "properties": { - "queueBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "critical" - ] - }, - "queueBurdenScore": { - "type": "number" - }, - "duplicateClusters": { - "type": "number" - }, - "highRiskDuplicateClusters": { - "type": "number" - }, - "closedPullRequestRate": { - "type": "number" - }, - "openPullRequests": { - "type": "number" - }, - "credibility": { - "type": "number" - }, - "reviewChurnRisk": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - } - }, - "required": [ - "queueBurden", - "queueBurdenScore", - "duplicateClusters", - "highRiskDuplicateClusters", - "closedPullRequestRate", - "openPullRequests", - "credibility", - "reviewChurnRisk" - ] - }, - "actionImpact": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "currentPreview": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "afterCleanupPreview": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "actions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RewardRiskAction" - } - }, - "whyThisHelps": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextActions": { - "type": "array", - "items": { - "type": "string" - } - }, - "summary": { - "type": "string" - } - }, - "required": [ - "login", - "repoFullName", - "generatedAt", - "roleContext", - "lane", - "recommendation", - "rewardUpside", - "scoreBlockers", - "riskBreakdown", - "actionImpact", - "currentPreview", - "afterCleanupPreview", - "actions", - "whyThisHelps", - "nextActions", - "summary" - ] - }, - "LocalWorkspaceIntelligence": { - "type": "object", - "properties": { - "version": { - "type": "number", - "enum": [ - 2 - ] - }, - "sourceUpload": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean", - "enum": [ - false - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "enabled", - "detail" - ] - }, - "branch": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "baseRef": { - "type": "string" - }, - "headSha": { - "type": "string" - }, - "pendingCommitCount": { - "type": "number" - } - }, - "required": [ - "pendingCommitCount" - ] - }, - "changedFiles": { - "type": "object", - "properties": { - "total": { - "type": "number" - }, - "added": { - "type": "number" - }, - "modified": { - "type": "number" - }, - "deleted": { - "type": "number" - }, - "renamed": { - "type": "number" - }, - "binary": { - "type": "number" - }, - "paths": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "total", - "added", - "modified", - "deleted", - "renamed", - "binary", - "paths" - ] - }, - "testEvidence": { - "type": "object", - "properties": { - "level": { - "type": "string", - "enum": [ - "test_files", - "validation_commands", - "both", - "none" - ] - }, - "testFileCount": { - "type": "number" - }, - "passedValidationCount": { - "type": "number" }, - "commands": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { + "bestReasonableCase": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } }, - "status": { - "type": "string", - "enum": [ - "passed", - "failed", - "not_run" + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" ] - }, - "summary": { - "type": "string" } }, - "required": [ - "command", - "status" - ] - } - } - }, - "required": [ - "level", - "testFileCount", - "passedValidationCount", - "commands" - ] - }, - "linkedIssues": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseFreshness": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "fresh", - "stale", - "possibly_stale", - "unknown" - ] - }, - "baseRef": { - "type": "string" - }, - "baseSha": { - "type": "string" - }, - "headSha": { - "type": "string" - }, - "mergeBaseSha": { - "type": "string" - }, - "remoteTrackingSha": { - "type": "string" - }, - "changedFileCount": { - "type": "number" - }, - "testFileCount": { - "type": "number" - }, - "passedValidationCount": { - "type": "number" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommendation": { - "type": "string" - } - }, - "required": [ - "status", - "changedFileCount", - "testFileCount", - "passedValidationCount", - "warnings" - ] - }, - "ciStatusHints": { - "type": "array", - "items": { - "type": "string" - } - }, - "localScorerDiagnostics": { - "type": "object", - "properties": { - "mode": { - "type": "string" - }, - "activeModel": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "metadataOnly": { - "type": "boolean" - } - }, - "required": [ - "mode", - "warnings", - "metadataOnly" - ] - }, - "blockers": { - "type": "object", - "properties": { - "branchQuality": { - "type": "array", - "items": { - "type": "string" - } - }, - "accountState": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "branchQuality", - "accountState" - ] - }, - "rerunWhen": { - "type": "string" - } - }, - "required": [ - "version", - "sourceUpload", - "branch", - "changedFiles", - "testEvidence", - "linkedIssues", - "baseFreshness", - "ciStatusHints", - "blockers", - "rerunWhen" - ] - }, - "LocalBranchAnalysis": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "baseRef": { - "type": "string" - }, - "headRef": { - "type": "string" - }, - "branchName": { - "type": "string" - }, - "baseFreshness": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "fresh", - "stale", - "possibly_stale", - "unknown" + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "deltaExplanation": { + "type": "string" + } + }, + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" ] }, - "baseRef": { - "type": "string" - }, - "baseSha": { - "type": "string" - }, - "headSha": { - "type": "string" - }, - "mergeBaseSha": { - "type": "string" - }, - "remoteTrackingSha": { - "type": "string" - }, - "changedFileCount": { - "type": "number" - }, - "testFileCount": { - "type": "number" - }, - "passedValidationCount": { - "type": "number" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommendation": { - "type": "string" - } - }, - "required": [ - "status", - "changedFileCount", - "testFileCount", - "passedValidationCount", - "warnings" - ] - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "roleContext": { - "$ref": "#/components/schemas/RoleContext" - }, - "preflight": { - "$ref": "#/components/schemas/LocalDiffPreflightResult" - }, - "scorePreview": { - "$ref": "#/components/schemas/ScorePreviewResult" - }, - "scenarioScorePreview": { - "type": "object", - "properties": { - "current": { + "afterPendingMerges": { "type": "object", "properties": { "name": { @@ -4777,7 +4108,7 @@ "deltaExplanation" ] }, - "bestReasonableCase": { + "afterApprovedPrsMerge": { "type": "object", "properties": { "name": { @@ -5025,7 +4356,7 @@ "deltaExplanation" ] }, - "afterPendingMerges": { + "afterStalePrsClose": { "type": "object", "properties": { "name": { @@ -5273,796 +4604,1542 @@ "deltaExplanation" ] }, - "afterApprovedPrsMerge": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { + "gateDeltas": { + "type": "array", + "items": { + "type": "object", + "properties": { + "gate": { + "type": "string", + "enum": [ + "open_pr_threshold", + "credibility_floor", + "linked_issue_multiplier" + ] + }, + "current": { + "type": "string" + }, + "projected": { + "type": "string" + }, + "explanation": { + "type": "string" + } + }, + "required": [ + "gate", + "current", + "projected", + "explanation" + ] + } + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + } + }, + "required": [ + "current", + "bestReasonableCase", + "gateDeltas", + "blockedBy" + ] + }, + "observedPullRequestScenarios": { + "type": "object", + "properties": { + "approvedOrMergeable": { + "type": "number" + }, + "stale": { + "type": "number" + }, + "closed": { + "type": "number" + }, + "draft": { + "type": "number" + }, + "blocked": { + "type": "number" + }, + "maintainerLane": { + "type": "number" + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "approvedOrMergeable", + "stale", + "closed", + "draft", + "blocked", + "maintainerLane", + "notes" + ] + }, + "githubBranchStatus": { + "type": "object", + "properties": { + "source": { + "type": "string", + "enum": [ + "cached_github_data" + ] + }, + "status": { + "type": "string", + "enum": [ + "approved", + "failing_checks", + "needs_author", + "blocked", + "pending_review", + "no_pr", + "unknown" + ] + }, + "pullNumber": { + "type": "number" + }, + "title": { + "type": "string" + }, + "reviewDecision": { + "type": "string", + "nullable": true + }, + "mergeableState": { + "type": "string", + "nullable": true + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "source", + "status", + "notes" + ] + }, + "branchEligibility": { + "type": "object", + "properties": { + "required": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "eligible", + "ineligible", + "unknown", + "not_required" + ] + }, + "evidence": { + "type": "string", + "enum": [ + "provided", + "missing" + ] + }, + "source": { + "type": "string", + "enum": [ + "github_metadata", + "local_metadata", + "registry", + "user_supplied", + "missing" + ] + }, + "reason": { + "type": "string" + }, + "checkedAt": { + "type": "string" + }, + "stale": { + "type": "boolean" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "required", + "status", + "evidence", + "source", + "stale", + "warnings" + ] + }, + "rewardRisk": { + "$ref": "#/components/schemas/RepoRewardRisk" + }, + "scoreBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "branchQualityBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "accountStateBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "recommendedRerunCondition": { + "type": "string" + }, + "localFindings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + }, + "maintainerFit": { + "type": "object", + "properties": { + "recommendation": { + "type": "string", + "enum": [ + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", + "unknown" + ] + }, + "reviewBurden": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "role": { + "type": "string", + "enum": [ + "outside_contributor", + "repo_maintainer", + "org_member", + "collaborator", + "owner", + "unknown" + ] + }, + "maintainerLane": { + "type": "boolean" + }, + "reasons": { + "type": "array", + "items": { + "type": "string" + } + }, + "risks": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "recommendation", + "reviewBurden", + "role", + "maintainerLane", + "reasons", + "risks" + ] + }, + "manifestGuidance": { + "type": "object", + "properties": { + "present": { + "type": "boolean" + }, + "source": { + "type": "string", + "enum": [ + "repo_file", + "api_record", + "none" + ] + }, + "linkedIssuePolicy": { + "type": "string", + "enum": [ + "required", + "preferred", + "optional" + ] + }, + "issueDiscoveryPolicy": { + "type": "string", + "enum": [ + "encouraged", + "neutral", + "discouraged" + ] + }, + "matchedWantedPaths": { + "type": "array", + "items": { + "type": "string" + } + }, + "matchedBlockedPaths": { + "type": "array", + "items": { + "type": "string" + } + }, + "preferredLabelHits": { + "type": "array", + "items": { + "type": "string" + } + }, + "findings": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "severity": { + "type": "string", + "enum": [ + "info", + "warning", + "critical" + ] + }, + "title": { + "type": "string" + }, + "detail": { + "type": "string" + }, + "action": { "type": "string" } }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } + "required": [ + "code", + "severity", + "title", + "detail" + ] + } + }, + "publicNextSteps": { + "type": "array", + "items": { + "type": "string" + } + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "summary": { + "type": "string" + } + }, + "required": [ + "present", + "source", + "linkedIssuePolicy", + "issueDiscoveryPolicy", + "matchedWantedPaths", + "matchedBlockedPaths", + "preferredLabelHits", + "findings", + "publicNextSteps", + "warnings", + "summary" + ] + }, + "prPacket": { + "type": "object", + "properties": { + "titleSuggestion": { + "type": "string" + }, + "markdown": { + "type": "string" + }, + "bodySections": { + "type": "array", + "items": { + "type": "object", + "properties": { + "heading": { + "type": "string" }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" + "lines": { + "type": "array", + "items": { + "type": "string" } - }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] + } }, - "effectiveEstimatedScore": { + "required": [ + "heading", + "lines" + ] + } + }, + "reviewerNotes": { + "type": "array", + "items": { + "type": "string" + } + }, + "validationSummary": { + "type": "object", + "properties": { + "passed": { "type": "number" }, - "underlyingPotentialScore": { + "failed": { "type": "number" }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] - } + "notRun": { + "type": "number" }, - "linkedIssueMultiplier": { - "type": "object", - "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { - "type": "string", - "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { + "commands": { + "type": "array", + "items": { + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "passed", + "failed", + "not_run", + "skipped", + "focused", + "unknown" + ] + }, + "summary": { + "type": "string" + }, + "durationMs": { "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { + }, + "exitCode": { "type": "number" } }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "reason": { - "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { - "type": "string" + "required": [ + "command", + "status" + ] + } } }, "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" + "passed", + "failed", + "notRun", + "commands" + ] + }, + "publicSafeWarnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "titleSuggestion", + "markdown", + "bodySections", + "reviewerNotes", + "validationSummary", + "publicSafeWarnings" + ] + }, + "nextActions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RewardRiskAction" + } + }, + "workspaceIntelligence": { + "$ref": "#/components/schemas/LocalWorkspaceIntelligence" + }, + "summary": { + "type": "string" + } + }, + "required": [ + "login", + "repoFullName", + "generatedAt", + "baseFreshness", + "lane", + "roleContext", + "preflight", + "scorePreview", + "scenarioScorePreview", + "observedPullRequestScenarios", + "githubBranchStatus", + "branchEligibility", + "rewardRisk", + "scoreBlockers", + "branchQualityBlockers", + "accountStateBlockers", + "recommendedRerunCondition", + "localFindings", + "maintainerFit", + "manifestGuidance", + "prPacket", + "nextActions", + "workspaceIntelligence", + "summary" + ] + }, + "ScorePreviewResult": { + "type": "object", + "properties": { + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "scoringModelSnapshotId": { + "type": "string" + }, + "activeModel": { + "type": "string", + "enum": [ + "current_density_model", + "pending_saturation_model", + "exponential_saturation_model", + "unknown" + ] + }, + "privateOnly": { + "type": "boolean", + "enum": [ + true + ] + }, + "laneMath": { + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" + } + }, + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "linkedIssueMultiplier": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "none", + "standard", + "maintainer" + ] + }, + "status": { + "type": "string", + "enum": [ + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" + ] + }, + "source": { + "type": "string", + "enum": [ + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" + ] + }, + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" + }, + "openPrThreshold": { + "type": "number" + }, + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" + } + }, + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "branchEligibility": { + "type": "object", + "properties": { + "required": { + "type": "boolean" + }, + "status": { + "type": "string", + "enum": [ + "eligible", + "ineligible", + "unknown", + "not_required" ] }, - "afterStalePrsClose": { - "type": "object", - "properties": { - "name": { - "type": "string", - "enum": [ - "current", - "cleanGates", - "afterPendingMerges", - "afterApprovedPrsMerge", - "afterStalePrsClose", - "linkedIssueFixed", - "bestReasonableCase" - ] - }, - "source": { - "type": "string", - "enum": [ - "current_data", - "user_supplied", - "github_observed", - "gittensory_projection" - ] - }, - "assumptions": { - "type": "array", - "items": { - "type": "string" + "evidence": { + "type": "string", + "enum": [ + "provided", + "missing" + ] + }, + "source": { + "type": "string", + "enum": [ + "github_metadata", + "local_metadata", + "registry", + "user_supplied", + "missing" + ] + }, + "reason": { + "type": "string" + }, + "checkedAt": { + "type": "string" + }, + "stale": { + "type": "boolean" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "required", + "status", + "evidence", + "source", + "stale", + "warnings" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "enum": [ + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] + }, + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "code", + "severity", + "detail" + ] + } + }, + "gateDeltas": { + "type": "array", + "items": { + "type": "object", + "properties": { + "gate": { + "type": "string", + "enum": [ + "open_pr_threshold", + "credibility_floor", + "linked_issue_multiplier" + ] + }, + "current": { + "type": "string" + }, + "projected": { + "type": "string" + }, + "explanation": { + "type": "string" + } + }, + "required": [ + "gate", + "current", + "projected", + "explanation" + ] + } + }, + "scenarioPreviews": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "enum": [ + "current", + "cleanGates", + "afterPendingMerges", + "afterApprovedPrsMerge", + "afterStalePrsClose", + "linkedIssueFixed", + "bestReasonableCase" + ] + }, + "source": { + "type": "string", + "enum": [ + "current_data", + "user_supplied", + "github_observed", + "gittensory_projection" + ] + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "scoreEstimate": { + "type": "object", + "properties": { + "baseScore": { + "type": "number" + }, + "densityMultiplier": { + "type": "number" + }, + "contributionBonus": { + "type": "number" + }, + "labelMultiplier": { + "type": "number" + }, + "issueMultiplier": { + "type": "number" + }, + "credibilityMultiplier": { + "type": "number" + }, + "reviewPenaltyMultiplier": { + "type": "number" + }, + "openPrMultiplier": { + "type": "number" + }, + "estimatedMergedScore": { + "type": "number" + }, + "pendingSaturationScore": { + "type": "number" } }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" - }, - "densityMultiplier": { - "type": "number" - }, - "contributionBonus": { - "type": "number" - }, - "labelMultiplier": { - "type": "number" - }, - "issueMultiplier": { - "type": "number" - }, - "credibilityMultiplier": { - "type": "number" - }, - "reviewPenaltyMultiplier": { - "type": "number" - }, - "openPrMultiplier": { - "type": "number" - }, - "estimatedMergedScore": { - "type": "number" - }, - "pendingSaturationScore": { - "type": "number" - } + "required": [ + "baseScore", + "densityMultiplier", + "contributionBonus", + "labelMultiplier", + "issueMultiplier", + "credibilityMultiplier", + "reviewPenaltyMultiplier", + "openPrMultiplier", + "estimatedMergedScore", + "pendingSaturationScore" + ] + }, + "gates": { + "type": "object", + "properties": { + "baseTokenGatePassed": { + "type": "boolean" }, - "required": [ - "baseScore", - "densityMultiplier", - "contributionBonus", - "labelMultiplier", - "issueMultiplier", - "credibilityMultiplier", - "reviewPenaltyMultiplier", - "openPrMultiplier", - "estimatedMergedScore", - "pendingSaturationScore" - ] - }, - "gates": { - "type": "object", - "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" - }, - "credibilityObserved": { - "type": "number" - } + "openPrThreshold": { + "type": "number" }, - "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" - ] - }, - "effectiveEstimatedScore": { - "type": "number" - }, - "underlyingPotentialScore": { - "type": "number" - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" - ] - }, - "severity": { - "type": "string", - "enum": [ - "blocker", - "reducer", - "context" - ] - }, - "detail": { - "type": "string" - } - }, - "required": [ - "code", - "severity", - "detail" - ] + "openPrCount": { + "type": "number" + }, + "collateralFraction": { + "type": "number" + }, + "credibilityFloor": { + "type": "number" + }, + "credibilityObserved": { + "type": "number" } }, - "linkedIssueMultiplier": { + "required": [ + "baseTokenGatePassed", + "openPrThreshold", + "openPrCount", + "collateralFraction", + "credibilityFloor", + "credibilityObserved" + ] + }, + "effectiveEstimatedScore": { + "type": "number" + }, + "underlyingPotentialScore": { + "type": "number" + }, + "blockedBy": { + "type": "array", + "items": { "type": "object", "properties": { - "mode": { - "type": "string", - "enum": [ - "none", - "standard", - "maintainer" - ] - }, - "status": { - "type": "string", - "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" - ] - }, - "source": { + "code": { "type": "string", "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" - ] - }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" + "repo_not_registered", + "inactive_allocation", + "base_token_gate", + "open_pr_threshold", + "credibility_floor", + "review_penalty", + "metadata_only", + "linked_issue_invalid", + "linked_issue_unvalidated", + "branch_ineligible", + "branch_eligibility_missing" + ] }, - "appliedMultiplier": { - "type": "number" + "severity": { + "type": "string", + "enum": [ + "blocker", + "reducer", + "context" + ] }, - "reason": { + "detail": { "type": "string" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } } }, "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" + "code", + "severity", + "detail" ] - }, - "deltaExplanation": { - "type": "string" } }, - "required": [ - "name", - "source", - "assumptions", - "scoreEstimate", - "gates", - "effectiveEstimatedScore", - "underlyingPotentialScore", - "blockedBy", - "linkedIssueMultiplier", - "deltaExplanation" - ] - }, - "gateDeltas": { - "type": "array", - "items": { + "linkedIssueMultiplier": { "type": "object", "properties": { - "gate": { + "mode": { "type": "string", "enum": [ - "open_pr_threshold", - "credibility_floor", - "linked_issue_multiplier" + "none", + "standard", + "maintainer" ] }, - "current": { - "type": "string" - }, - "projected": { - "type": "string" - }, - "explanation": { - "type": "string" - } - }, - "required": [ - "gate", - "current", - "projected", - "explanation" - ] - } - }, - "blockedBy": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { + "status": { "type": "string", "enum": [ - "repo_not_registered", - "inactive_allocation", - "base_token_gate", - "open_pr_threshold", - "credibility_floor", - "review_penalty", - "metadata_only", - "linked_issue_invalid", - "linked_issue_unvalidated", - "branch_ineligible", - "branch_eligibility_missing" + "not_required", + "raw", + "plausible", + "validated", + "invalid", + "unavailable" ] }, - "severity": { + "source": { "type": "string", "enum": [ - "blocker", - "reducer", - "context" + "none", + "user_supplied", + "official_mirror", + "github_cache", + "issue_quality", + "missing" ] }, - "detail": { + "eligible": { + "type": "boolean" + }, + "issueNumbers": { + "type": "array", + "items": { + "type": "number" + } + }, + "solvedByPullRequests": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseMultiplier": { + "type": "number" + }, + "appliedMultiplier": { + "type": "number" + }, + "reason": { "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "code", - "severity", - "detail" + "mode", + "status", + "source", + "eligible", + "issueNumbers", + "solvedByPullRequests", + "baseMultiplier", + "appliedMultiplier", + "reason", + "warnings" ] + }, + "deltaExplanation": { + "type": "string" + } + }, + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + } + }, + "scoreabilityStatus": { + "type": "string", + "enum": [ + "blocked", + "conditionally_scoreable", + "scoreable", + "hold" + ] + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "assumptions": { + "type": "array", + "items": { + "type": "string" + } + }, + "recommendation": { + "type": "object", + "properties": { + "level": { + "type": "string", + "enum": [ + "strong_fit", + "reasonable_fit", + "needs_work", + "hold" + ] + }, + "actions": { + "type": "array", + "items": { + "type": "string" } } }, "required": [ - "current", - "bestReasonableCase", - "gateDeltas", - "blockedBy" + "level", + "actions" + ] + } + }, + "required": [ + "repoFullName", + "generatedAt", + "scoringModelSnapshotId", + "activeModel", + "privateOnly", + "laneMath", + "scoreEstimate", + "linkedIssueMultiplier", + "gates", + "branchEligibility", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "gateDeltas", + "scenarioPreviews", + "scoreabilityStatus", + "warnings", + "assumptions", + "recommendation" + ] + }, + "RepoRewardRisk": { + "type": "object", + "properties": { + "login": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "roleContext": { + "$ref": "#/components/schemas/RoleContext" + }, + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "recommendation": { + "type": "string", + "enum": [ + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", + "unknown" ] }, - "observedPullRequestScenarios": { + "rewardUpside": { "type": "object", "properties": { - "approvedOrMergeable": { + "relevantLane": { + "type": "string", + "enum": [ + "direct_pr", + "issue_discovery", + "maintainer_lane", + "none" + ] + }, + "repoSlice": { "type": "number" }, - "stale": { + "directPrSlice": { "type": "number" }, - "closed": { + "issueDiscoverySlice": { "type": "number" }, - "draft": { + "maintainerCutSlice": { "type": "number" }, - "blocked": { + "labelMultiplier": { "type": "number" }, - "maintainerLane": { + "issueMultiplier": { "type": "number" }, - "notes": { - "type": "array", - "items": { - "type": "string" - } + "estimatedScoreIfClean": { + "type": "number" + }, + "currentEstimatedScore": { + "type": "number" } }, "required": [ - "approvedOrMergeable", - "stale", - "closed", - "draft", - "blocked", - "maintainerLane", - "notes" + "relevantLane", + "repoSlice", + "directPrSlice", + "issueDiscoverySlice", + "maintainerCutSlice", + "labelMultiplier", + "issueMultiplier", + "estimatedScoreIfClean", + "currentEstimatedScore" ] }, - "githubBranchStatus": { + "scoreBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "riskBreakdown": { "type": "object", "properties": { - "source": { + "queueBurden": { "type": "string", "enum": [ - "cached_github_data" + "low", + "medium", + "high", + "critical" ] }, - "status": { + "queueBurdenScore": { + "type": "number" + }, + "duplicateClusters": { + "type": "number" + }, + "highRiskDuplicateClusters": { + "type": "number" + }, + "closedPullRequestRate": { + "type": "number" + }, + "openPullRequests": { + "type": "number" + }, + "credibility": { + "type": "number" + }, + "reviewChurnRisk": { "type": "string", "enum": [ - "approved", - "failing_checks", - "needs_author", - "blocked", - "pending_review", - "no_pr", - "unknown" + "low", + "medium", + "high" + ] + } + }, + "required": [ + "queueBurden", + "queueBurdenScore", + "duplicateClusters", + "highRiskDuplicateClusters", + "closedPullRequestRate", + "openPullRequests", + "credibility", + "reviewChurnRisk" + ] + }, + "actionImpact": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "currentPreview": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "afterCleanupPreview": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RewardRiskAction" + } + }, + "whyThisHelps": { + "type": "array", + "items": { + "type": "string" + } + }, + "nextActions": { + "type": "array", + "items": { + "type": "string" + } + }, + "summary": { + "type": "string" + } + }, + "required": [ + "login", + "repoFullName", + "generatedAt", + "roleContext", + "lane", + "recommendation", + "rewardUpside", + "scoreBlockers", + "riskBreakdown", + "actionImpact", + "currentPreview", + "afterCleanupPreview", + "actions", + "whyThisHelps", + "nextActions", + "summary" + ] + }, + "RewardRiskAction": { + "type": "object", + "properties": { + "actionKind": { + "type": "string", + "enum": [ + "cleanup_existing_prs", + "land_existing_prs", + "close_or_withdraw_low_fit_prs", + "open_new_direct_pr", + "file_issue_discovery", + "maintainer_lane_improve_repo", + "maintainer_cut_readiness" + ] + }, + "repoFullName": { + "type": "string" + }, + "priorityScore": { + "type": "number" + }, + "laneValueScore": { + "type": "number" + }, + "scoreabilityScore": { + "type": "number" + }, + "personalFitScore": { + "type": "number" + }, + "riskPenalty": { + "type": "number" + }, + "maintainerFrictionPenalty": { + "type": "number" + }, + "actionLeverageScore": { + "type": "number" + }, + "whyThisHelps": { + "type": "array", + "items": { + "type": "string" + } + }, + "nextActions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "actionKind", + "repoFullName", + "priorityScore", + "laneValueScore", + "scoreabilityScore", + "personalFitScore", + "riskPenalty", + "maintainerFrictionPenalty", + "actionLeverageScore", + "whyThisHelps", + "nextActions" + ] + }, + "LocalWorkspaceIntelligence": { + "type": "object", + "properties": { + "version": { + "type": "number", + "enum": [ + 2 + ] + }, + "sourceUpload": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "enum": [ + false ] }, - "pullNumber": { - "type": "number" - }, - "title": { + "detail": { "type": "string" - }, - "reviewDecision": { - "type": "string", - "nullable": true - }, - "mergeableState": { - "type": "string", - "nullable": true - }, - "notes": { - "type": "array", - "items": { - "type": "string" - } } }, "required": [ - "source", - "status", - "notes" + "enabled", + "detail" ] }, - "branchEligibility": { + "branch": { "type": "object", "properties": { - "required": { - "type": "boolean" - }, - "status": { - "type": "string", - "enum": [ - "eligible", - "ineligible", - "unknown", - "not_required" - ] - }, - "evidence": { - "type": "string", - "enum": [ - "provided", - "missing" - ] - }, - "source": { - "type": "string", - "enum": [ - "github_metadata", - "local_metadata", - "registry", - "user_supplied", - "missing" - ] - }, - "reason": { + "name": { "type": "string" }, - "checkedAt": { + "baseRef": { "type": "string" }, - "stale": { - "type": "boolean" + "headSha": { + "type": "string" }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } + "pendingCommitCount": { + "type": "number" } }, "required": [ - "required", - "status", - "evidence", - "source", - "stale", - "warnings" + "pendingCommitCount" ] }, - "rewardRisk": { - "$ref": "#/components/schemas/RepoRewardRisk" - }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "branchQualityBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "accountStateBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "recommendedRerunCondition": { - "type": "string" - }, - "localFindings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } - }, - "maintainerFit": { + "changedFiles": { "type": "object", "properties": { - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] + "total": { + "type": "number" }, - "reviewBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "added": { + "type": "number" }, - "role": { - "type": "string", - "enum": [ - "outside_contributor", - "repo_maintainer", - "org_member", - "collaborator", - "owner", - "unknown" - ] + "modified": { + "type": "number" }, - "maintainerLane": { - "type": "boolean" + "deleted": { + "type": "number" }, - "reasons": { - "type": "array", - "items": { - "type": "string" - } + "renamed": { + "type": "number" }, - "risks": { + "binary": { + "type": "number" + }, + "paths": { "type": "array", "items": { "type": "string" @@ -6070,101 +6147,108 @@ } }, "required": [ - "recommendation", - "reviewBurden", - "role", - "maintainerLane", - "reasons", - "risks" + "total", + "added", + "modified", + "deleted", + "renamed", + "binary", + "paths" ] }, - "manifestGuidance": { + "testEvidence": { "type": "object", "properties": { - "present": { - "type": "boolean" - }, - "source": { + "level": { "type": "string", "enum": [ - "repo_file", - "api_record", + "test_files", + "validation_commands", + "both", "none" ] }, - "linkedIssuePolicy": { - "type": "string", - "enum": [ - "required", - "preferred", - "optional" - ] - }, - "issueDiscoveryPolicy": { - "type": "string", - "enum": [ - "encouraged", - "neutral", - "discouraged" - ] - }, - "matchedWantedPaths": { - "type": "array", - "items": { - "type": "string" - } - }, - "matchedBlockedPaths": { - "type": "array", - "items": { - "type": "string" - } + "testFileCount": { + "type": "number" }, - "preferredLabelHits": { - "type": "array", - "items": { - "type": "string" - } + "passedValidationCount": { + "type": "number" }, - "findings": { + "commands": { "type": "array", "items": { "type": "object", "properties": { - "code": { + "command": { "type": "string" }, - "severity": { + "status": { "type": "string", "enum": [ - "info", - "warning", - "critical" + "passed", + "failed", + "not_run" ] }, - "title": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "action": { + "summary": { "type": "string" } }, "required": [ - "code", - "severity", - "title", - "detail" + "command", + "status" ] } + } + }, + "required": [ + "level", + "testFileCount", + "passedValidationCount", + "commands" + ] + }, + "linkedIssues": { + "type": "array", + "items": { + "type": "number" + } + }, + "baseFreshness": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "fresh", + "stale", + "possibly_stale", + "unknown" + ] }, - "publicNextSteps": { - "type": "array", - "items": { - "type": "string" - } + "baseRef": { + "type": "string" + }, + "baseSha": { + "type": "string" + }, + "headSha": { + "type": "string" + }, + "mergeBaseSha": { + "type": "string" + }, + "remoteTrackingSha": { + "type": "string" + }, + "changedFileCount": { + "type": "number" + }, + "testFileCount": { + "type": "number" + }, + "passedValidationCount": { + "type": "number" }, "warnings": { "type": "array", @@ -6172,116 +6256,59 @@ "type": "string" } }, - "summary": { + "recommendation": { "type": "string" } }, "required": [ - "present", - "source", - "linkedIssuePolicy", - "issueDiscoveryPolicy", - "matchedWantedPaths", - "matchedBlockedPaths", - "preferredLabelHits", - "findings", - "publicNextSteps", - "warnings", - "summary" + "status", + "changedFileCount", + "testFileCount", + "passedValidationCount", + "warnings" ] }, - "prPacket": { + "ciStatusHints": { + "type": "array", + "items": { + "type": "string" + } + }, + "localScorerDiagnostics": { "type": "object", "properties": { - "titleSuggestion": { + "mode": { "type": "string" }, - "markdown": { + "activeModel": { "type": "string" }, - "bodySections": { + "warnings": { "type": "array", "items": { - "type": "object", - "properties": { - "heading": { - "type": "string" - }, - "lines": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "heading", - "lines" - ] + "type": "string" } }, - "reviewerNotes": { + "metadataOnly": { + "type": "boolean" + } + }, + "required": [ + "mode", + "warnings", + "metadataOnly" + ] + }, + "blockers": { + "type": "object", + "properties": { + "branchQuality": { "type": "array", "items": { "type": "string" } }, - "validationSummary": { - "type": "object", - "properties": { - "passed": { - "type": "number" - }, - "failed": { - "type": "number" - }, - "notRun": { - "type": "number" - }, - "commands": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "passed", - "failed", - "not_run", - "skipped", - "focused", - "unknown" - ] - }, - "summary": { - "type": "string" - }, - "durationMs": { - "type": "number" - }, - "exitCode": { - "type": "number" - } - }, - "required": [ - "command", - "status" - ] - } - } - }, - "required": [ - "passed", - "failed", - "notRun", - "commands" - ] - }, - "publicSafeWarnings": { + "accountState": { "type": "array", "items": { "type": "string" @@ -6289,52 +6316,25 @@ } }, "required": [ - "titleSuggestion", - "markdown", - "bodySections", - "reviewerNotes", - "validationSummary", - "publicSafeWarnings" + "branchQuality", + "accountState" ] }, - "nextActions": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RewardRiskAction" - } - }, - "workspaceIntelligence": { - "$ref": "#/components/schemas/LocalWorkspaceIntelligence" - }, - "summary": { + "rerunWhen": { "type": "string" } }, "required": [ - "login", - "repoFullName", - "generatedAt", + "version", + "sourceUpload", + "branch", + "changedFiles", + "testEvidence", + "linkedIssues", "baseFreshness", - "lane", - "roleContext", - "preflight", - "scorePreview", - "scenarioScorePreview", - "observedPullRequestScenarios", - "githubBranchStatus", - "branchEligibility", - "rewardRisk", - "scoreBlockers", - "branchQualityBlockers", - "accountStateBlockers", - "recommendedRerunCondition", - "localFindings", - "maintainerFit", - "manifestGuidance", - "prPacket", - "nextActions", - "workspaceIntelligence", - "summary" + "ciStatusHints", + "blockers", + "rerunWhen" ] }, "MaintainerPacket": { @@ -6393,21 +6393,71 @@ ] } }, - "suggestedActions": { + "suggestedActions": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "repoFullName", + "generatedAt", + "queueHealth", + "configQuality", + "collisions", + "pullRequestPackets", + "suggestedActions" + ] + }, + "MaintainerLaneReport": { + "type": "object", + "properties": { + "repoFullName": { + "type": "string" + }, + "generatedAt": { + "type": "string" + }, + "lane": { + "$ref": "#/components/schemas/LaneAdvice" + }, + "maintainerCut": { + "type": "number" + }, + "maintainerCutConfigured": { + "type": "boolean" + }, + "queueHealth": { + "$ref": "#/components/schemas/QueueHealth" + }, + "configQuality": { + "$ref": "#/components/schemas/ConfigQuality" + }, + "contributorIntakeHealth": { + "$ref": "#/components/schemas/ContributorIntakeHealth" + }, + "summary": { + "type": "string" + }, + "findings": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/Finding" } } }, "required": [ "repoFullName", "generatedAt", + "lane", + "maintainerCut", + "maintainerCutConfigured", "queueHealth", "configQuality", - "collisions", - "pullRequestPackets", - "suggestedActions" + "contributorIntakeHealth", + "summary", + "findings" ] }, "ContributorIntakeHealth": { @@ -6475,56 +6525,6 @@ "findings" ] }, - "MaintainerLaneReport": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "generatedAt": { - "type": "string" - }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" - }, - "maintainerCut": { - "type": "number" - }, - "maintainerCutConfigured": { - "type": "boolean" - }, - "queueHealth": { - "$ref": "#/components/schemas/QueueHealth" - }, - "configQuality": { - "$ref": "#/components/schemas/ConfigQuality" - }, - "contributorIntakeHealth": { - "$ref": "#/components/schemas/ContributorIntakeHealth" - }, - "summary": { - "type": "string" - }, - "findings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Finding" - } - } - }, - "required": [ - "repoFullName", - "generatedAt", - "lane", - "maintainerCut", - "maintainerCutConfigured", - "queueHealth", - "configQuality", - "contributorIntakeHealth", - "summary", - "findings" - ] - }, "MaintainerCutReadiness": { "type": "object", "properties": { @@ -7240,7 +7240,8 @@ "bot_author", "maintainer_author", "miner_detection_unavailable", - "not_official_gittensor_miner" + "not_official_gittensor_miner", + null ] }, "actions": { @@ -8295,46 +8296,234 @@ ] } }, - "eventRemediation": { + "eventRemediation": { + "type": "array", + "items": { + "type": "object", + "properties": { + "event": { + "type": "string" + }, + "ok": { + "type": "boolean" + }, + "action": { + "type": "string" + } + }, + "required": [ + "event", + "ok", + "action" + ] + } + }, + "repairSteps": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "installationId", + "accountLogin", + "installedReposCount", + "registeredInstalledCount", + "status", + "missingPermissions", + "missingEvents", + "permissions", + "events", + "checkedAt" + ] + }, + "SyncStatus": { + "type": "object", + "properties": { + "generatedAt": { + "type": "string" + }, + "signalFidelity": { + "$ref": "#/components/schemas/SignalFidelity" + }, + "freshnessSlo": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "fresh", + "degraded", + "blocked" + ] + }, + "generatedAt": { + "type": "string" + }, + "staleCount": { + "type": "number" + }, + "degradedCount": { + "type": "number" + }, + "blockedCount": { + "type": "number" + }, + "missingCount": { + "type": "number" + }, + "launchBlockingCount": { + "type": "number" + }, + "repairRecommended": { + "type": "boolean" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "area": { + "type": "string" + }, + "targetKey": { + "type": "string" + }, + "status": { + "type": "string" + }, + "launchBlocking": { + "type": "boolean" + }, + "ageSeconds": { + "type": "number" + }, + "sloSeconds": { + "type": "number" + }, + "breachSeconds": { + "type": "number" + }, + "observedAt": { + "type": "string", + "nullable": true + }, + "summary": { + "type": "string" + } + }, + "required": [ + "area", + "targetKey", + "status", + "launchBlocking", + "sloSeconds", + "summary" + ] + } + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "status", + "generatedAt", + "staleCount", + "degradedCount", + "blockedCount", + "missingCount", + "launchBlockingCount", + "repairRecommended", + "items", + "warnings" + ] + }, + "coreSignalFidelity": { + "$ref": "#/components/schemas/CoreSignalFidelity" + }, + "upstreamDrift": { + "$ref": "#/components/schemas/UpstreamStatus" + }, + "historyCoverage": { + "type": "string", + "enum": [ + "sampled", + "counts_only", + "full" + ] + }, + "refreshingRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "waitingForRateLimitRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "repositories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoSyncState" + } + }, + "segments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoSyncSegment" + } + }, + "githubTotals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RepoGithubTotalsSnapshot" + } + }, + "pullRequestDetailSync": { "type": "array", "items": { "type": "object", - "properties": { - "event": { - "type": "string" - }, - "ok": { - "type": "boolean" - }, - "action": { - "type": "string" - } - }, - "required": [ - "event", - "ok", - "action" - ] + "additionalProperties": { + "nullable": true + } } }, - "repairSteps": { + "installations": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/InstallationHealth" + } + }, + "rateLimits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GitHubRateLimitObservation" } } }, "required": [ - "installationId", - "accountLogin", - "installedReposCount", - "registeredInstalledCount", - "status", - "missingPermissions", - "missingEvents", - "permissions", - "events", - "checkedAt" + "generatedAt", + "signalFidelity", + "freshnessSlo", + "coreSignalFidelity", + "upstreamDrift", + "historyCoverage", + "refreshingRepos", + "waitingForRateLimitRepos", + "repositories", + "segments", + "githubTotals", + "pullRequestDetailSync", + "installations", + "rateLimits" ] }, "CoreSignalFidelity": { @@ -8400,6 +8589,91 @@ "historyCoverage" ] }, + "UpstreamStatus": { + "type": "object", + "properties": { + "generatedAt": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "current", + "drift_detected", + "stale", + "unavailable" + ] + }, + "latestCommitSha": { + "type": "string", + "nullable": true + }, + "latestRulesetId": { + "type": "string", + "nullable": true + }, + "latestRulesetGeneratedAt": { + "type": "string", + "nullable": true + }, + "activeModel": { + "type": "string", + "nullable": true, + "enum": [ + "current_density_model", + "pending_saturation_model", + "exponential_saturation_model", + "unknown", + null + ] + }, + "highestSeverity": { + "type": "string", + "nullable": true, + "enum": [ + "low", + "medium", + "high", + "blocking", + null + ] + }, + "affectedAreas": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "registry", + "scoring_model", + "issue_discovery", + "mirror_linkage", + "language_weights", + "source" + ] + } + }, + "registryHyperparameterDrift": { + "$ref": "#/components/schemas/RegistryHyperparameterDriftSummary" + }, + "openReportCount": { + "type": "number" + }, + "reports": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpstreamDriftReport" + } + } + }, + "required": [ + "generatedAt", + "status", + "affectedAreas", + "registryHyperparameterDrift", + "openReportCount", + "reports" + ] + }, "RegistryHyperparameterDriftSummary": { "type": "object", "properties": { @@ -8462,124 +8736,11 @@ "id": { "type": "string" }, - "fingerprint": { - "type": "string" - }, - "severity": { - "type": "string", - "enum": [ - "low", - "medium", - "high", - "blocking" - ] - }, - "status": { - "type": "string", - "enum": [ - "open", - "acknowledged", - "resolved", - "ignored" - ] - }, - "summary": { - "type": "string" - }, - "affectedAreas": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "registry", - "scoring_model", - "issue_discovery", - "mirror_linkage", - "language_weights", - "source" - ] - } - }, - "previousRulesetId": { - "type": "string", - "nullable": true - }, - "currentRulesetId": { - "type": "string", - "nullable": true - }, - "issueNumber": { - "type": "number", - "nullable": true - }, - "issueUrl": { - "type": "string", - "nullable": true - }, - "payload": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "generatedAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - }, - "required": [ - "id", - "fingerprint", - "severity", - "status", - "summary", - "affectedAreas", - "generatedAt", - "updatedAt" - ] - }, - "UpstreamStatus": { - "type": "object", - "properties": { - "generatedAt": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "current", - "drift_detected", - "stale", - "unavailable" - ] - }, - "latestCommitSha": { - "type": "string", - "nullable": true - }, - "latestRulesetId": { - "type": "string", - "nullable": true - }, - "latestRulesetGeneratedAt": { - "type": "string", - "nullable": true - }, - "activeModel": { - "type": "string", - "nullable": true, - "enum": [ - "current_density_model", - "pending_saturation_model", - "exponential_saturation_model", - "unknown" - ] + "fingerprint": { + "type": "string" }, - "highestSeverity": { + "severity": { "type": "string", - "nullable": true, "enum": [ "low", "medium", @@ -8587,6 +8748,18 @@ "blocking" ] }, + "status": { + "type": "string", + "enum": [ + "open", + "acknowledged", + "resolved", + "ignored" + ] + }, + "summary": { + "type": "string" + }, "affectedAreas": { "type": "array", "items": { @@ -8601,26 +8774,44 @@ ] } }, - "registryHyperparameterDrift": { - "$ref": "#/components/schemas/RegistryHyperparameterDriftSummary" + "previousRulesetId": { + "type": "string", + "nullable": true }, - "openReportCount": { - "type": "number" + "currentRulesetId": { + "type": "string", + "nullable": true }, - "reports": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UpstreamDriftReport" + "issueNumber": { + "type": "number", + "nullable": true + }, + "issueUrl": { + "type": "string", + "nullable": true + }, + "payload": { + "type": "object", + "additionalProperties": { + "nullable": true } + }, + "generatedAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" } }, "required": [ - "generatedAt", + "id", + "fingerprint", + "severity", "status", + "summary", "affectedAreas", - "registryHyperparameterDrift", - "openReportCount", - "reports" + "generatedAt", + "updatedAt" ] }, "RepoGithubTotalsSnapshot": { @@ -8685,194 +8876,6 @@ "fetchedAt" ] }, - "SyncStatus": { - "type": "object", - "properties": { - "generatedAt": { - "type": "string" - }, - "signalFidelity": { - "$ref": "#/components/schemas/SignalFidelity" - }, - "freshnessSlo": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "fresh", - "degraded", - "blocked" - ] - }, - "generatedAt": { - "type": "string" - }, - "staleCount": { - "type": "number" - }, - "degradedCount": { - "type": "number" - }, - "blockedCount": { - "type": "number" - }, - "missingCount": { - "type": "number" - }, - "launchBlockingCount": { - "type": "number" - }, - "repairRecommended": { - "type": "boolean" - }, - "items": { - "type": "array", - "items": { - "type": "object", - "properties": { - "area": { - "type": "string" - }, - "targetKey": { - "type": "string" - }, - "status": { - "type": "string" - }, - "launchBlocking": { - "type": "boolean" - }, - "ageSeconds": { - "type": "number" - }, - "sloSeconds": { - "type": "number" - }, - "breachSeconds": { - "type": "number" - }, - "observedAt": { - "type": "string", - "nullable": true - }, - "summary": { - "type": "string" - } - }, - "required": [ - "area", - "targetKey", - "status", - "launchBlocking", - "sloSeconds", - "summary" - ] - } - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "status", - "generatedAt", - "staleCount", - "degradedCount", - "blockedCount", - "missingCount", - "launchBlockingCount", - "repairRecommended", - "items", - "warnings" - ] - }, - "coreSignalFidelity": { - "$ref": "#/components/schemas/CoreSignalFidelity" - }, - "upstreamDrift": { - "$ref": "#/components/schemas/UpstreamStatus" - }, - "historyCoverage": { - "type": "string", - "enum": [ - "sampled", - "counts_only", - "full" - ] - }, - "refreshingRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "waitingForRateLimitRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "repositories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncState" - } - }, - "segments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncSegment" - } - }, - "githubTotals": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoGithubTotalsSnapshot" - } - }, - "pullRequestDetailSync": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "installations": { - "type": "array", - "items": { - "$ref": "#/components/schemas/InstallationHealth" - } - }, - "rateLimits": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GitHubRateLimitObservation" - } - } - }, - "required": [ - "generatedAt", - "signalFidelity", - "freshnessSlo", - "coreSignalFidelity", - "upstreamDrift", - "historyCoverage", - "refreshingRepos", - "waitingForRateLimitRepos", - "repositories", - "segments", - "githubTotals", - "pullRequestDetailSync", - "installations", - "rateLimits" - ] - }, "Readiness": { "type": "object", "properties": {