Skip to content

fix(scoring): wire trusted open issue counts#940

Merged
JSONbored merged 4 commits into
mainfrom
codex/propose-fix-for-open-issue-spam-gate
Jun 21, 2026
Merged

fix(scoring): wire trusted open issue counts#940
JSONbored merged 4 commits into
mainfrom
codex/propose-fix-for-open-issue-spam-gate

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • A recent scoring change introduced an openIssueCount gate but left openIssueCount optional in score-preview inputs, allowing production preview paths to default it to 0 and bypass the open-issue spam gate.
  • Trusted contributor/repo open-issue counts are already available in cached outcome data and should be used server-side rather than trusting caller-supplied input.

Description

  • Derive openIssueCount server-side for REST preview endpoints and explain-breakdown by fetching contributor issues and computing the repo-specific open-issue count via contributorOpenIssueCount and passing it into buildScorePreview (src/api/routes.ts).
  • Apply the same server-side derivation to MCP preview paths and pass openIssueCount into the MCP score-preview pipeline (src/mcp/server.ts).
  • Wire trusted cached counts from ContributorOutcomeHistory into local-branch and reward-risk preview inputs by populating openIssueCount from repoOutcome?.openIssues ?? outcomeHistory.totals.openIssues (src/signals/local-branch.ts, src/signals/reward-risk.ts).
  • Add a unit regression test that constructs an issue-heavy outcome history and verifies openIssueCount is set, the openIssueMultiplier becomes 0, and the open_issue_threshold blocker is emitted (test/unit/local-branch.test.ts).

Testing

  • Ran typecheck with npx tsc --noEmit which succeeded without errors.
  • Ran unit tests with npx vitest run test/unit/local-branch.test.ts test/unit/scoring.test.ts --reporter=dot and the suite passed (all tests in the invoked files passed).
  • Ran repository lint/check git diff --check which reported no whitespace/diff issues.

Codex Task

@dosubot dosubot Bot added the size:M label Jun 20, 2026
@ghost ghost added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 20, 2026
@ghost

ghost commented Jun 20, 2026

Copy link
Copy Markdown

❌ Closed by the review gate

Recommend CLOSE — A required check is failing. CI failures are closed, not iterated in place — fix it and open a new focused PR. (your PR — not auto-closed; your call.)
🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

⛔ Maintainer review — Blockers found

Reviewed 5 changed file(s) — two independent AI reviewers, synthesized. 🛠️ Request changes. Address the suggestions below before merging.

Merge readiness: ❌ CI is red — approval withheld until it's green. Failing: see the checks tab.

Summary

The change introduces open‑issue counting into scoring previews, which is a sensible feature, but the diff breaks compilation and type‑checking. The new helper contributorOpenIssueCount is used without importing the required listContributorIssues function in both the API routes and MCP server files. Additionally, the ScoreInput type (used by buildScorePreview) does not appear to include the newly added openIssueCount field, which will cause TypeScript errors in multiple places (routes, MCP server, private context‑risk, local‑branch). These concrete defects prevent the code from building and the test suite from passing, so the PR cannot be merged as‑is. The added logic itself does not introduce security or privacy concerns, but the compilation blockers must be fixed first.

🛑 Hard blockers — must fix before merge

  • Missing import for listContributorIssues in src/api/routes.ts.
  • Missing import for listContributorIssues in src/mcp/server.ts.
  • openIssueCount is not defined on the ScoreInput type used by buildScorePreview, leading to TypeScript compilation errors.
  • Missing tests for new behavior in API and MCP routes (src/api/routes.ts and src/mcp/server.ts) - new behavior requires tests per project context.

💡 Nits — non-blocking, optional

  • Duplicate definition of contributorOpenIssueCount could be refactored into a shared utility.
  • Variable naming could be more explicit, e.g., repoFullNameLower.
  • Import listContributorIssues from its module in src/api/routes.ts and src/mcp/server.ts.
  • Add openIssueCount?: number (or required if appropriate) to the ScoreInput interface/type used by buildScorePreview.
  • Consider extracting the duplicated contributorOpenIssueCount helper to a shared utility module to avoid code duplication.
  • Update any related documentation/comments to mention the new open‑issue gate.
  • Run the full test suite after fixing the above to ensure no regressions.
  • Consider extracting the duplicated contributorOpenIssueCount helper function into a shared utility to avoid duplication.
  • Add tests for API and MCP routes to verify openIssueCount is correctly fetched and passed to buildScorePreview.
  • Consider extracting the duplicated contributorOpenIssueCount helper into a shared utility to avoid future inconsistencies.
  • Ensure listContributorIssues has SSRF guards and response body bounds (though not changed here, verify existing implementation).
    This repo uses one-shot review: a rejected PR is closed, not iterated in place. Please address the above and open a new focused PR.

@ghost ghost added the reviewbot-review label Jun 20, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@ghost

ghost commented Jun 20, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #940 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 20, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 5ecce68 Commit Preview URL

Branch Preview URL
Jun 20 2026, 04:36 PM

@JSONbored JSONbored self-assigned this Jun 20, 2026
@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.60%. Comparing base (334edcd) to head (6f6a9ec).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/api/routes.ts 88.88% 1 Missing ⚠️
src/mcp/server.ts 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #940      +/-   ##
==========================================
- Coverage   96.61%   96.60%   -0.02%     
==========================================
  Files         110      110              
  Lines       15058    15069      +11     
  Branches     5441     5445       +4     
==========================================
+ Hits        14549    14558       +9     
- Misses        105      107       +2     
  Partials      404      404              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit c18d525 into main Jun 21, 2026
17 of 19 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-open-issue-spam-gate branch June 21, 2026 06:14
@ghost ghost removed the reviewbot-review label Jun 21, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend close (ci_red) — held for your decision

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant