Skip to content

feat(scoring): surface the non-code line cap in the score breakdown#1978

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
jaso0n0818:feat/score-breakdown-dim
Jul 1, 2026
Merged

feat(scoring): surface the non-code line cap in the score breakdown#1978
JSONbored merged 1 commit into
JSONbored:mainfrom
jaso0n0818:feat/score-breakdown-dim

Conversation

@jaso0n0818

@jaso0n0818 jaso0n0818 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Adds a nonCodeLineCap component to the score-breakdown explanation — a sibling of the open-PR / open-issue / merged-history floor breakdowns — that surfaces the upstream non-code line scoring cap (MAX_LINES_SCORED_FOR_NON_CODE_EXT, default 300). Non-code token score beyond that many changed non-code lines is not scored, so a docs/config/data-heavy PR can silently lose non-code contribution the breakdown otherwise never explains.

Why

explainScoreBreakdown already surfaces every scored multiplier and every history/spam floor (open-PR, open-issue, merged-history), but not this cap. A miner adding a large non-code change has no visibility into why non-code lines past the cap add no score. This closes that gap with the same actionable-lever shape the other breakdowns use.

Behavior

  • neutral (zero leverage) when no non-code line count is observed for the preview.
  • neutral when the observed non-code line count is within the cap.
  • reduced when it exceeds the cap, with a move-substantive-logic-into-source lever.

Changes

  • Exposes nonCodeLineCap and nonCodeLinesObserved on the score-preview gates — both are already computed inside computeScoreCore (via applyNonCodeLineCap); this only surfaces them, it does not change any scoring math.
  • Adds nonCodeCapBreakdown in score-breakdown.ts, wired into explainScoreBreakdown.
  • Regenerates the openapi schema to match the new gate fields.

No linked issue

No linked issue: this is a maintenance change that surfaces an existing upstream scoring cap in the breakdown — a pure projection over values already computed in computeScoreCore — so there is no tracking issue to link.

Tests

test/unit/score-breakdown.test.ts covers all three branches (unobserved / within-cap / over-cap) plus the component-name contract. Scoring, preview, and openapi-contract suites are green; the change is a pure projection over already-computed values.

@jaso0n0818 jaso0n0818 requested a review from JSONbored as a code owner July 1, 2026 02:32
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jul 1, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 1, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-01 07:04:04 UTC

5 files · 1 AI reviewer · no blockers · readiness 55/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change cleanly threads the existing non-code line cap into preview gates, OpenAPI, and the public breakdown without changing scoring math. The new breakdown handles the three visible states directly: unobserved, within cap, and over cap, and the unit test exercises those branches through the production preview builder rather than a fabricated breakdown object. I do not see a reachable correctness break in the provided diff.

Nits — 7 non-blocking
  • nit: test/unit/score-breakdown.test.ts:126 uses the contributorLogin value "miner", which is unnecessary domain leakage in a public-facing test fixture; change it to a neutral fixture name like "contributor".
  • nit: src/services/score-breakdown.ts:281 has a long explanatory comment that duplicates the function body and PR description; keep the source comment shorter so future behavior changes do not leave stale rationale behind.
  • nit: src/services/score-breakdown.ts:300 assigns leverageScore 5 for the within-cap neutral case while the unobserved neutral case is 0; if that distinction is intentional, add a small assertion or comment explaining why a neutral, no-action state still contributes nonzero leverage.
  • test/unit/score-breakdown.test.ts:126 should use a neutral contributor fixture name to avoid carrying domain-specific vocabulary into tests.
  • src/services/score-breakdown.ts:281 can be trimmed to a concise note that this is a projection of the upstream non-code line cap, leaving the branch behavior to the code and tests.
  • 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 ✅ No-issue rationale PR body explains why no issue is linked.
Related work ⚠️ 2 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:M; no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR; address the blocker before review.
Contributor workload ✅ 10/10 Author activity: 620 registered-repo PR(s), 382 merged, 6 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jaso0n0818; Gittensor profile; 620 PR(s), 6 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: jaso0n0818
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 620 PR(s), 6 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (PR #1984)
  • Related work: Titles/paths share 6 meaningful terms. (PR #1935, PR #1984)
Contributor next steps
  • 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

@gittensory-orb gittensory-orb Bot added gittensor Gittensor contributor context gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. labels Jul 1, 2026
Add a nonCodeLineCap breakdown component (sibling of the open-PR /
open-issue / merged-history floor breakdowns) that surfaces the upstream
MAX_LINES_SCORED_FOR_NON_CODE_EXT cap: non-code token score beyond that
many changed non-code lines is not scored. It reads neutral unless the
observed non-code line count actually exceeds the cap.

Exposes nonCodeLineCap and nonCodeLinesObserved on the score-preview
gates (openapi schema regenerated to match).
@dosubot dosubot Bot added the lgtm Approved by a maintainer. label Jul 1, 2026
@JSONbored JSONbored merged commit 0f440cf into JSONbored:main Jul 1, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jul 1, 2026
@github-actions github-actions Bot mentioned this pull request Jul 1, 2026
12 tasks
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 1.25x multiplier. gittensor Gittensor contributor context lgtm Approved by a maintainer. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants