Skip to content

feat(scoring): surface the review-collateral multiplier in the score breakdown - #1879

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
andriypolanski:feat/scoring-review-collateral-breakdown
Jun 30, 2026
Merged

feat(scoring): surface the review-collateral multiplier in the score breakdown#1879
JSONbored merged 1 commit into
JSONbored:mainfrom
andriypolanski:feat/scoring-review-collateral-breakdown

Conversation

@andriypolanski

@andriypolanski andriypolanski commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

explainScoreBreakdown (src/services/score-breakdown.ts) explains the review penalty multiplier (reviewPenaltyMultiplier) but silently omits the sibling review-collateral multiplier (gates.reviewCollateralMultiplier / gates.collateralFraction), even though upstream models it separately in src/scoring/preview.ts (#916) and it directly affects how much token score is reserved as open-PR collateral when a contributor has CHANGES_REQUESTED reviews on other open PRs.

Miners juggling concurrent work see open-PR pressure explained via openPrMultiplier, yet get no plain-English lever for why their collateral fraction is elevated above the base OPEN_PR_COLLATERAL_PERCENT.

What this adds

A reviewCollateralBreakdown component mirroring the existing reviewPenaltyBreakdown and sibling gate explainers (#1453, #1801):

  • neutral / full when reviewCollateralMultiplier is at the baseline (no elevated collateral from review churn on open PRs).
  • reduced when the multiplier is above 1 — summary names the effective collateral fraction (collateralFraction) and ties it to prior CHANGES_REQUESTED review churn on open PRs.
  • Actionable lever: resolve outstanding change requests on open PRs before opening more concurrent work, or expect tighter collateral on the allowance.

Purely additive explanation over already-computed gate fields; no scoring behavior change.

Files touched (estimated)

File Change
src/services/score-breakdown.ts Add reviewCollateralBreakdown, wire into explainScoreBreakdown
test/unit/score-breakdown.test.ts Baseline, elevated-collateral, and forbidden-term regression cases

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — aim for 100% statements/branches on changed lines in src/services/score-breakdown.ts
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate

Targeted test run:

npx vitest run test/unit/score-breakdown.test.ts --coverage --coverage.include='src/services/score-breakdown.ts'

Notes

Analogues to imitate end-to-end: reviewPenaltyBreakdown and openPrBreakdown in src/services/score-breakdown.ts, plus the merged-history floor tests in test/unit/score-breakdown.test.ts.

@dosubot dosubot Bot added the size:S label Jun 30, 2026
@loopover-orb

loopover-orb Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-06-30 19:14:47 UTC

2 files · 1 AI reviewer · no blockers · readiness 48/100 · CI green · unknown

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change adds a new review-collateral entry to `explainScoreBreakdown` and covers baseline, elevated, capped, and leverage-order behavior in unit tests. The wiring is additive and uses fields already present on `ScorePreviewResult.gates`, then passes the new summary and lever through the existing sanitization path. I do not see a reachable break in the supplied files; the main cleanup is making the public wording less enum-like.

Nits — 5 non-blocking
  • nit: `src/services/score-breakdown.ts:203` and `src/services/score-breakdown.ts:205` expose `CHANGES_REQUESTED` in user-facing prose while the surrounding breakdown copy otherwise uses plain-language review wording.
  • `src/services/score-breakdown.ts:203` should say "requested-changes reviews" or "reviews requesting changes" instead of the raw review-state token, and `test/unit/score-breakdown.test.ts:254` should assert the plain-language wording.
  • `src/services/score-breakdown.ts:199` uses a hard-coded `1.01` materiality threshold; add a short comment explaining the tolerance or compare directly to the baseline if upstream already emits discrete multiplier steps.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:S; no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 91 registered-repo PR(s), 61 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 91 PR(s), 5 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
Contributor next steps
  • Explain no-issue PR.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Fix the blocker.
  • Triage stale or unlinked PRs.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

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

  • Re-run Gittensory review

@dosubot dosubot Bot added the lgtm label Jun 30, 2026
@JSONbored
JSONbored merged commit 4d86ec4 into JSONbored:main Jun 30, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 30, 2026
@andriypolanski
andriypolanski deleted the feat/scoring-review-collateral-breakdown branch July 16, 2026 15:12
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

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants