From 3af11cf8e6f56ce57e163e79cd07befbea0a76f8 Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:19:23 +0200 Subject: [PATCH 1/3] feat(github-app): add installation repair --- apps/gittensory-ui/public/openapi.json | 8195 ++++++++++++------------ src/api/routes.ts | 21 + src/github/backfill.ts | 141 + src/openapi/schemas.ts | 37 + src/openapi/spec.ts | 18 + test/integration/api.test.ts | 123 + test/integration/routes-errors.test.ts | 4 + test/unit/backfill.test.ts | 37 + test/unit/openapi.test.ts | 3 + 9 files changed, 4621 insertions(+), 3958 deletions(-) diff --git a/apps/gittensory-ui/public/openapi.json b/apps/gittensory-ui/public/openapi.json index f2750e4c5b..ae7a29247f 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" @@ -5148,998 +4157,1912 @@ "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", + "generatedAt", + "roleContext", + "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": { + "mode": { + "type": "string" + }, + "activeModel": { + "type": "string" + }, + "warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "metadataOnly": { + "type": "boolean" + } + }, + "required": [ + "mode", + "warnings", + "metadataOnly" + ] + }, + "blockers": { "type": "object", "properties": { - "baseTokenGatePassed": { - "type": "boolean" - }, - "openPrThreshold": { - "type": "number" - }, - "openPrCount": { - "type": "number" - }, - "collateralFraction": { - "type": "number" - }, - "credibilityFloor": { - "type": "number" + "branchQuality": { + "type": "array", + "items": { + "type": "string" + } }, - "credibilityObserved": { - "type": "number" + "accountState": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "baseTokenGatePassed", - "openPrThreshold", - "openPrCount", - "collateralFraction", - "credibilityFloor", - "credibilityObserved" + "branchQuality", + "accountState" ] }, - "branchEligibility": { + "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": { - "required": { - "type": "boolean" - }, "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" - }, - "explanation": { - "type": "string" - } - }, - "required": [ - "gate", - "current", - "projected", - "explanation" - ] - } + "scorePreview": { + "$ref": "#/components/schemas/ScorePreviewResult" }, - "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": { + "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" } }, - "scoreEstimate": { - "type": "object", - "properties": { - "baseScore": { - "type": "number" + "required": [ + "name", + "source", + "assumptions", + "scoreEstimate", + "gates", + "effectiveEstimatedScore", + "underlyingPotentialScore", + "blockedBy", + "linkedIssueMultiplier", + "deltaExplanation" + ] + }, + "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" + } }, - "densityMultiplier": { - "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" + } }, - "contributionBonus": { - "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" + } + } }, - "labelMultiplier": { - "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" + ] + }, + "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" + } }, - "issueMultiplier": { - "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" + } }, - "credibilityMultiplier": { - "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" + } + } }, - "reviewPenaltyMultiplier": { - "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" + } }, - "openPrMultiplier": { - "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" + } }, - "estimatedMergedScore": { - "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" + } + } }, - "pendingSaturationScore": { - "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" } }, - "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" + "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" + } }, - "credibilityFloor": { - "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" + } }, - "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": { + "gate": { "type": "string", "enum": [ - "none", - "standard", - "maintainer" + "open_pr_threshold", + "credibility_floor", + "linked_issue_multiplier" ] }, - "status": { + "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": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" + "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" ] }, - "source": { + "severity": { "type": "string", "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" + "blocker", + "reducer", + "context" ] }, - "eligible": { - "type": "boolean" - }, - "issueNumbers": { - "type": "array", - "items": { - "type": "number" - } - }, - "solvedByPullRequests": { - "type": "array", - "items": { - "type": "number" - } - }, - "baseMultiplier": { - "type": "number" - }, - "appliedMultiplier": { - "type": "number" - }, - "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" - ] - } - }, - "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" - ] - }, - "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" + "current", + "bestReasonableCase", + "gateDeltas", + "blockedBy" ] }, - "rewardUpside": { + "observedPullRequestScenarios": { "type": "object", "properties": { - "relevantLane": { - "type": "string", - "enum": [ - "direct_pr", - "issue_discovery", - "maintainer_lane", - "none" - ] - }, - "repoSlice": { - "type": "number" - }, - "directPrSlice": { - "type": "number" - }, - "issueDiscoverySlice": { + "approvedOrMergeable": { "type": "number" }, - "maintainerCutSlice": { + "stale": { "type": "number" }, - "labelMultiplier": { + "closed": { "type": "number" }, - "issueMultiplier": { + "draft": { "type": "number" }, - "estimatedScoreIfClean": { + "blocked": { "type": "number" }, - "currentEstimatedScore": { + "maintainerLane": { "type": "number" + }, + "notes": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "relevantLane", - "repoSlice", - "directPrSlice", - "issueDiscoverySlice", - "maintainerCutSlice", - "labelMultiplier", - "issueMultiplier", - "estimatedScoreIfClean", - "currentEstimatedScore" + "approvedOrMergeable", + "stale", + "closed", + "draft", + "blocked", + "maintainerLane", + "notes" ] }, - "scoreBlockers": { - "type": "array", - "items": { - "type": "string" - } - }, - "riskBreakdown": { + "githubBranchStatus": { "type": "object", "properties": { - "queueBurden": { + "source": { "type": "string", "enum": [ - "low", - "medium", - "high", - "critical" + "cached_github_data" ] }, - "queueBurdenScore": { - "type": "number" - }, - "duplicateClusters": { - "type": "number" - }, - "highRiskDuplicateClusters": { - "type": "number" + "status": { + "type": "string", + "enum": [ + "approved", + "failing_checks", + "needs_author", + "blocked", + "pending_review", + "no_pr", + "unknown" + ] }, - "closedPullRequestRate": { + "pullNumber": { "type": "number" }, - "openPullRequests": { - "type": "number" + "title": { + "type": "string" }, - "credibility": { - "type": "number" + "reviewDecision": { + "type": "string", + "nullable": true }, - "reviewChurnRisk": { + "mergeableState": { "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "nullable": true + }, + "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 + "source", + "status", + "notes" ] }, - "sourceUpload": { + "branchEligibility": { "type": "object", "properties": { - "enabled": { - "type": "boolean", + "required": { + "type": "boolean" + }, + "status": { + "type": "string", "enum": [ - false + "eligible", + "ineligible", + "unknown", + "not_required" + ] + }, + "evidence": { + "type": "string", + "enum": [ + "provided", + "missing" + ] + }, + "source": { + "type": "string", + "enum": [ + "github_metadata", + "local_metadata", + "registry", + "user_supplied", + "missing" ] }, - "detail": { - "type": "string" - } - }, - "required": [ - "enabled", - "detail" - ] - }, - "branch": { - "type": "object", - "properties": { - "name": { + "reason": { "type": "string" }, - "baseRef": { + "checkedAt": { "type": "string" }, - "headSha": { - "type": "string" + "stale": { + "type": "boolean" }, - "pendingCommitCount": { - "type": "number" + "warnings": { + "type": "array", + "items": { + "type": "string" + } } }, "required": [ - "pendingCommitCount" + "required", + "status", + "evidence", + "source", + "stale", + "warnings" ] }, - "changedFiles": { + "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": { - "total": { - "type": "number" - }, - "added": { - "type": "number" + "recommendation": { + "type": "string", + "enum": [ + "pursue", + "cleanup_first", + "maintainer_lane", + "avoid_for_now", + "unknown" + ] }, - "modified": { - "type": "number" + "reviewBurden": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] }, - "deleted": { - "type": "number" + "role": { + "type": "string", + "enum": [ + "outside_contributor", + "repo_maintainer", + "org_member", + "collaborator", + "owner", + "unknown" + ] }, - "renamed": { - "type": "number" + "maintainerLane": { + "type": "boolean" }, - "binary": { - "type": "number" + "reasons": { + "type": "array", + "items": { + "type": "string" + } }, - "paths": { + "risks": { "type": "array", "items": { "type": "string" @@ -6147,108 +6070,101 @@ } }, "required": [ - "total", - "added", - "modified", - "deleted", - "renamed", - "binary", - "paths" + "recommendation", + "reviewBurden", + "role", + "maintainerLane", + "reasons", + "risks" ] }, - "testEvidence": { + "manifestGuidance": { "type": "object", "properties": { - "level": { + "present": { + "type": "boolean" + }, + "source": { "type": "string", "enum": [ - "test_files", - "validation_commands", - "both", + "repo_file", + "api_record", "none" ] }, - "testFileCount": { - "type": "number" + "linkedIssuePolicy": { + "type": "string", + "enum": [ + "required", + "preferred", + "optional" + ] }, - "passedValidationCount": { - "type": "number" + "issueDiscoveryPolicy": { + "type": "string", + "enum": [ + "encouraged", + "neutral", + "discouraged" + ] }, - "commands": { + "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": { - "command": { + "code": { "type": "string" }, - "status": { + "severity": { "type": "string", "enum": [ - "passed", - "failed", - "not_run" + "info", + "warning", + "critical" ] }, - "summary": { + "title": { + "type": "string" + }, + "detail": { + "type": "string" + }, + "action": { "type": "string" } }, "required": [ - "command", - "status" + "code", + "severity", + "title", + "detail" ] } - } - }, - "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" + }, + "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,7 +6410,7 @@ "suggestedActions" ] }, - "MaintainerLaneReport": { + "ContributorIntakeHealth": { "type": "object", "properties": { "repoFullName": { @@ -6419,23 +6419,38 @@ "generatedAt": { "type": "string" }, - "lane": { - "$ref": "#/components/schemas/LaneAdvice" + "level": { + "type": "string", + "enum": [ + "healthy", + "watch", + "strained", + "blocked" + ] }, - "maintainerCut": { + "score": { "type": "number" }, - "maintainerCutConfigured": { - "type": "boolean" - }, "queueHealth": { - "$ref": "#/components/schemas/QueueHealth" + "type": "object", + "additionalProperties": { + "nullable": true + } }, - "configQuality": { - "$ref": "#/components/schemas/ConfigQuality" + "configLevel": { + "type": "string", + "enum": [ + "excellent", + "good", + "needs_attention", + "fragile" + ] }, - "contributorIntakeHealth": { - "$ref": "#/components/schemas/ContributorIntakeHealth" + "duplicateClusters": { + "type": "number" + }, + "reviewablePullRequests": { + "type": "number" }, "summary": { "type": "string" @@ -6450,17 +6465,17 @@ "required": [ "repoFullName", "generatedAt", - "lane", - "maintainerCut", - "maintainerCutConfigured", + "level", + "score", "queueHealth", - "configQuality", - "contributorIntakeHealth", + "configLevel", + "duplicateClusters", + "reviewablePullRequests", "summary", "findings" ] }, - "ContributorIntakeHealth": { + "MaintainerLaneReport": { "type": "object", "properties": { "repoFullName": { @@ -6469,38 +6484,23 @@ "generatedAt": { "type": "string" }, - "level": { - "type": "string", - "enum": [ - "healthy", - "watch", - "strained", - "blocked" - ] + "lane": { + "$ref": "#/components/schemas/LaneAdvice" }, - "score": { + "maintainerCut": { "type": "number" }, - "queueHealth": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "configLevel": { - "type": "string", - "enum": [ - "excellent", - "good", - "needs_attention", - "fragile" - ] + "maintainerCutConfigured": { + "type": "boolean" }, - "duplicateClusters": { - "type": "number" + "queueHealth": { + "$ref": "#/components/schemas/QueueHealth" }, - "reviewablePullRequests": { - "type": "number" + "configQuality": { + "$ref": "#/components/schemas/ConfigQuality" + }, + "contributorIntakeHealth": { + "$ref": "#/components/schemas/ContributorIntakeHealth" }, "summary": { "type": "string" @@ -6515,12 +6515,12 @@ "required": [ "repoFullName", "generatedAt", - "level", - "score", + "lane", + "maintainerCut", + "maintainerCutConfigured", "queueHealth", - "configLevel", - "duplicateClusters", - "reviewablePullRequests", + "configQuality", + "contributorIntakeHealth", "summary", "findings" ] @@ -6683,93 +6683,323 @@ } }, "required": [ - "repoFullName", - "pullNumber", - "generatedAt", - "reviewPriority", - "summary", - "changeSummary", - "reviewSignals", - "findings", - "contributorNextSteps", - "maintainerNotes" - ] - }, - "PullRequestReviewIntelligence": { - "allOf": [ - { - "$ref": "#/components/schemas/PullRequestMaintainerPacket" - }, - { - "type": "object", - "properties": { - "roleContext": { - "$ref": "#/components/schemas/RoleContext" - }, - "outcomeContext": { - "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "recommendation": { - "type": "string", - "enum": [ - "review", - "needs_author", - "watch", - "likely_duplicate", - "maintainer_lane" - ] - }, - "privateSummary": { - "type": "string" - }, - "reviewability": { - "type": "object", - "additionalProperties": { - "nullable": true - } - } - }, - "required": [ - "roleContext", - "recommendation", - "privateSummary" - ] - } + "repoFullName", + "pullNumber", + "generatedAt", + "reviewPriority", + "summary", + "changeSummary", + "reviewSignals", + "findings", + "contributorNextSteps", + "maintainerNotes" + ] + }, + "PullRequestReviewIntelligence": { + "allOf": [ + { + "$ref": "#/components/schemas/PullRequestMaintainerPacket" + }, + { + "type": "object", + "properties": { + "roleContext": { + "$ref": "#/components/schemas/RoleContext" + }, + "outcomeContext": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "recommendation": { + "type": "string", + "enum": [ + "review", + "needs_author", + "watch", + "likely_duplicate", + "maintainer_lane" + ] + }, + "privateSummary": { + "type": "string" + }, + "reviewability": { + "type": "object", + "additionalProperties": { + "nullable": true + } + } + }, + "required": [ + "roleContext", + "recommendation", + "privateSummary" + ] + } + ] + }, + "Bounty": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "issueNumber": { + "type": "number" + }, + "status": { + "type": "string" + }, + "amountText": { + "type": "string", + "nullable": true + }, + "sourceUrl": { + "type": "string", + "nullable": true + }, + "payload": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "discoveredAt": { + "type": "string", + "nullable": true + }, + "updatedAt": { + "type": "string", + "nullable": true + } + }, + "required": [ + "id", + "repoFullName", + "issueNumber", + "status", + "payload" + ] + }, + "BountyAdvisory": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "issueNumber": { + "type": "number" + }, + "status": { + "type": "string" + }, + "lifecycle": { + "type": "string", + "enum": [ + "active", + "historical", + "completed", + "cancelled", + "stale", + "ambiguous", + "unknown" + ] + }, + "isActiveOpportunity": { + "type": "boolean" + }, + "fundingStatus": { + "type": "string", + "enum": [ + "funded", + "target_only", + "unknown" + ] + }, + "consensusRisk": { + "type": "string", + "enum": [ + "low", + "medium", + "high" + ] + }, + "linkedPrs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "number": { + "type": "number" + }, + "state": { + "type": "string", + "enum": [ + "open", + "closed", + "merged", + "unknown" + ] + }, + "isActive": { + "type": "boolean" + } + }, + "required": [ + "number", + "state", + "isActive" + ] + } + }, + "findings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Finding" + } + } + }, + "required": [ + "id", + "repoFullName", + "issueNumber", + "status", + "lifecycle", + "isActiveOpportunity", + "fundingStatus", + "consensusRisk", + "linkedPrs", + "findings" + ] + }, + "BountyLifecycleEvents": { + "type": "object", + "properties": { + "bountyId": { + "type": "string" + }, + "events": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "bountyId": { + "type": "string" + }, + "repoFullName": { + "type": "string" + }, + "issueNumber": { + "type": "number" + }, + "status": { + "type": "string" + }, + "payload": { + "type": "object", + "additionalProperties": { + "nullable": true + } + }, + "generatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "bountyId", + "repoFullName", + "issueNumber", + "status", + "payload", + "generatedAt" + ] + } + } + }, + "required": [ + "bountyId", + "events" ] }, - "Bounty": { + "RepositorySettings": { "type": "object", "properties": { - "id": { - "type": "string" - }, "repoFullName": { "type": "string" }, - "issueNumber": { - "type": "number" + "commentMode": { + "type": "string", + "enum": [ + "off", + "detected_contributors_only", + "all_prs" + ] }, - "status": { - "type": "string" + "publicSignalLevel": { + "type": "string", + "enum": [ + "minimal", + "standard" + ] }, - "amountText": { + "checkRunMode": { "type": "string", - "nullable": true + "enum": [ + "off", + "enabled" + ] }, - "sourceUrl": { + "checkRunDetailLevel": { "type": "string", - "nullable": true + "enum": [ + "minimal", + "standard", + "deep" + ] }, - "payload": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "autoLabelEnabled": { + "type": "boolean" }, - "discoveredAt": { + "gittensorLabel": { + "type": "string" + }, + "createMissingLabel": { + "type": "boolean" + }, + "publicSurface": { + "type": "string", + "enum": [ + "off", + "comment_and_label", + "comment_only", + "label_only" + ] + }, + "includeMaintainerAuthors": { + "type": "boolean" + }, + "requireLinkedIssue": { + "type": "boolean" + }, + "backfillEnabled": { + "type": "boolean" + }, + "privateTrustEnabled": { + "type": "boolean" + }, + "createdAt": { "type": "string", "nullable": true }, @@ -6779,249 +7009,395 @@ } }, "required": [ - "id", "repoFullName", - "issueNumber", - "status", - "payload" + "commentMode", + "publicSignalLevel", + "checkRunMode", + "checkRunDetailLevel", + "autoLabelEnabled", + "gittensorLabel", + "createMissingLabel", + "publicSurface", + "includeMaintainerAuthors", + "requireLinkedIssue", + "backfillEnabled", + "privateTrustEnabled" ] }, - "BountyAdvisory": { + "InstallationHealth": { "type": "object", "properties": { - "id": { - "type": "string" + "installationId": { + "type": "number" }, - "repoFullName": { + "accountLogin": { "type": "string" }, - "issueNumber": { + "repositorySelection": { + "type": "string", + "nullable": true + }, + "installedReposCount": { "type": "number" }, - "status": { - "type": "string" + "registeredInstalledCount": { + "type": "number" }, - "lifecycle": { + "status": { "type": "string", "enum": [ - "active", - "historical", - "completed", - "cancelled", - "stale", - "ambiguous", - "unknown" + "healthy", + "needs_attention", + "broken" ] }, - "isActiveOpportunity": { - "type": "boolean" + "missingPermissions": { + "type": "array", + "items": { + "type": "string" + } }, - "fundingStatus": { - "type": "string", - "enum": [ - "funded", - "target_only", - "unknown" - ] + "missingEvents": { + "type": "array", + "items": { + "type": "string" + } }, - "consensusRisk": { + "permissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "events": { + "type": "array", + "items": { + "type": "string" + } + }, + "checkedAt": { + "type": "string" + }, + "errorSummary": { "type": "string", - "enum": [ - "low", - "medium", - "high" - ] + "nullable": true + }, + "requiredPermissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "requiredEvents": { + "type": "array", + "items": { + "type": "string" + } + }, + "optionalVisibleEvents": { + "type": "array", + "items": { + "type": "string" + } + }, + "permissionRemediation": { + "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" + ] + } }, - "linkedPrs": { + "eventRemediation": { "type": "array", "items": { "type": "object", "properties": { - "number": { - "type": "number" - }, - "state": { - "type": "string", - "enum": [ - "open", - "closed", - "merged", - "unknown" - ] + "event": { + "type": "string" }, - "isActive": { + "ok": { "type": "boolean" + }, + "action": { + "type": "string" } }, "required": [ - "number", - "state", - "isActive" + "event", + "ok", + "action" ] } }, - "findings": { + "repairSteps": { "type": "array", "items": { - "$ref": "#/components/schemas/Finding" + "type": "string" } } }, "required": [ - "id", - "repoFullName", - "issueNumber", + "installationId", + "accountLogin", + "installedReposCount", + "registeredInstalledCount", "status", - "lifecycle", - "isActiveOpportunity", - "fundingStatus", - "consensusRisk", - "linkedPrs", - "findings" + "missingPermissions", + "missingEvents", + "permissions", + "events", + "checkedAt" ] }, - "BountyLifecycleEvents": { + "InstallationRepair": { "type": "object", "properties": { - "bountyId": { + "generatedAt": { "type": "string" }, - "events": { + "installation": { + "$ref": "#/components/schemas/InstallationHealth" + }, + "installedRepos": { "type": "array", "items": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "bountyId": { - "type": "string" - }, "repoFullName": { "type": "string" }, - "issueNumber": { - "type": "number" - }, - "status": { - "type": "string" + "isRegistered": { + "type": "boolean" }, - "payload": { + "settings": { "type": "object", - "additionalProperties": { - "nullable": true - } - }, - "generatedAt": { - "type": "string" + "properties": { + "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" + ] + }, + "autoLabelEnabled": { + "type": "boolean" + } + }, + "required": [ + "publicSurface", + "commentMode", + "checkRunMode", + "autoLabelEnabled" + ] } }, "required": [ - "id", - "bountyId", "repoFullName", - "issueNumber", - "status", - "payload", - "generatedAt" + "isRegistered", + "settings" ] } - } - }, - "required": [ - "bountyId", - "events" - ] - }, - "RepositorySettings": { - "type": "object", - "properties": { - "repoFullName": { - "type": "string" - }, - "commentMode": { - "type": "string", - "enum": [ - "off", - "detected_contributors_only", - "all_prs" - ] - }, - "publicSignalLevel": { - "type": "string", - "enum": [ - "minimal", - "standard" - ] - }, - "checkRunMode": { - "type": "string", - "enum": [ - "off", - "enabled" - ] }, - "checkRunDetailLevel": { - "type": "string", - "enum": [ - "minimal", - "standard", - "deep" - ] + "requiredPermissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } }, - "autoLabelEnabled": { - "type": "boolean" + "optionalPermissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } }, - "gittensorLabel": { - "type": "string" + "requiredEvents": { + "type": "array", + "items": { + "type": "string" + } }, - "createMissingLabel": { - "type": "boolean" + "optionalEvents": { + "type": "array", + "items": { + "type": "string" + } }, - "publicSurface": { - "type": "string", - "enum": [ - "off", - "comment_and_label", - "comment_only", - "label_only" - ] + "modeImpacts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "mode": { + "type": "string", + "enum": [ + "comment", + "label", + "check_run" + ] + }, + "enabled": { + "type": "boolean" + }, + "affectedRepoCount": { + "type": "number" + }, + "requiredPermissions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "permission": { + "type": "string" + }, + "requiredAccess": { + "type": "string" + }, + "missing": { + "type": "boolean" + }, + "optional": { + "type": "boolean" + } + }, + "required": [ + "permission", + "requiredAccess", + "missing", + "optional" + ] + } + }, + "summary": { + "type": "string" + }, + "action": { + "type": "string" + } + }, + "required": [ + "mode", + "enabled", + "affectedRepoCount", + "requiredPermissions", + "summary", + "action" + ] + } }, - "includeMaintainerAuthors": { - "type": "boolean" + "eventDiagnostics": { + "type": "array", + "items": { + "type": "object", + "properties": { + "event": { + "type": "string" + }, + "missing": { + "type": "boolean" + }, + "optional": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "action": { + "type": "string" + } + }, + "required": [ + "event", + "missing", + "optional", + "summary", + "action" + ] + } }, - "requireLinkedIssue": { - "type": "boolean" + "repairSteps": { + "type": "array", + "items": { + "type": "string" + } }, - "backfillEnabled": { - "type": "boolean" + "refresh": { + "type": "object", + "properties": { + "method": { + "type": "string", + "enum": [ + "POST" + ] + }, + "path": { + "type": "string" + }, + "lastCheckedAt": { + "type": "string" + } + }, + "required": [ + "method", + "path", + "lastCheckedAt" + ] }, - "privateTrustEnabled": { + "refreshed": { "type": "boolean" - }, - "createdAt": { - "type": "string", - "nullable": true - }, - "updatedAt": { - "type": "string", - "nullable": true } }, "required": [ - "repoFullName", - "commentMode", - "publicSignalLevel", - "checkRunMode", - "checkRunDetailLevel", - "autoLabelEnabled", - "gittensorLabel", - "createMissingLabel", - "publicSurface", - "includeMaintainerAuthors", - "requireLinkedIssue", - "backfillEnabled", - "privateTrustEnabled" + "generatedAt", + "installation", + "installedRepos", + "requiredPermissions", + "optionalPermissions", + "requiredEvents", + "optionalEvents", + "modeImpacts", + "eventDiagnostics", + "repairSteps", + "refresh" ] }, "RepoSettingsPreview": { @@ -7240,8 +7616,7 @@ "bot_author", "maintainer_author", "miner_detection_unavailable", - "not_official_gittensor_miner", - null + "not_official_gittensor_miner" ] }, "actions": { @@ -7758,509 +8133,173 @@ }, "expectedCount": { "type": "number", - "nullable": true - }, - "pageCount": { - "type": "number" - }, - "startedAt": { - "type": "string", - "nullable": true - }, - "completedAt": { - "type": "string", - "nullable": true - }, - "staleAt": { - "type": "string", - "nullable": true - }, - "rateLimitResetAt": { - "type": "string", - "nullable": true - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - }, - "errorSummary": { - "type": "string", - "nullable": true - }, - "updatedAt": { - "type": "string", - "nullable": true - }, - "cursor": { - "type": "string", - "nullable": true - }, - "coveragePercent": { - "type": "number", - "nullable": true - }, - "isRequired": { - "type": "boolean" - } - }, - "required": [ - "repoFullName", - "segment", - "status", - "sourceKind", - "mode", - "fetchedCount", - "pageCount", - "warnings" - ] - }, - "GitHubRateLimitObservation": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "repoFullName": { - "type": "string", - "nullable": true - }, - "resource": { - "type": "string", - "enum": [ - "rest", - "graphql" - ] - }, - "path": { - "type": "string" - }, - "statusCode": { - "type": "number" - }, - "limitValue": { - "type": "number", - "nullable": true - }, - "remaining": { - "type": "number", - "nullable": true - }, - "resetAt": { - "type": "string", - "nullable": true - }, - "observedAt": { - "type": "string", - "nullable": true - } - }, - "required": [ - "resource", - "path", - "statusCode" - ] - }, - "SignalFidelity": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "complete", - "degraded", - "blocked", - "unknown" - ] - }, - "repoCount": { - "type": "number" - }, - "completeRepos": { - "type": "number" - }, - "degradedRepos": { - "type": "number" - }, - "blockedRepos": { - "type": "number" - }, - "partialRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "cappedRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "staleRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "rateLimitedRepos": { - "type": "array", - "items": { - "type": "string" - } - }, - "nextRecoverableAt": { - "type": "string", - "nullable": true - } - }, - "required": [ - "status", - "repoCount", - "completeRepos", - "degradedRepos", - "blockedRepos", - "partialRepos", - "cappedRepos", - "staleRepos", - "rateLimitedRepos" - ] - }, - "InstallationHealth": { - "type": "object", - "properties": { - "installationId": { - "type": "number" - }, - "accountLogin": { - "type": "string" - }, - "repositorySelection": { - "type": "string", - "nullable": true - }, - "installedReposCount": { - "type": "number" - }, - "registeredInstalledCount": { - "type": "number" - }, - "status": { - "type": "string", - "enum": [ - "healthy", - "needs_attention", - "broken" - ] - }, - "missingPermissions": { - "type": "array", - "items": { - "type": "string" - } - }, - "missingEvents": { - "type": "array", - "items": { - "type": "string" - } + "nullable": true }, - "permissions": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "pageCount": { + "type": "number" }, - "events": { - "type": "array", - "items": { - "type": "string" - } + "startedAt": { + "type": "string", + "nullable": true }, - "checkedAt": { - "type": "string" + "completedAt": { + "type": "string", + "nullable": true }, - "errorSummary": { + "staleAt": { "type": "string", "nullable": true }, - "requiredPermissions": { - "type": "object", - "additionalProperties": { - "type": "string" - } + "rateLimitResetAt": { + "type": "string", + "nullable": true }, - "requiredEvents": { + "warnings": { "type": "array", "items": { "type": "string" } }, - "optionalVisibleEvents": { - "type": "array", - "items": { - "type": "string" - } + "errorSummary": { + "type": "string", + "nullable": true }, - "permissionRemediation": { - "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" - ] - } + "updatedAt": { + "type": "string", + "nullable": true }, - "eventRemediation": { - "type": "array", - "items": { - "type": "object", - "properties": { - "event": { - "type": "string" - }, - "ok": { - "type": "boolean" - }, - "action": { - "type": "string" - } - }, - "required": [ - "event", - "ok", - "action" - ] - } + "cursor": { + "type": "string", + "nullable": true }, - "repairSteps": { - "type": "array", - "items": { - "type": "string" - } + "coveragePercent": { + "type": "number", + "nullable": true + }, + "isRequired": { + "type": "boolean" } }, "required": [ - "installationId", - "accountLogin", - "installedReposCount", - "registeredInstalledCount", + "repoFullName", + "segment", "status", - "missingPermissions", - "missingEvents", - "permissions", - "events", - "checkedAt" + "sourceKind", + "mode", + "fetchedCount", + "pageCount", + "warnings" ] }, - "SyncStatus": { + "GitHubRateLimitObservation": { "type": "object", "properties": { - "generatedAt": { + "id": { "type": "string" }, - "signalFidelity": { - "$ref": "#/components/schemas/SignalFidelity" + "repoFullName": { + "type": "string", + "nullable": true }, - "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" + "resource": { + "type": "string", + "enum": [ + "rest", + "graphql" ] }, - "coreSignalFidelity": { - "$ref": "#/components/schemas/CoreSignalFidelity" + "path": { + "type": "string" }, - "upstreamDrift": { - "$ref": "#/components/schemas/UpstreamStatus" + "statusCode": { + "type": "number" }, - "historyCoverage": { + "limitValue": { + "type": "number", + "nullable": true + }, + "remaining": { + "type": "number", + "nullable": true + }, + "resetAt": { + "type": "string", + "nullable": true + }, + "observedAt": { + "type": "string", + "nullable": true + } + }, + "required": [ + "resource", + "path", + "statusCode" + ] + }, + "SignalFidelity": { + "type": "object", + "properties": { + "status": { "type": "string", "enum": [ - "sampled", - "counts_only", - "full" + "complete", + "degraded", + "blocked", + "unknown" ] }, - "refreshingRepos": { - "type": "array", - "items": { - "type": "string" - } + "repoCount": { + "type": "number" }, - "waitingForRateLimitRepos": { - "type": "array", - "items": { - "type": "string" - } + "completeRepos": { + "type": "number" }, - "repositories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncState" - } + "degradedRepos": { + "type": "number" }, - "segments": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RepoSyncSegment" - } + "blockedRepos": { + "type": "number" }, - "githubTotals": { + "partialRepos": { "type": "array", "items": { - "$ref": "#/components/schemas/RepoGithubTotalsSnapshot" + "type": "string" } }, - "pullRequestDetailSync": { + "cappedRepos": { "type": "array", "items": { - "type": "object", - "additionalProperties": { - "nullable": true - } + "type": "string" } }, - "installations": { + "staleRepos": { "type": "array", "items": { - "$ref": "#/components/schemas/InstallationHealth" + "type": "string" } }, - "rateLimits": { + "rateLimitedRepos": { "type": "array", "items": { - "$ref": "#/components/schemas/GitHubRateLimitObservation" + "type": "string" } + }, + "nextRecoverableAt": { + "type": "string", + "nullable": true } }, "required": [ - "generatedAt", - "signalFidelity", - "freshnessSlo", - "coreSignalFidelity", - "upstreamDrift", - "historyCoverage", - "refreshingRepos", - "waitingForRateLimitRepos", - "repositories", - "segments", - "githubTotals", - "pullRequestDetailSync", - "installations", - "rateLimits" + "status", + "repoCount", + "completeRepos", + "degradedRepos", + "blockedRepos", + "partialRepos", + "cappedRepos", + "staleRepos", + "rateLimitedRepos" ] }, "CoreSignalFidelity": { @@ -8326,91 +8365,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": { @@ -8533,22 +8487,105 @@ "nullable": true } }, - "generatedAt": { - "type": "string" + "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" + ] + }, + "highestSeverity": { + "type": "string", + "nullable": true, + "enum": [ + "low", + "medium", + "high", + "blocking" + ] + }, + "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" }, - "updatedAt": { - "type": "string" + "reports": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpstreamDriftReport" + } } }, "required": [ - "id", - "fingerprint", - "severity", + "generatedAt", "status", - "summary", "affectedAreas", - "generatedAt", - "updatedAt" + "registryHyperparameterDrift", + "openReportCount", + "reports" ] }, "RepoGithubTotalsSnapshot": { @@ -8613,6 +8650,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": { @@ -10182,6 +10407,60 @@ ] } }, + "/v1/installations/{id}/repair": { + "get": { + "responses": { + "200": { + "description": "GitHub App installation repair diagnostics", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstallationRepair" + } + } + } + }, + "404": { + "description": "Installation health not found" + } + }, + "security": [ + { + "GittensoryBearer": [] + }, + { + "GittensorySessionCookie": [] + } + ] + } + }, + "/v1/installations/{id}/repair/refresh": { + "post": { + "responses": { + "200": { + "description": "Refreshed GitHub App installation repair diagnostics", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstallationRepair" + } + } + } + }, + "404": { + "description": "Installation not found" + } + }, + "security": [ + { + "GittensoryBearer": [] + }, + { + "GittensorySessionCookie": [] + } + ] + } + }, "/v1/app/notification-model": { "get": { "responses": { diff --git a/src/api/routes.ts b/src/api/routes.ts index 704afdb33a..4a12c55a07 100644 --- a/src/api/routes.ts +++ b/src/api/routes.ts @@ -89,6 +89,7 @@ import { backfillOpenPullRequestDetails, backfillRegisteredRepositories, backfillRepositorySegment, + buildInstallationRepairDiagnostics, enrichInstallationHealth, refreshContributorActivity, refreshInstallationHealth, @@ -1385,6 +1386,26 @@ export function createApp() { return c.json(enrichInstallationHealth(health)); }); + app.get("/v1/installations/:id/repair", async (c) => { + const installationId = Number(c.req.param("id")); + if (!Number.isFinite(installationId)) return c.json({ error: "invalid_installation_id" }, 400); + const health = await getInstallationHealth(c.env, installationId); + if (!health) return c.json({ error: "installation_health_not_found" }, 404); + return c.json(await buildInstallationRepairDiagnostics(c.env, health)); + }); + + app.post("/v1/installations/:id/repair/refresh", async (c) => { + const installationId = Number(c.req.param("id")); + if (!Number.isFinite(installationId)) return c.json({ error: "invalid_installation_id" }, 400); + const refreshed = await refreshInstallationHealth(c.env); + if (!refreshed.installations.some((installation) => installation.installationId === installationId)) { + return c.json({ error: "installation_not_found" }, 404); + } + const health = await getInstallationHealth(c.env, installationId); + if (!health) return c.json({ error: "installation_health_not_found" }, 404); + return c.json({ ...(await buildInstallationRepairDiagnostics(c.env, health)), refreshed: true }); + }); + app.get("/v1/repos", async (c) => c.json(await listRepositories(c.env))); app.get("/v1/repos/:owner/:repo", async (c) => { diff --git a/src/github/backfill.ts b/src/github/backfill.ts index 31ed3a76e6..82f2de9c2c 100644 --- a/src/github/backfill.ts +++ b/src/github/backfill.ts @@ -50,6 +50,7 @@ import type { RepoSyncSegmentRecord, RepoSyncStateRecord, RepositoryRecord, + RepositorySettings, } from "../types"; import { errorMessage, nowIso, repoParts, strippedErrorMessage } from "../utils/json"; import { createInstallationToken, getAppInstallation } from "./app"; @@ -646,6 +647,23 @@ export const OPTIONAL_CHECK_RUN_PERMISSION: Record = { export const REQUIRED_INSTALLATION_EVENTS = ["issues", "issue_comment", "pull_request", "repository"] as const; export const OPTIONAL_VISIBLE_INSTALLATION_EVENTS = ["installation_target"] as const; +type InstallationModeImpact = { + mode: "comment" | "label" | "check_run"; + enabled: boolean; + affectedRepoCount: number; + requiredPermissions: Array<{ permission: string; requiredAccess: string; missing: boolean; optional: boolean }>; + summary: string; + action: string; +}; + +type InstallationEventDiagnostic = { + event: string; + missing: boolean; + optional: boolean; + summary: string; + action: string; +}; + export function enrichInstallationHealth(health: InstallationHealthRecord) { const missingPermissions = new Set(health.missingPermissions); const missingEvents = new Set(health.missingEvents); @@ -683,6 +701,129 @@ export function enrichInstallationHealth(health: InstallationHealthRecord) { }; } +export async function buildInstallationRepairDiagnostics(env: Env, health: InstallationHealthRecord) { + const installedRepos = (await listRepositories(env)).filter((repo) => repo.installationId === health.installationId && repo.isInstalled); + const installedSettings = await Promise.all(installedRepos.map((repo) => getRepositorySettings(env, repo.fullName))); + const commentRepoCount = installedSettings.filter(usesCommentMode).length; + const labelRepoCount = installedSettings.filter(usesLabelMode).length; + const checkRunRepoCount = installedSettings.filter((settings) => settings.checkRunMode === "enabled").length; + const missingPermissions = new Set(health.missingPermissions); + const missingEvents = new Set(health.missingEvents); + const requiredPermissions = { + ...REQUIRED_INSTALLATION_PERMISSIONS, + ...(checkRunRepoCount > 0 ? OPTIONAL_CHECK_RUN_PERMISSION : {}), + }; + const optionalPermissions = checkRunRepoCount > 0 ? {} : OPTIONAL_CHECK_RUN_PERMISSION; + const modeImpacts: InstallationModeImpact[] = [ + buildPermissionModeImpact({ + mode: "comment", + enabled: commentRepoCount > 0, + affectedRepoCount: commentRepoCount, + permission: "issues", + requiredAccess: "write", + missing: missingPermissions.has("issues"), + summary: "PR comments use the GitHub Issues API, so comment mode requires Issues: write.", + }), + buildPermissionModeImpact({ + mode: "label", + enabled: labelRepoCount > 0, + affectedRepoCount: labelRepoCount, + permission: "issues", + requiredAccess: "write", + missing: missingPermissions.has("issues"), + summary: "PR labels use the GitHub Issues API, so label mode requires Issues: write.", + }), + buildPermissionModeImpact({ + mode: "check_run", + enabled: checkRunRepoCount > 0, + affectedRepoCount: checkRunRepoCount, + permission: "checks", + requiredAccess: "write", + missing: checkRunRepoCount > 0 && missingPermissions.has("checks"), + optional: checkRunRepoCount === 0, + summary: + checkRunRepoCount > 0 + ? "Check run mode is enabled for at least one installed repo, so Checks: write is required." + : "Checks: write is optional unless check run mode is enabled for an installed repo.", + }), + ]; + const eventDiagnostics: InstallationEventDiagnostic[] = REQUIRED_INSTALLATION_EVENTS.map((event) => ({ + event, + missing: missingEvents.has(event), + optional: false, + summary: `Gittensory expects the ${event} webhook event for installation health and GitHub App automation.`, + action: missingEvents.has(event) ? `Subscribe to the ${event} webhook event, then approve or reinstall the app.` : "No change needed.", + })); + return { + generatedAt: nowIso(), + installation: enrichInstallationHealth(health), + installedRepos: installedRepos.map((repo, index) => ({ + repoFullName: repo.fullName, + isRegistered: repo.isRegistered, + settings: summarizeRepairSettings(installedSettings[index] as RepositorySettings), + })), + requiredPermissions, + optionalPermissions, + requiredEvents: [...REQUIRED_INSTALLATION_EVENTS], + optionalEvents: [...OPTIONAL_VISIBLE_INSTALLATION_EVENTS], + modeImpacts, + eventDiagnostics, + repairSteps: + health.status === "healthy" + ? ["No repair needed."] + : [ + "Update the GitHub App permissions and subscribed events listed in diagnostics.", + "Approve the changed permissions or reinstall the app on the target account.", + `Run POST /v1/installations/${health.installationId}/repair/refresh after GitHub applies the changes.`, + `Recheck GET /v1/installations/${health.installationId}/repair.`, + ], + refresh: { + method: "POST", + path: `/v1/installations/${health.installationId}/repair/refresh`, + lastCheckedAt: health.checkedAt, + }, + }; +} + +function buildPermissionModeImpact(args: { + mode: InstallationModeImpact["mode"]; + enabled: boolean; + affectedRepoCount: number; + permission: string; + requiredAccess: string; + missing: boolean; + summary: string; + optional?: boolean; +}): InstallationModeImpact { + const optional = args.optional ?? false; + return { + mode: args.mode, + enabled: args.enabled, + affectedRepoCount: args.affectedRepoCount, + requiredPermissions: [{ permission: args.permission, requiredAccess: args.requiredAccess, missing: args.missing, optional }], + summary: args.summary, + action: args.missing ? `Set repository permission ${args.permission} to ${args.requiredAccess}, then approve or reinstall the app.` : "No change needed.", + }; +} + +function usesCommentMode(settings: RepositorySettings): boolean { + if (settings.commentMode === "off") return false; + return settings.publicSurface === "comment_and_label" || settings.publicSurface === "comment_only"; +} + +function usesLabelMode(settings: RepositorySettings): boolean { + return settings.autoLabelEnabled && (settings.publicSurface === "comment_and_label" || settings.publicSurface === "label_only"); +} + +function summarizeRepairSettings(settings: RepositorySettings) { + return { + publicSurface: settings.publicSurface, + commentMode: settings.commentMode, + checkRunMode: settings.checkRunMode, + autoLabelEnabled: settings.autoLabelEnabled, + }; +} + export async function refreshInstallationHealth(env: Env) { const [installations, repositories] = await Promise.all([listInstallations(env), listRepositories(env)]); const health = []; diff --git a/src/openapi/schemas.ts b/src/openapi/schemas.ts index 9eb52acb32..e302322e08 100644 --- a/src/openapi/schemas.ts +++ b/src/openapi/schemas.ts @@ -745,6 +745,43 @@ export const InstallationHealthSchema = z }) .openapi("InstallationHealth"); +export const InstallationRepairSchema = z + .object({ + generatedAt: z.string(), + installation: InstallationHealthSchema, + installedRepos: z.array( + z.object({ + repoFullName: z.string(), + isRegistered: z.boolean(), + settings: z.object({ + publicSurface: z.enum(["off", "comment_and_label", "comment_only", "label_only"]), + commentMode: z.enum(["off", "detected_contributors_only", "all_prs"]), + checkRunMode: z.enum(["off", "enabled"]), + autoLabelEnabled: z.boolean(), + }), + }), + ), + requiredPermissions: z.record(z.string()), + optionalPermissions: z.record(z.string()), + requiredEvents: z.array(z.string()), + optionalEvents: z.array(z.string()), + modeImpacts: z.array( + z.object({ + mode: z.enum(["comment", "label", "check_run"]), + enabled: z.boolean(), + affectedRepoCount: z.number(), + requiredPermissions: z.array(z.object({ permission: z.string(), requiredAccess: z.string(), missing: z.boolean(), optional: z.boolean() })), + summary: z.string(), + action: z.string(), + }), + ), + eventDiagnostics: z.array(z.object({ event: z.string(), missing: z.boolean(), optional: z.boolean(), summary: z.string(), action: z.string() })), + repairSteps: z.array(z.string()), + refresh: z.object({ method: z.literal("POST"), path: z.string(), lastCheckedAt: z.string() }), + refreshed: z.boolean().optional(), + }) + .openapi("InstallationRepair"); + export const UpstreamDriftReportSchema = z .object({ id: z.string(), diff --git a/src/openapi/spec.ts b/src/openapi/spec.ts index 5343b06f13..b1c7ca75b3 100644 --- a/src/openapi/spec.ts +++ b/src/openapi/spec.ts @@ -26,6 +26,7 @@ import { ContributorStrategySchema, HealthSchema, InstallationHealthSchema, + InstallationRepairSchema, IssueQualityReportSchema, IssueQualityResponseSchema, LabelAuditSchema, @@ -113,6 +114,7 @@ export function buildOpenApiSpec() { registry.register("BountyAdvisory", BountyAdvisorySchema); registry.register("BountyLifecycleEvents", BountyLifecycleEventsSchema); registry.register("RepositorySettings", RepositorySettingsSchema); + registry.register("InstallationRepair", InstallationRepairSchema); registry.register("RepoSettingsPreview", RepoSettingsPreviewSchema); registry.register("AgentRun", AgentRunSchema); registry.register("AgentAction", AgentActionSchema); @@ -258,6 +260,22 @@ export function buildOpenApiSpec() { 404: { description: "Installation health not found" }, }, }); + registry.registerPath({ + method: "get", + path: "/v1/installations/{id}/repair", + responses: { + 200: { description: "GitHub App installation repair diagnostics", content: { "application/json": { schema: InstallationRepairSchema } } }, + 404: { description: "Installation health not found" }, + }, + }); + registry.registerPath({ + method: "post", + path: "/v1/installations/{id}/repair/refresh", + responses: { + 200: { description: "Refreshed GitHub App installation repair diagnostics", content: { "application/json": { schema: InstallationRepairSchema } } }, + 404: { description: "Installation not found" }, + }, + }); registry.registerPath({ method: "get", path: "/v1/app/notification-model", diff --git a/test/integration/api.test.ts b/test/integration/api.test.ts index 2bbf76271c..dbedcb901c 100644 --- a/test/integration/api.test.ts +++ b/test/integration/api.test.ts @@ -1165,6 +1165,113 @@ describe("api routes", () => { } }); + it("serves installation repair diagnostics and refreshes installation health", async () => { + const app = createApp(); + const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); + const repoPayload = { name: "gittensory", full_name: "JSONbored/gittensory", private: true, default_branch: "main", owner: { login: "JSONbored" } }; + await upsertInstallation(env, { + installation: { + id: 777, + account: { login: "JSONbored", id: 1, type: "User" }, + repository_selection: "selected", + permissions: { metadata: "read", pull_requests: "read" }, + events: ["issues", "pull_request", "repository"], + }, + repositories: [repoPayload], + }); + await upsertRepositoryFromGitHub(env, repoPayload, 777); + await upsertRepositorySettings(env, { + repoFullName: "JSONbored/gittensory", + commentMode: "all_prs", + publicSurface: "comment_and_label", + autoLabelEnabled: true, + checkRunMode: "off", + }); + await upsertInstallationHealth(env, { + installationId: 777, + accountLogin: "JSONbored", + repositorySelection: "selected", + installedReposCount: 1, + registeredInstalledCount: 0, + status: "needs_attention", + missingPermissions: ["issues"], + missingEvents: ["issue_comment"], + permissions: { metadata: "read", pull_requests: "read" }, + events: ["issues", "pull_request", "repository"], + checkedAt: "2026-05-28T00:00:00.000Z", + }); + + const repair = await app.request("/v1/installations/777/repair", { headers: apiHeaders(env) }, env); + expect(repair.status).toBe(200); + const repairBody = (await repair.json()) as { + installation: { status: string; missingPermissions: string[]; missingEvents: string[] }; + requiredPermissions: Record; + optionalPermissions: Record; + modeImpacts: Array<{ mode: string; enabled: boolean; affectedRepoCount: number; requiredPermissions: Array<{ permission: string; missing: boolean; optional: boolean }> }>; + eventDiagnostics: Array<{ event: string; missing: boolean }>; + refresh: { method: string; path: string }; + }; + expect(repairBody).toMatchObject({ + installation: { status: "needs_attention", missingPermissions: ["issues"], missingEvents: ["issue_comment"] }, + requiredPermissions: { metadata: "read", pull_requests: "read", issues: "write" }, + optionalPermissions: { checks: "write" }, + refresh: { method: "POST", path: "/v1/installations/777/repair/refresh" }, + }); + expect(repairBody.requiredPermissions).not.toHaveProperty("checks"); + expect(repairBody.modeImpacts).toEqual( + expect.arrayContaining([ + expect.objectContaining({ mode: "comment", enabled: true, affectedRepoCount: 1, requiredPermissions: [expect.objectContaining({ permission: "issues", missing: true, optional: false })] }), + expect.objectContaining({ mode: "label", enabled: true, affectedRepoCount: 1, requiredPermissions: [expect.objectContaining({ permission: "issues", missing: true, optional: false })] }), + expect.objectContaining({ mode: "check_run", enabled: false, affectedRepoCount: 0, requiredPermissions: [expect.objectContaining({ permission: "checks", missing: false, optional: true })] }), + ]), + ); + expect(repairBody.eventDiagnostics).toEqual(expect.arrayContaining([expect.objectContaining({ event: "issue_comment", missing: true })])); + expect(JSON.stringify(repairBody)).not.toMatch(/wallet|hotkey|raw trust score|payout|reward estimate|farming|private reviewability|public score estimate|github_pat|private key/i); + + await upsertRepositorySettings(env, { repoFullName: "JSONbored/gittensory", checkRunMode: "enabled" }); + await upsertInstallationHealth(env, { + installationId: 777, + accountLogin: "JSONbored", + repositorySelection: "selected", + installedReposCount: 1, + registeredInstalledCount: 0, + status: "needs_attention", + missingPermissions: ["checks"], + missingEvents: [], + permissions: { metadata: "read", pull_requests: "read", issues: "write" }, + events: ["issues", "issue_comment", "pull_request", "repository"], + checkedAt: "2026-05-28T00:01:00.000Z", + }); + const repairWithChecks = await app.request("/v1/installations/777/repair", { headers: apiHeaders(env) }, env); + const repairWithChecksBody = (await repairWithChecks.json()) as typeof repairBody; + expect(repairWithChecksBody.requiredPermissions).toMatchObject({ checks: "write" }); + expect(repairWithChecksBody.optionalPermissions).toEqual({}); + expect(repairWithChecksBody.modeImpacts).toEqual( + expect.arrayContaining([expect.objectContaining({ mode: "check_run", enabled: true, affectedRepoCount: 1, requiredPermissions: [expect.objectContaining({ permission: "checks", missing: true, optional: false })] })]), + ); + + vi.stubGlobal("fetch", async (input: RequestInfo | URL) => { + const url = input.toString(); + if (url.endsWith("/app/installations/777")) { + return Response.json({ + id: 777, + account: { login: "JSONbored", id: 1, type: "User" }, + repository_selection: "selected", + permissions: { metadata: "read", pull_requests: "read", issues: "write", checks: "write" }, + events: ["issues", "issue_comment", "pull_request", "repository"], + }); + } + return new Response("not found", { status: 404 }); + }); + const refreshed = await app.request("/v1/installations/777/repair/refresh", { method: "POST", headers: apiHeaders(env) }, env); + expect(refreshed.status).toBe(200); + await expect(refreshed.json()).resolves.toMatchObject({ + refreshed: true, + installation: { status: "healthy", missingPermissions: [], missingEvents: [] }, + requiredPermissions: { metadata: "read", pull_requests: "read", issues: "write", checks: "write" }, + }); + }); + it("serves live app dashboards, digest subscriptions, commands, and extension context", async () => { const app = createApp(); const env = createTestEnv({ ADMIN_GITHUB_LOGINS: "oktofeesh1,other", PRODUCT_USAGE_HASH_SALT: "usage-adoption-test-salt" }); @@ -4110,6 +4217,22 @@ function apiHeaders(env: Env): Record { }; } +async function generatePrivateKeyPem(): Promise { + const key = (await crypto.subtle.generateKey( + { + name: "RSASSA-PKCS1-v1_5", + modulusLength: 2048, + publicExponent: new Uint8Array([1, 0, 1]), + hash: "SHA-256", + }, + true, + ["sign", "verify"], + )) as CryptoKeyPair; + const exported = await crypto.subtle.exportKey("pkcs8", key.privateKey); + const base64 = Buffer.from(exported as ArrayBuffer).toString("base64").replace(/(.{64})/g, "$1\n"); + return `-----BEGIN PRIVATE KEY-----\n${base64}\n-----END PRIVATE KEY-----`; +} + function upstreamContractFetch() { const files: Record = { "gittensor/constants.py": "SRC_TOK_SATURATION_SCALE = 58\nMAX_CODE_DENSITY_MULTIPLIER = 1.15\n", diff --git a/test/integration/routes-errors.test.ts b/test/integration/routes-errors.test.ts index e3c95321b3..dc9be3e136 100644 --- a/test/integration/routes-errors.test.ts +++ b/test/integration/routes-errors.test.ts @@ -432,6 +432,10 @@ describe("api route guards and error branches", () => { expect((await app.request("/v1/repos/nope/missing", { headers: apiHeaders(env) }, env)).status).toBe(404); expect((await app.request("/v1/installations/not-a-number/health", { headers: apiHeaders(env) }, env)).status).toBe(400); expect((await app.request("/v1/installations/999/health", { headers: apiHeaders(env) }, env)).status).toBe(404); + expect((await app.request("/v1/installations/not-a-number/repair", { headers: apiHeaders(env) }, env)).status).toBe(400); + expect((await app.request("/v1/installations/999/repair", { headers: apiHeaders(env) }, env)).status).toBe(404); + expect((await app.request("/v1/installations/not-a-number/repair/refresh", { method: "POST", headers: apiHeaders(env) }, env)).status).toBe(400); + expect((await app.request("/v1/installations/999/repair/refresh", { method: "POST", headers: apiHeaders(env) }, env)).status).toBe(404); const emptyReadiness = await app.request("/v1/readiness", { headers: apiHeaders(env) }, env); expect(emptyReadiness.status).toBe(200); await expect(emptyReadiness.json()).resolves.toMatchObject({ registry: null, scoringModel: null, readyForPublicReview: false }); diff --git a/test/unit/backfill.test.ts b/test/unit/backfill.test.ts index 670454f0cc..04d198c9cb 100644 --- a/test/unit/backfill.test.ts +++ b/test/unit/backfill.test.ts @@ -26,6 +26,7 @@ import { backfillOpenPullRequestDetails, backfillRegisteredRepositories, backfillRepositorySegment, + buildInstallationRepairDiagnostics, enqueueRepositoryOpenDataBackfill, refreshContributorActivity, refreshInstallationHealth, @@ -376,6 +377,42 @@ describe("GitHub backfill", () => { ); }); + it("marks comment, label, and check repair impacts disabled by repo settings", async () => { + const env = createTestEnv(); + await upsertRepositoryFromGitHub(env, { name: "gittensory", full_name: "JSONbored/gittensory", private: true, owner: { login: "JSONbored" } }, 123); + await upsertRepositorySettings(env, { + repoFullName: "JSONbored/gittensory", + commentMode: "off", + publicSurface: "off", + autoLabelEnabled: false, + checkRunMode: "off", + }); + + const repair = await buildInstallationRepairDiagnostics(env, { + installationId: 123, + accountLogin: "JSONbored", + repositorySelection: "selected", + installedReposCount: 1, + registeredInstalledCount: 0, + status: "healthy", + missingPermissions: [], + missingEvents: [], + permissions: { metadata: "read", pull_requests: "read", issues: "write" }, + events: ["issues", "issue_comment", "pull_request", "repository"], + checkedAt: "2026-05-28T00:00:00.000Z", + }); + + expect(repair.repairSteps).toEqual(["No repair needed."]); + expect(repair.requiredPermissions).not.toHaveProperty("checks"); + expect(repair.modeImpacts).toEqual( + expect.arrayContaining([ + expect.objectContaining({ mode: "comment", enabled: false, affectedRepoCount: 0, action: "No change needed." }), + expect.objectContaining({ mode: "label", enabled: false, affectedRepoCount: 0, action: "No change needed." }), + expect.objectContaining({ mode: "check_run", enabled: false, affectedRepoCount: 0, requiredPermissions: [expect.objectContaining({ optional: true })] }), + ]), + ); + }); + it("refreshes installation health from live GitHub App metadata", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await seedRegisteredRepo(env); diff --git a/test/unit/openapi.test.ts b/test/unit/openapi.test.ts index 57a2369aaf..ac7cd87196 100644 --- a/test/unit/openapi.test.ts +++ b/test/unit/openapi.test.ts @@ -55,6 +55,8 @@ describe("OpenAPI contract", () => { expect(spec.paths["/v1/auth/github/device/start"]).toBeDefined(); expect(spec.paths["/v1/auth/session"]).toBeDefined(); expect(spec.paths["/v1/internal/jobs/repair-data-fidelity"]).toBeDefined(); + expect(spec.paths["/v1/installations/{id}/repair"]).toBeDefined(); + expect(spec.paths["/v1/installations/{id}/repair/refresh"]).toBeDefined(); for (const removedPath of [ "/v1/contributors/{login}/opportunities", @@ -93,6 +95,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?.InstallationRepair).toBeDefined(); expect(spec.components?.schemas?.AgentRunBundle).toBeDefined(); expect(spec.components?.schemas?.AgentAction).toBeDefined(); expect(spec.components?.schemas?.UpstreamStatus).toBeDefined(); From 1e1ec7b779ca66ca62798ebb85a87ca0f05819b6 Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:25:52 +0200 Subject: [PATCH 2/3] fix(ui): update MCP known latest --- apps/gittensory-ui/src/lib/mcp-package.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/gittensory-ui/src/lib/mcp-package.ts b/apps/gittensory-ui/src/lib/mcp-package.ts index 749d8fe434..684d56af4e 100644 --- a/apps/gittensory-ui/src/lib/mcp-package.ts +++ b/apps/gittensory-ui/src/lib/mcp-package.ts @@ -6,7 +6,7 @@ export const MCP_PACKAGE_NAME = "@jsonbored/gittensory-mcp"; export const MCP_PACKAGE_ENCODED_NAME = "@jsonbored%2fgittensory-mcp"; export const MCP_PACKAGE_REGISTRY_URL = `https://registry.npmjs.org/${MCP_PACKAGE_ENCODED_NAME}`; export const MCP_PACKAGE_NPM_URL = `https://www.npmjs.com/package/${MCP_PACKAGE_NAME}`; -export const MCP_PACKAGE_KNOWN_LATEST_VERSION = "0.3.0"; +export const MCP_PACKAGE_KNOWN_LATEST_VERSION = "0.4.0"; export const MCP_MINIMUM_SUPPORTED_VERSION = "0.2.0"; export type NpmPackageMetadata = { From 9cb775c8a38cda1944c60add8f0b9b446da96266 Mon Sep 17 00:00:00 2001 From: mkdev11 Date: Tue, 2 Jun 2026 11:32:15 +0200 Subject: [PATCH 3/3] fix(openapi): align repair schema records --- apps/gittensory-ui/public/openapi.json | 8261 ++++++++++++------------ src/openapi/schemas.ts | 4 +- test/unit/backfill.test.ts | 41 + 3 files changed, 4175 insertions(+), 4131 deletions(-) diff --git a/apps/gittensory-ui/public/openapi.json b/apps/gittensory-ui/public/openapi.json index ae7a29247f..44513f72ea 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,1390 @@ "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" + "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" ] }, - "testFileCount": { - "type": "number" - }, - "passedValidationCount": { - "type": "number" - }, - "commands": { - "type": "array", - "items": { - "type": "object", - "properties": { - "command": { + "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" + } }, - "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": { + "afterApprovedPrsMerge": { "type": "object", "properties": { "name": { @@ -4777,7 +4356,7 @@ "deltaExplanation" ] }, - "bestReasonableCase": { + "afterStalePrsClose": { "type": "object", "properties": { "name": { @@ -5025,903 +4604,1542 @@ "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": { + "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" - } - }, - "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" - } + "detail": { + "type": "string" }, - "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" - ] + "action": { + "type": "string" } }, - "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": [ + "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" + }, + "lines": { + "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" - ] + "required": [ + "heading", + "lines" + ] + } }, - "afterApprovedPrsMerge": { + "reviewerNotes": { + "type": "array", + "items": { + "type": "string" + } + }, + "validationSummary": { "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" - ] + "passed": { + "type": "number" }, - "effectiveEstimatedScore": { + "failed": { "type": "number" }, - "underlyingPotentialScore": { + "notRun": { "type": "number" }, - "blockedBy": { + "commands": { "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" - ] + "command": { + "type": "string" }, - "severity": { + "status": { "type": "string", "enum": [ - "blocker", - "reducer", - "context" + "passed", + "failed", + "not_run", + "skipped", + "focused", + "unknown" ] }, - "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": { + "summary": { "type": "string" + }, + "durationMs": { + "type": "number" + }, + "exitCode": { + "type": "number" } - } - }, - "required": [ - "mode", - "status", - "source", - "eligible", - "issueNumbers", - "solvedByPullRequests", - "baseMultiplier", - "appliedMultiplier", - "reason", - "warnings" - ] - }, - "deltaExplanation": { + }, + "required": [ + "command", + "status" + ] + } + } + }, + "required": [ + "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" + ] + }, + "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" } }, - "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" } }, - "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": { + "code": { "type": "string", "enum": [ - "not_required", - "raw", - "plausible", - "validated", - "invalid", - "unavailable" + "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" ] }, - "source": { + "severity": { "type": "string", "enum": [ - "none", - "user_supplied", - "official_mirror", - "github_cache", - "issue_quality", - "missing" + "blocker", + "reducer", + "context" ] }, - "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" + "detail": { + "type": "string" + } + }, + "required": [ + "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" + ] + }, + "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" ] }, - "observedPullRequestScenarios": { + "scoreBlockers": { + "type": "array", + "items": { + "type": "string" + } + }, + "riskBreakdown": { "type": "object", "properties": { - "approvedOrMergeable": { + "queueBurden": { + "type": "string", + "enum": [ + "low", + "medium", + "high", + "critical" + ] + }, + "queueBurdenScore": { "type": "number" }, - "stale": { + "duplicateClusters": { "type": "number" }, - "closed": { + "highRiskDuplicateClusters": { "type": "number" }, - "draft": { + "closedPullRequestRate": { "type": "number" }, - "blocked": { + "openPullRequests": { "type": "number" }, - "maintainerLane": { + "credibility": { "type": "number" }, - "notes": { - "type": "array", - "items": { - "type": "string" - } + "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" + ] + }, + "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 + ] + }, + "detail": { + "type": "string" + } + }, + "required": [ + "enabled", + "detail" + ] + }, + "branch": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "baseRef": { + "type": "string" + }, + "headSha": { + "type": "string" + }, + "pendingCommitCount": { + "type": "number" } }, "required": [ - "approvedOrMergeable", - "stale", - "closed", - "draft", - "blocked", - "maintainerLane", - "notes" + "pendingCommitCount" ] }, - "githubBranchStatus": { + "changedFiles": { "type": "object", "properties": { - "source": { - "type": "string", - "enum": [ - "cached_github_data" - ] + "total": { + "type": "number" }, - "status": { - "type": "string", - "enum": [ - "approved", - "failing_checks", - "needs_author", - "blocked", - "pending_review", - "no_pr", - "unknown" - ] + "added": { + "type": "number" }, - "pullNumber": { + "modified": { "type": "number" }, - "title": { - "type": "string" + "deleted": { + "type": "number" }, - "reviewDecision": { - "type": "string", - "nullable": true + "renamed": { + "type": "number" }, - "mergeableState": { - "type": "string", - "nullable": true + "binary": { + "type": "number" }, - "notes": { + "paths": { "type": "array", "items": { "type": "string" @@ -5929,242 +6147,108 @@ } }, "required": [ - "source", - "status", - "notes" + "total", + "added", + "modified", + "deleted", + "renamed", + "binary", + "paths" ] }, - "branchEligibility": { + "testEvidence": { "type": "object", "properties": { - "required": { - "type": "boolean" - }, - "status": { - "type": "string", - "enum": [ - "eligible", - "ineligible", - "unknown", - "not_required" - ] - }, - "evidence": { - "type": "string", - "enum": [ - "provided", - "missing" - ] - }, - "source": { + "level": { "type": "string", "enum": [ - "github_metadata", - "local_metadata", - "registry", - "user_supplied", - "missing" + "test_files", + "validation_commands", + "both", + "none" ] }, - "reason": { - "type": "string" - }, - "checkedAt": { - "type": "string" + "testFileCount": { + "type": "number" }, - "stale": { - "type": "boolean" + "passedValidationCount": { + "type": "number" }, - "warnings": { + "commands": { "type": "array", "items": { - "type": "string" + "type": "object", + "properties": { + "command": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "passed", + "failed", + "not_run" + ] + }, + "summary": { + "type": "string" + } + }, + "required": [ + "command", + "status" + ] } } }, "required": [ - "required", - "status", - "evidence", - "source", - "stale", - "warnings" + "level", + "testFileCount", + "passedValidationCount", + "commands" ] }, - "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": { + "linkedIssues": { "type": "array", "items": { - "$ref": "#/components/schemas/Finding" + "type": "number" } }, - "maintainerFit": { + "baseFreshness": { "type": "object", "properties": { - "recommendation": { - "type": "string", - "enum": [ - "pursue", - "cleanup_first", - "maintainer_lane", - "avoid_for_now", - "unknown" - ] - }, - "reviewBurden": { - "type": "string", - "enum": [ - "low", - "medium", - "high" - ] - }, - "role": { + "status": { "type": "string", "enum": [ - "outside_contributor", - "repo_maintainer", - "org_member", - "collaborator", - "owner", + "fresh", + "stale", + "possibly_stale", "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" - ] + "baseRef": { + "type": "string" }, - "linkedIssuePolicy": { - "type": "string", - "enum": [ - "required", - "preferred", - "optional" - ] + "baseSha": { + "type": "string" }, - "issueDiscoveryPolicy": { - "type": "string", - "enum": [ - "encouraged", - "neutral", - "discouraged" - ] + "headSha": { + "type": "string" }, - "matchedWantedPaths": { - "type": "array", - "items": { - "type": "string" - } + "mergeBaseSha": { + "type": "string" }, - "matchedBlockedPaths": { - "type": "array", - "items": { - "type": "string" - } + "remoteTrackingSha": { + "type": "string" }, - "preferredLabelHits": { - "type": "array", - "items": { - "type": "string" - } + "changedFileCount": { + "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" - ] - } + "testFileCount": { + "type": "number" }, - "publicNextSteps": { - "type": "array", - "items": { - "type": "string" - } + "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": { @@ -6979,197 +6979,49 @@ "type": "boolean" }, "publicSurface": { - "type": "string", - "enum": [ - "off", - "comment_and_label", - "comment_only", - "label_only" - ] - }, - "includeMaintainerAuthors": { - "type": "boolean" - }, - "requireLinkedIssue": { - "type": "boolean" - }, - "backfillEnabled": { - "type": "boolean" - }, - "privateTrustEnabled": { - "type": "boolean" - }, - "createdAt": { - "type": "string", - "nullable": true - }, - "updatedAt": { - "type": "string", - "nullable": true - } - }, - "required": [ - "repoFullName", - "commentMode", - "publicSignalLevel", - "checkRunMode", - "checkRunDetailLevel", - "autoLabelEnabled", - "gittensorLabel", - "createMissingLabel", - "publicSurface", - "includeMaintainerAuthors", - "requireLinkedIssue", - "backfillEnabled", - "privateTrustEnabled" - ] - }, - "InstallationHealth": { - "type": "object", - "properties": { - "installationId": { - "type": "number" - }, - "accountLogin": { - "type": "string" - }, - "repositorySelection": { - "type": "string", - "nullable": true - }, - "installedReposCount": { - "type": "number" - }, - "registeredInstalledCount": { - "type": "number" - }, - "status": { - "type": "string", - "enum": [ - "healthy", - "needs_attention", - "broken" - ] - }, - "missingPermissions": { - "type": "array", - "items": { - "type": "string" - } - }, - "missingEvents": { - "type": "array", - "items": { - "type": "string" - } - }, - "permissions": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "events": { - "type": "array", - "items": { - "type": "string" - } - }, - "checkedAt": { - "type": "string" - }, - "errorSummary": { - "type": "string", - "nullable": true - }, - "requiredPermissions": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "requiredEvents": { - "type": "array", - "items": { - "type": "string" - } - }, - "optionalVisibleEvents": { - "type": "array", - "items": { - "type": "string" - } - }, - "permissionRemediation": { - "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" - ] - } - }, - "eventRemediation": { - "type": "array", - "items": { - "type": "object", - "properties": { - "event": { - "type": "string" - }, - "ok": { - "type": "boolean" - }, - "action": { - "type": "string" - } - }, - "required": [ - "event", - "ok", - "action" - ] - } + "type": "string", + "enum": [ + "off", + "comment_and_label", + "comment_only", + "label_only" + ] }, - "repairSteps": { - "type": "array", - "items": { - "type": "string" - } + "includeMaintainerAuthors": { + "type": "boolean" + }, + "requireLinkedIssue": { + "type": "boolean" + }, + "backfillEnabled": { + "type": "boolean" + }, + "privateTrustEnabled": { + "type": "boolean" + }, + "createdAt": { + "type": "string", + "nullable": true + }, + "updatedAt": { + "type": "string", + "nullable": true } }, "required": [ - "installationId", - "accountLogin", - "installedReposCount", - "registeredInstalledCount", - "status", - "missingPermissions", - "missingEvents", - "permissions", - "events", - "checkedAt" + "repoFullName", + "commentMode", + "publicSignalLevel", + "checkRunMode", + "checkRunDetailLevel", + "autoLabelEnabled", + "gittensorLabel", + "createMissingLabel", + "publicSurface", + "includeMaintainerAuthors", + "requireLinkedIssue", + "backfillEnabled", + "privateTrustEnabled" ] }, "InstallationRepair": { @@ -7281,50 +7133,232 @@ "affectedRepoCount": { "type": "number" }, - "requiredPermissions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "permission": { - "type": "string" - }, - "requiredAccess": { - "type": "string" - }, - "missing": { - "type": "boolean" - }, - "optional": { - "type": "boolean" - } - }, - "required": [ - "permission", - "requiredAccess", - "missing", - "optional" - ] - } + "requiredPermissions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "permission": { + "type": "string" + }, + "requiredAccess": { + "type": "string" + }, + "missing": { + "type": "boolean" + }, + "optional": { + "type": "boolean" + } + }, + "required": [ + "permission", + "requiredAccess", + "missing", + "optional" + ] + } + }, + "summary": { + "type": "string" + }, + "action": { + "type": "string" + } + }, + "required": [ + "mode", + "enabled", + "affectedRepoCount", + "requiredPermissions", + "summary", + "action" + ] + } + }, + "eventDiagnostics": { + "type": "array", + "items": { + "type": "object", + "properties": { + "event": { + "type": "string" + }, + "missing": { + "type": "boolean" + }, + "optional": { + "type": "boolean" + }, + "summary": { + "type": "string" + }, + "action": { + "type": "string" + } + }, + "required": [ + "event", + "missing", + "optional", + "summary", + "action" + ] + } + }, + "repairSteps": { + "type": "array", + "items": { + "type": "string" + } + }, + "refresh": { + "type": "object", + "properties": { + "method": { + "type": "string", + "enum": [ + "POST" + ] + }, + "path": { + "type": "string" + }, + "lastCheckedAt": { + "type": "string" + } + }, + "required": [ + "method", + "path", + "lastCheckedAt" + ] + }, + "refreshed": { + "type": "boolean" + } + }, + "required": [ + "generatedAt", + "installation", + "installedRepos", + "requiredPermissions", + "optionalPermissions", + "requiredEvents", + "optionalEvents", + "modeImpacts", + "eventDiagnostics", + "repairSteps", + "refresh" + ] + }, + "InstallationHealth": { + "type": "object", + "properties": { + "installationId": { + "type": "number" + }, + "accountLogin": { + "type": "string" + }, + "repositorySelection": { + "type": "string", + "nullable": true + }, + "installedReposCount": { + "type": "number" + }, + "registeredInstalledCount": { + "type": "number" + }, + "status": { + "type": "string", + "enum": [ + "healthy", + "needs_attention", + "broken" + ] + }, + "missingPermissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "missingEvents": { + "type": "array", + "items": { + "type": "string" + } + }, + "permissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "events": { + "type": "array", + "items": { + "type": "string" + } + }, + "checkedAt": { + "type": "string" + }, + "errorSummary": { + "type": "string", + "nullable": true + }, + "requiredPermissions": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "requiredEvents": { + "type": "array", + "items": { + "type": "string" + } + }, + "optionalVisibleEvents": { + "type": "array", + "items": { + "type": "string" + } + }, + "permissionRemediation": { + "type": "array", + "items": { + "type": "object", + "properties": { + "permission": { + "type": "string" + }, + "requiredAccess": { + "type": "string" }, - "summary": { + "currentAccess": { "type": "string" }, + "ok": { + "type": "boolean" + }, "action": { "type": "string" } }, "required": [ - "mode", - "enabled", - "affectedRepoCount", - "requiredPermissions", - "summary", + "permission", + "requiredAccess", + "currentAccess", + "ok", "action" ] } }, - "eventDiagnostics": { + "eventRemediation": { "type": "array", "items": { "type": "object", @@ -7332,24 +7366,16 @@ "event": { "type": "string" }, - "missing": { - "type": "boolean" - }, - "optional": { + "ok": { "type": "boolean" }, - "summary": { - "type": "string" - }, "action": { "type": "string" } }, "required": [ "event", - "missing", - "optional", - "summary", + "ok", "action" ] } @@ -7359,45 +7385,19 @@ "items": { "type": "string" } - }, - "refresh": { - "type": "object", - "properties": { - "method": { - "type": "string", - "enum": [ - "POST" - ] - }, - "path": { - "type": "string" - }, - "lastCheckedAt": { - "type": "string" - } - }, - "required": [ - "method", - "path", - "lastCheckedAt" - ] - }, - "refreshed": { - "type": "boolean" } }, "required": [ - "generatedAt", - "installation", - "installedRepos", - "requiredPermissions", - "optionalPermissions", - "requiredEvents", - "optionalEvents", - "modeImpacts", - "eventDiagnostics", - "repairSteps", - "refresh" + "installationId", + "accountLogin", + "installedReposCount", + "registeredInstalledCount", + "status", + "missingPermissions", + "missingEvents", + "permissions", + "events", + "checkedAt" ] }, "RepoSettingsPreview": { @@ -7616,7 +7616,8 @@ "bot_author", "maintainer_author", "miner_detection_unavailable", - "not_official_gittensor_miner" + "not_official_gittensor_miner", + null ] }, "actions": { @@ -8261,45 +8262,233 @@ "blockedRepos": { "type": "number" }, - "partialRepos": { + "partialRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "cappedRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "staleRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "rateLimitedRepos": { + "type": "array", + "items": { + "type": "string" + } + }, + "nextRecoverableAt": { + "type": "string", + "nullable": true + } + }, + "required": [ + "status", + "repoCount", + "completeRepos", + "degradedRepos", + "blockedRepos", + "partialRepos", + "cappedRepos", + "staleRepos", + "rateLimitedRepos" + ] + }, + "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" } }, - "cappedRepos": { + "waitingForRateLimitRepos": { "type": "array", "items": { "type": "string" } }, - "staleRepos": { + "repositories": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/RepoSyncState" } }, - "rateLimitedRepos": { + "segments": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/RepoSyncSegment" } }, - "nextRecoverableAt": { - "type": "string", - "nullable": true + "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": [ - "status", - "repoCount", - "completeRepos", - "degradedRepos", - "blockedRepos", - "partialRepos", - "cappedRepos", - "staleRepos", - "rateLimitedRepos" + "generatedAt", + "signalFidelity", + "freshnessSlo", + "coreSignalFidelity", + "upstreamDrift", + "historyCoverage", + "refreshingRepos", + "waitingForRateLimitRepos", + "repositories", + "segments", + "githubTotals", + "pullRequestDetailSync", + "installations", + "rateLimits" ] }, "CoreSignalFidelity": { @@ -8365,6 +8554,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": { @@ -8427,124 +8701,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", @@ -8552,6 +8713,18 @@ "blocking" ] }, + "status": { + "type": "string", + "enum": [ + "open", + "acknowledged", + "resolved", + "ignored" + ] + }, + "summary": { + "type": "string" + }, "affectedAreas": { "type": "array", "items": { @@ -8566,26 +8739,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": { @@ -8650,194 +8841,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": { diff --git a/src/openapi/schemas.ts b/src/openapi/schemas.ts index e302322e08..4233e41dfe 100644 --- a/src/openapi/schemas.ts +++ b/src/openapi/schemas.ts @@ -761,8 +761,8 @@ export const InstallationRepairSchema = z }), }), ), - requiredPermissions: z.record(z.string()), - optionalPermissions: z.record(z.string()), + requiredPermissions: z.record(z.string(), z.string()), + optionalPermissions: z.record(z.string(), z.string()), requiredEvents: z.array(z.string()), optionalEvents: z.array(z.string()), modeImpacts: z.array( diff --git a/test/unit/backfill.test.ts b/test/unit/backfill.test.ts index 04d198c9cb..750a136857 100644 --- a/test/unit/backfill.test.ts +++ b/test/unit/backfill.test.ts @@ -413,6 +413,47 @@ describe("GitHub backfill", () => { ); }); + it("counts comment-only and label-only repair surfaces separately", async () => { + const env = createTestEnv(); + await upsertRepositoryFromGitHub(env, { name: "comments", full_name: "JSONbored/comments", private: true, owner: { login: "JSONbored" } }, 124); + await upsertRepositoryFromGitHub(env, { name: "labels", full_name: "JSONbored/labels", private: true, owner: { login: "JSONbored" } }, 124); + await upsertRepositorySettings(env, { + repoFullName: "JSONbored/comments", + commentMode: "detected_contributors_only", + publicSurface: "comment_only", + autoLabelEnabled: false, + checkRunMode: "off", + }); + await upsertRepositorySettings(env, { + repoFullName: "JSONbored/labels", + commentMode: "off", + publicSurface: "label_only", + autoLabelEnabled: true, + checkRunMode: "off", + }); + + const repair = await buildInstallationRepairDiagnostics(env, { + installationId: 124, + accountLogin: "JSONbored", + repositorySelection: "selected", + installedReposCount: 2, + registeredInstalledCount: 0, + status: "needs_attention", + missingPermissions: ["issues"], + missingEvents: [], + permissions: { metadata: "read", pull_requests: "read" }, + events: ["issues", "issue_comment", "pull_request", "repository"], + checkedAt: "2026-05-28T00:00:00.000Z", + }); + + expect(repair.modeImpacts).toEqual( + expect.arrayContaining([ + expect.objectContaining({ mode: "comment", enabled: true, affectedRepoCount: 1, requiredPermissions: [expect.objectContaining({ permission: "issues", missing: true })] }), + expect.objectContaining({ mode: "label", enabled: true, affectedRepoCount: 1, requiredPermissions: [expect.objectContaining({ permission: "issues", missing: true })] }), + ]), + ); + }); + it("refreshes installation health from live GitHub App metadata", async () => { const env = createTestEnv({ GITHUB_APP_PRIVATE_KEY: await generatePrivateKeyPem() }); await seedRegisteredRepo(env);