Skip to content

feat(scoring): model upstream review-collateral and non-code caps (Fixes #809) - #916

Closed
kiannidev wants to merge 6 commits into
JSONbored:mainfrom
kiannidev:feat/issue-809-upstream-constants
Closed

feat(scoring): model upstream review-collateral and non-code caps (Fixes #809)#916
kiannidev wants to merge 6 commits into
JSONbored:mainfrom
kiannidev:feat/issue-809-upstream-constants

Conversation

@kiannidev

@kiannidev kiannidev commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER, MAX_LINES_SCORED_FOR_NON_CODE_EXT, and DEFAULT_ISSUE_DISCOVERY_SHARE to the scoring constant snapshot so upstream sync no longer drops them as unmodeled drift.
  • Models open-PR review-collateral in score preview: exposes reviewCollateralMultiplier and applies it to effective collateralFraction (OPEN_PR_COLLATERAL_PERCENT × multiplier), matching upstream's calculate_review_collateral_multiplier.
  • Caps non-code token contribution when nonCodeLines exceeds the upstream line cap (wired from local-branch analysis); registry normalization now defaults missing issue_discovery_share from DEFAULT_ISSUE_DISCOVERY_SHARE.

Fixes #809

Test plan

  • npm run typecheck
  • npm test -- test/unit/scoring.test.ts test/unit/registry.test.ts
  • npm run ui:openapi (OpenAPI schema includes reviewCollateralMultiplier)
  • CI green on PR

 JSONbored#809)

Pull MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER, MAX_LINES_SCORED_FOR_NON_CODE_EXT,
and DEFAULT_ISSUE_DISCOVERY_SHARE into the scoring snapshot and apply them in
preview collateral math, non-code line capping, and registry normalization defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev
kiannidev requested a review from JSONbored as a code owner June 19, 2026 01:01
@dosubot dosubot Bot added the size:M label Jun 19, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@ghost

ghost commented Jun 19, 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 #916 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

This comment has been minimized.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.60%. Comparing base (2973ff7) to head (022d306).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #916   +/-   ##
=======================================
  Coverage   96.60%   96.60%           
=======================================
  Files         109      109           
  Lines       14914    14924   +10     
  Branches     5390     5392    +2     
=======================================
+ Hits        14408    14418   +10     
  Misses        104      104           
  Partials      402      402           

☔ 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.

…Nbored#916)

Export a typed DEFAULT_ISSUE_DISCOVERY_SHARE constant and assert registry
normalization uses it when issue_discovery_share is missing or invalid.

Co-authored-by: Cursor <cursoragent@cursor.com>
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 19, 2026
@ghost

ghost commented Jun 19, 2026

Copy link
Copy Markdown

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

⛔ Maintainer review — Not merged

Reviewed 9 changed file(s) — two independent AI reviewers, synthesized.

ℹ️ This PR conflicts with main and can't be merged as-is. Conflicting file(s): apps/gittensory-ui/public/openapi.json, src/api/routes.ts, src/scoring/model.ts, src/scoring/preview.ts, src/signals/local-branch.ts, test/unit/scoring.test.ts. Resolve the conflict(s) and open a fresh PR.

Merge readiness: ✅ Mergeable (conflicting) · all CI checks green/neutral/skipped.

Summary

The change correctly adds support for upstream review collateral multiplier, non‑code line capping, and default issue‑discovery share. Types, schemas, validation, and tests are updated accordingly. No correctness or security issues are introduced, and all CI checks pass.

💡 Nits — non-blocking, optional

  • Add documentation for new constants.
  • Update README to reflect new scoring inputs.
  • Consider adding JSDoc comments for the new constants (MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER, MAX_LINES_SCORED_FOR_NON_CODE_EXT) to document their purpose.
  • Update any internal documentation or README that describes scoring model fields to include the new reviewCollateralMultiplier and non‑code line handling.
  • Consider adding a comment explaining the purpose of the DEFAULT_ISSUE_DISCOVERY_SHARE constant in src/scoring/model.ts.
  • Consider adding a comment explaining the purpose of the nonCodeLines field in src/scoring/preview.ts and src/api/routes.ts.
  • Consider adding a comment explaining the purpose of the reviewCollateralMultiplier field in src/scoring/preview.ts and src/api/routes.ts.
  • Consider adding a comment explaining the purpose of the applyNonCodeLineCap function in src/scoring/preview.ts.

This repo uses one-shot review: a rejected PR is closed, not iterated in place. Address the above and open a new focused PR.

Route Viewport Before After
/ desktop before desktop after desktop
mobile before mobile after mobile

Before = production · After = this PR's preview deploy.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

merge conflicts, please resubmit.

@JSONbored JSONbored closed this Jun 20, 2026
@JSONbored JSONbored reopened this Jun 21, 2026
@ghost ghost closed this Jun 21, 2026
@JSONbored JSONbored reopened this Jun 21, 2026
@ghost ghost closed this Jun 21, 2026
@JSONbored JSONbored reopened this Jun 21, 2026
@ghost ghost closed this Jun 21, 2026
@kiannidev

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
Please re-review this PR.
This PR is closed without any reason or feedback...

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(scoring): pull + model upstream constants not currently fetched

2 participants