Skip to content

fix(decision-pack): apply OSS_EMISSION_SHARE to rewardUpside lane shares - #392

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
galuis116:fix/decision-pack-oss-emission-share
Jun 5, 2026
Merged

fix(decision-pack): apply OSS_EMISSION_SHARE to rewardUpside lane shares#392
JSONbored merged 2 commits into
JSONbored:mainfrom
galuis116:fix/decision-pack-oss-emission-share

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Summary

buildRepoDecision (src/services/decision-pack.ts) computed the rewardUpside lane shares straight from the raw registry emissionShare, without the OSS_EMISSION_SHARE (0.9) factor that the canonical lane math applies. directPrShare/issueDiscoveryShare are the analogs of preview.ts laneMath.directPrSlice/issueDiscoverySlice (a split of the OSS mining pool emissionShare * OSS_EMISSION_SHARE), so they were inflated by 1 / 0.9 (~11.1%).

Proof the value was impossible: with issueDiscoveryShare = 0, the old code yielded directPrShare = emissionShare — the repo's entire raw emission — yet the whole OSS mining pool is only emissionShare * 0.9. A single lane's share exceeded the pool it is drawn from. The two surfaces also disagreed: reward-risk.ts builds its rewardUpside from preview.laneMath (correctly OSS-adjusted), while decision-pack re-derived the shares and dropped the factor. Closes #391.

This is not cosmetic: rewardUpside feeds priorityFor (upside = max(directPrShare, issueDiscoveryShare, emissionShare * 0.35) * 1000), which drives priorityScore and the repo ranking (pursueRepos/topActions). The inflation is non-uniform (the emissionShare * 0.35 floor term uses the raw value and is unchanged), so it distorted relative ranking, and the inflated shares were printed verbatim in miner-facing reason strings.

Scope

  • src/services/decision-pack.ts — multiply the two lane shares by OSS_EMISSION_SHARE, threaded from the already-loaded scoringSnapshot.constants (in scope at the buildContributorDecisionPack call site) via resolveOssEmissionShare, defaulting to 0.9 from DEFAULT_SCORING_CONSTANTS for direct callers — same source/semantics as constant(constants, "OSS_EMISSION_SHARE", 0.9) in preview.ts. The raw emissionShare field stays raw (it mirrors laneMath.repoEmissionShare).
  • test/unit/decision-pack.test.ts — fail-on-revert: a new test pins the OSS-adjusted math on both the default-0.9 path and an explicit override and asserts a lane share never exceeds the repo mining pool; two existing assertions updated to the corrected values (issueDiscoveryShare 0.02 → 0.018; downstream priorityScore 40 → 38).

Validation

  • npx tsc --noEmit — clean.
  • npx vitest run (full suite) — 1066 passed, 1 skipped; no other assertions affected.
  • Branch coverage 97.15% (above the 97% gate); decision-pack.ts 97.91% branch.

Safety

  • Behavior-preserving everywhere the constant is its default 0.9 in intent: the only change is correcting an over-count. When a snapshot overrides OSS_EMISSION_SHARE, decision-pack now honors it, matching preview.ts/reward-risk.ts instead of diverging.
  • No public schema / API surface change. The raw emissionShare field is unchanged.

Notes

Scoped to decision-pack, the lone outlier. reward-risk.ts already consumes preview.laneMath and needs no change.

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

@galuis116 this looks ready.

A few notes:

  • Including reward upside in the decision pack fixes the behavior at the right output boundary.
  • The unit test covers the calculation path clearly.
  • No code changes requested from me.

Validation expected:

  • Current green CI is sufficient.

@dosubot dosubot Bot added the lgtm label Jun 5, 2026
@JSONbored
JSONbored merged commit 74f3b70 into JSONbored:main Jun 5, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 5, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 10, 2026
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

No open projects
Status: Done

2 participants