feat(scoring): model upstream review-collateral and non-code caps (Fi… - #1049
Conversation
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge Review summary Blockers
Nits
Review context
Contributor next steps
Signal definitions
Review detailsGenerated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative. The PR introduces three upstream scoring constants into the model, makes them available to the registry normalization, and updates the preview scoring logic to respect review-collateral multipliers and a line‑count cap for non‑code token scores. The new `DEFAULT_ISSUE_DISCOVERY_SHARE` constant is exported and used as the default for registry payloads. The preview flow now accepts a raw `nonCodeLines` count, applies a proportional cap via `applyNonCodeLineCap`, and returns both `reviewCollateralMultiplier` and the derived `collateralFraction` in the gates. API schemas, OpenAPI definitions, and route validation are extended accordingly, and tests are updated to verify the new behavior. All added fields are wired through the scoring pipeline, and the changes appear type‑safe and logically consistent with the upstream specifications. Blockers
Nits
Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 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.
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1049 +/- ##
=======================================
Coverage 94.76% 94.77%
=======================================
Files 153 153
Lines 18540 18550 +10
Branches 6705 6707 +2
=======================================
+ Hits 17570 17580 +10
Misses 418 418
Partials 552 552 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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>
The prior CI run for 2c8261a was cancelled before test/lint completed, leaving validate red despite the draft timer flake fix. Co-authored-by: Cursor <cursoragent@cursor.com>
d7eba5c to
5be9bad
Compare
ghost
left a comment
There was a problem hiding this comment.
Gittensory approves — the gate is satisfied and CI is green.




Fixes #809
Summary
Pull three upstream scoring constants into the snapshot and apply them in preview math:
MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER— scales open-PR collateral when reviews request changesMAX_LINES_SCORED_FOR_NON_CODE_EXT— caps non-code token contribution when line count exceeds upstream limitDEFAULT_ISSUE_DISCOVERY_SHARE— single source of truth for registry normalization defaultsProblem
Gittensory synced
OPEN_PR_COLLATERAL_PERCENTbut applied it as a flat fraction, ignoring upstream's review-collateral multiplier tied toCHANGES_REQUESTEDcount. Non-code tokens were counted at full weight with no line cap. Registryissue_discovery_sharedefaulted to a local0.5literal instead of the scoring constant.Changes
src/scoring/model.ts— add constants + exportDEFAULT_ISSUE_DISCOVERY_SHAREsrc/scoring/preview.ts—reviewCollateralMultiplier, effectivecollateralFraction,applyNonCodeLineCap(),nonCodeLinesinputsrc/registry/normalize.ts— defaultissueDiscoverySharefromDEFAULT_ISSUE_DISCOVERY_SHAREsrc/signals/local-branch.ts— passnonCodeLinesfrom diff statssrc/api/routes.ts,src/openapi/schemas.ts,apps/gittensory-ui/public/openapi.json—nonCodeLinesinput +reviewCollateralMultipliergate fieldAPI / OpenAPI / MCP contract
nonCodeLines(≥ 0)reviewCollateralMultiplier(number)Validation