Skip to content

fix(decision-pack): clamp lane shares to match preview math - #453

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/decision-pack-clamp-lane-shares
Jun 7, 2026
Merged

fix(decision-pack): clamp lane shares to match preview math#453
JSONbored merged 2 commits into
JSONbored:mainfrom
philluiz2323:fix/decision-pack-clamp-lane-shares

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Closes #452.

buildRepoDecision computed rewardUpside lane shares from raw, unclamped registry config, even though its comment claims parity with preview.ts laneMath — which clamps both shares to [0, 1]. Registry config is untrusted and unclamped at ingestion (registry/normalize.ts only checks Number.isFinite), so an out-of-range issueDiscoveryShare > 1 produced a negative directPrShare (and an inflated issue-discovery share / repo priority), contradicting the scoring preview and surfacing a nonsensical negative value in contributor-facing copy (whyThisHelpsFor).

Changes

  • Clamp both emissionShare and issueDiscoveryShare to [0, 1] before the slice math, exactly as preview.ts does (clamp already defined in-file).
  • Add a fixture with issueDiscoveryShare = 1.5 (and -0.5) asserting directPrShare >= 0 and parity with the clamped preview slices.

Verification

  • npx vitest run test/unit/decision-pack.test.ts → 44/44 pass. The new fixture fails against the old code (old directPrShare = -0.0045).

Note: distinct from #391/#392, which fixed the OSS_EMISSION_SHARE factor on these same lines; this is the remaining clamp gap.

buildRepoDecision computed rewardUpside lane shares from raw, unclamped registry config, so an out-of-range issueDiscoveryShare > 1 produced a negative directPrShare (and inflated issue-discovery share/priority), contradicting preview.ts which clamps both shares to [0,1]. Clamp both inputs as preview.ts does.
@philluiz2323
philluiz2323 requested a review from JSONbored as a code owner June 7, 2026 00:58
@dosubot dosubot Bot added the size:S label Jun 7, 2026
@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 7, 2026
@ghost

ghost commented Jun 7, 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 #453 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

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

Reviewed the patch and current CI state. The decision-pack lane-share math now clamps registry shares the same way preview math does, and the regression covers both >1 and negative issue-discovery shares. CI is green. No merge action taken.

@dosubot dosubot Bot added the lgtm label Jun 7, 2026
@JSONbored
JSONbored merged commit 15da91e into JSONbored:main Jun 7, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 7, 2026
@github-actions github-actions Bot mentioned this pull request Jun 7, 2026
12 tasks
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

Development

Successfully merging this pull request may close these issues.

Decision-pack reward lane shares aren't clamped, so out-of-range config yields a negative direct-PR share

2 participants