feat(mcp): gittensory_validate_linked_issue - #622
Conversation
…alidator Adds an MCP tool that reports, before opening a PR, whether linking a given issue will actually earn the standard linked-issue scoring multiplier — is it open, valid, single-owner (uncontested), and solvable by the planned PR — with the precise blocking reason when it will not. Metadata only; no GitHub writes. - scoring/preview: export projectLinkedIssueMultiplierForPlannedSolve, reusing the existing decideLinkedIssueMultiplier eligibility rule (the same logic buildScorePreview uses) for the projected "this PR solves the issue" scenario. - engine: new buildLinkedIssueValidation builder composing buildIssueDiscoveryLifecycleReport (lifecycle/solvability) with the projected multiplier decision; detects closed, duplicate/invalid, already-solved, and contested-by-another-PR targets. Public-safe via sanitizePublicComment; surfaces only applies/does-not-apply + canonical status, never the raw multiplier value. - mcp(worker): register gittensory_validate_linked_issue with input + output schema. - api: POST /v1/repos/:owner/:repo/validate-linked-issue backing the local bin tool. - mcp(local bin): proxy the new tool to the API route. - tests: builder unit coverage (apply, closed, duplicate/invalid, solved, self-solved loop, contested, own-PR-ignored, not-found, public-safe), MCP structured-content (apply + uncached), and API route success/invalid/forbidden. npm run validate green at 97%+ branch coverage. Fixes JSONbored#546 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 8 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. What changed
Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
Fixes #546
What
Adds
gittensory_validate_linked_issue, an MCP tool that reports — before opening a PR — whether linking a given issue will actually earn the standard linked-issue scoring multiplier. It answers: is the issue open, valid, single-owner (uncontested), and solvable by the planned PR? When the multiplier won't apply, it returns the precise blocking reason. Metadata only; no GitHub writes.This stops miners from chasing the linked-issue multiplier blind on targets that won't qualify (closed, duplicate/invalid, already solved, or contested by another open PR).
How
src/scoring/preview.ts— exportsprojectLinkedIssueMultiplierForPlannedSolve, which reusesdecideLinkedIssueMultiplier(the exact eligibility rulebuildScorePreviewuses) for the projected "this PR becomes the merged solver" scenario, so the validator stays consistent with the scoring engine.src/signals/engine.ts— newbuildLinkedIssueValidationbuilder composingbuildIssueDiscoveryLifecycleReport(lifecycle/solvability truth) with the projected multiplier decision. It flags closed, duplicate/invalid, already-solved, and contested-by-another-contributor's-PR targets, and excludes the contributor's own open PR from the contention check.sanitizePublicComment(fail-closed). The output surfaces onlymultiplierWouldApply+ the canonicalmultiplierStatus; the raw numeric multiplier value stays private.src/mcp/server.ts— registers the tool with aninputSchemaandoutputSchema.src/api/routes.ts—POST /v1/repos/:owner/:repo/validate-linked-issuebacking the local CLI tool.packages/gittensory-mcp/bin/gittensory-mcp.js— exposes the tool, proxying to the API route.Output boundaries
Public-safe; metadata only, no writes. Returns applies / does-not-apply + the canonical status and a blocking reason — never the raw multiplier value or other contributors' private context.
Tests
test/unit/linked-issue-validation.test.ts— would-apply, closed, duplicate/invalid, solved (merged), self-solved loop, contested (other open PR), own-PR-ignored, not-found, plus forbidden-term assertions on all output.test/unit/mcp-output-schemas.test.ts— output-schema discovery + structured-content calls for both would-apply and uncached cases.test/integration/api.test.ts— route success, invalid body (400), session-forbidden (403).npm run validate(typecheck + coverage) is green at the 97%+ branch threshold;build:mcp,test:mcp-pack,test:workers, andui:openapi:checkalso pass.🤖 Generated with Claude Code