Skip to content

feat(cli): show repo allocation in miner score#1284

Open
bittoby wants to merge 6 commits into
entrius:testfrom
bittoby:feature/miner-score-allocation-breakdown
Open

feat(cli): show repo allocation in miner score#1284
bittoby wants to merge 6 commits into
entrius:testfrom
bittoby:feature/miner-score-allocation-breakdown

Conversation

@bittoby
Copy link
Copy Markdown
Contributor

@bittoby bittoby commented May 14, 2026

Summary

Add a per-repository emission allocation breakdown to gitt miner score.

The JSON output now includes an allocation_breakdown array showing each relevant repository’s emission slice, PR/issue split, miner scores, and allocated rewards. The normal table output also includes a compact repo allocation table.

This makes the final blended reward easier to understand after repo-bounded emission allocation.

Related Issues

Closes #1283

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Testing

  • Tests added/updated
  • Manually tested
.venv/bin/python -m pytest tests/validator/test_blend_emission_pools.py tests/cli/test_miner_score.py
.venv/bin/python -m ruff check gittensor/validator/emission_allocation.py gittensor/cli/miner_commands/score.py tests/validator/test_blend_emission_pools.py tests/cli/test_miner_score.py
.venv/bin/python -m ruff format --check gittensor/validator/emission_allocation.py gittensor/cli/miner_commands/score.py tests/validator/test_blend_emission_pools.py tests/cli/test_miner_score.py
git diff --check

Results:

  • 34 passed
  • Ruff check passed
  • Ruff format check passed
  • Diff whitespace check passed

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label May 14, 2026
@bittoby bittoby force-pushed the feature/miner-score-allocation-breakdown branch from b4b6d30 to a9033c8 Compare May 17, 2026 15:08
@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented May 17, 2026

Result simulation

Setup: dev miner (UID 1), eligible. Repos: octo/repo (emission_share=0.3), octo/lib (emission_share=0.4, issue_discovery_share=0.2). OSS_EMISSION_SHARE=0.9. Miner scores: octo/repo 30 PR (peer 10), octo/lib 20 PR + 4 issue (peer 12 issue).

Non-maintainer miner

Repo Slice PR score Issue score PR reward Issue reward Recycled
octo/repo 0.270000 30.00 0.00 0.202500 0.000000 -
octo/lib 0.360000 20.00 4.00 0.288000 0.018000 -

Reconcile: 0.2025 + 0.288 + 0.018 = 0.5085 = blended_final

Maintainer miner (octo/repo has maintainer_cut=0.5, dev is the registered maintainer — exercises the #1292 carve-out path)

Repo Slice PR score Issue score PR reward Issue reward Maintainer reward Recycled
octo/repo 0.270000 30.00 0.00 0.101250 0.000000 0.135000 -
octo/lib 0.360000 20.00 4.00 0.288000 0.018000 0.000000 -

Reconcile: (0.10125 + 0 + 0.135) + (0.288 + 0.018) = 0.54225 = blended_final

The "Maintainer reward" column auto-appears only when at least one row has a positive maintainer reward; non-maintainer miners see the cleaner 7-column layout.

@bittoby bittoby force-pushed the feature/miner-score-allocation-breakdown branch from a9033c8 to 62fca66 Compare May 17, 2026 18:59
Comment thread gittensor/cli/miner_commands/score.py Outdated


def _round6(x: float) -> float:
return round(x, 6)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for one-liner extracted helper

@bittoby
Copy link
Copy Markdown
Contributor Author

bittoby commented May 22, 2026

Updated PR. Plz re-review @anderdc Thanks.

bittoby and others added 2 commits May 22, 2026 23:11
Copy link
Copy Markdown
Collaborator

@anderdc anderdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move RepoEmissionAllocation out of gittensor/validator/emission_allocation.py into gittensor/classes.py (alongside RepoEvaluation / MinerEvaluation / CachedEvaluation). It's the return type of a public allocator consumed by both the validator and the CLI gitt miner score path, so it belongs with the other cross-module data types, not inline in the allocation logic module. After the move, drop the dataclass, field imports from emission_allocation.py and import RepoEmissionAllocation from gittensor.classes.

Copy link
Copy Markdown
Collaborator

@anderdc anderdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gittensor/cli/miner_commands/score.py:337 imports _build_maintainer_uids_by_repo from gittensor.validator.forward. The leading underscore marks it private but the CLI is now a legitimate cross-module caller — drop the underscore at the definition site (gittensor/validator/forward.py:134) and update the CLI import. Same layering principle as the RepoEmissionAllocation move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add repo allocation breakdown to gitt miner score

2 participants