Skip to content

fix: add PR context to mirror linked-issue skip warnings#838

Open
polyjeff529 wants to merge 1 commit intoentrius:testfrom
polyjeff529:fix/mirror-linked-issue-skip-warnings-include-pr-context
Open

fix: add PR context to mirror linked-issue skip warnings#838
polyjeff529 wants to merge 1 commit intoentrius:testfrom
polyjeff529:fix/mirror-linked-issue-skip-warnings-include-pr-context

Conversation

@polyjeff529
Copy link
Copy Markdown

## Summary

The eight `bt.logging.warning` calls in `_is_valid_linked_issue`
(`gittensor/validator/oss_contributions/mirror/scoring.py:445-488`)
log only the issue number when the issue is skipped from the
multiplier calculation. In a noisy multi-miner round dozens of
issues from unrelated PRs may all skip on the same condition (e.g.
`self-issue` or `closed too far from merge`), making it impossible
to trace a single skip back to its PR without grepping the
surrounding `_calculate_issue_multiplier` log line and reconstructing
the order.

## Fix

Same observability shape as the recently merged PR #711
("fix: add PR number context to file-content fetch failure
warning"): extend each warning with `PR #{pr_number} in
{repo_full_name}` context derived once at function entry as
`pr_ctx`. No behaviour change — the gate decisions and return values
are identical, only the log surface gains the context.

```python
pr_ctx = f'PR #{pr.pr_number} in {pr.repo_full_name}'

if li.is_transferred:
    bt.logging.warning(f'Skipping linked issue #{li.number} ({pr_ctx}) - transferred')
    return False
# ...same pattern for the other seven skip warnings

The eight ``bt.logging.warning`` calls in ``_is_valid_linked_issue``
(``gittensor/validator/oss_contributions/mirror/scoring.py``) log only
the issue number when an issue is skipped from the multiplier
calculation. In a noisy multi-miner round dozens of issues from
unrelated PRs may all skip on the same condition (e.g. ``self-issue``
or ``closed too far from merge``), making it impossible to trace a
single skip back to its PR without grepping the surrounding
``_calculate_issue_multiplier`` log line and reconstructing the order.

Same observability shape as the recently merged PR entrius#711
("fix: add PR number context to file-content fetch failure warning"):
extend each warning with ``PR #{pr_number} in {repo_full_name}``
context derived once at function entry. No behaviour change — the
gate decisions and return values are identical, only the log surface
gains the context.

Adds ``TestLinkedIssueSkipWarningsCarryPRContext`` covering three of
the eight skip paths (transferred, self-issue, close-window) with a
shared helper that asserts both the PR number and repo are present.
The remaining five paths share the same ``pr_ctx`` string format, so
covering them all would be redundant.

The legacy ``is_valid_issue`` in
``gittensor/validator/oss_contributions/scoring.py`` has the same
observability gap; not bundled here so the diff stays narrowly scoped
to the mirror addition introduced in PR entrius#796 — happy to follow up
with a parity PR if the team wants both.
@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label Apr 28, 2026
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.

1 participant