Skip to content

fix: keep bounty verifier star errors shaped#4881

Open
Asti1982 wants to merge 1 commit into
Scottcjn:mainfrom
Asti1982:codex/harden-bounty-verifier-tests
Open

fix: keep bounty verifier star errors shaped#4881
Asti1982 wants to merge 1 commit into
Scottcjn:mainfrom
Asti1982:codex/harden-bounty-verifier-tests

Conversation

@Asti1982
Copy link
Copy Markdown

Summary

  • keep verify_stars() error responses shaped like successful responses
  • cover the failure path that previously omitted is_star_king and repos
  • replace the empty test_verifier.py placeholder with offline unit tests that stub GitHub/Gemini/dotenv dependencies

Root cause

generate_report() expects verify_stars() to return count, is_star_king, and repos. On GithubException, verify_stars() returned only error and count, so transient GitHub API failures could turn the verifier report path into a KeyError.

Validation

  • python -m pytest tools\bounty-bot-pro\tests\test_verifier.py -q -> 2 passed
  • python -m py_compile tools\bounty-bot-pro\verifier.py tools\bounty-bot-pro\tests\test_verifier.py -> passed; emits the existing markdown-backtick SyntaxWarning already covered by separate open PRs
  • git diff --check -- tools\bounty-bot-pro\verifier.py tools\bounty-bot-pro\tests\test_verifier.py
  • python tools\bcos_spdx_check.py --base-ref origin/main

@github-actions
Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Your PR has a BCOS-L1 or BCOS-L2 label
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added size/M PR: 51-200 lines BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) labels May 12, 2026
Copy link
Copy Markdown

@saim256 saim256 left a comment

Choose a reason for hiding this comment

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

I reviewed the verifier error-path change and the added regression coverage. The fix keeps verify_stars() returning the same report shape on GithubException, which prevents generate_report() from failing on missing count/is_star_king/repos keys when GitHub rate limits or API failures occur.

Validation performed locally:

  • python -m pytest tools\bounty-bot-pro\tests\test_verifier.py -q -> 2 passed
  • python -m py_compile tools\bounty-bot-pro\verifier.py tools\bounty-bot-pro\tests\test_verifier.py -> syntax OK; existing invalid-escape warning on the wallet markdown string remains non-blocking
  • git diff --check origin/main...pr-4881 -> passed
  • python tools\bcos_spdx_check.py --base-ref origin/main -> OK

No blocking issues found.

Copy link
Copy Markdown

@loganoe loganoe left a comment

Choose a reason for hiding this comment

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

Reviewed the verifier error-shape fix and the new focused tests. The change preserves the report contract by returning count/is_star_king/repos even when PyGithub raises, and the generated-report path now has regression coverage around reward inputs. Verified with: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -q tools/bounty-bot-pro/tests/test_verifier.py (2 passed; existing verifier SyntaxWarning remains unrelated).

Copy link
Copy Markdown
Contributor

@508704820 508704820 left a comment

Choose a reason for hiding this comment

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

Code Review: Keep Bounty Verifier Star Errors Shaped

Summary

Adds 93-line test file for the bounty verifier tool with stub-based module loading. Tests star/PR verification with mocked GitHub and Google API dependencies.

What Works Well

  1. Stub module loading: Creates mock github and google modules for testing without real API calls
  2. 93 lines: Good coverage of verifier logic
  3. importlib.util: Clean module loading pattern

Verdict: Approve

Good test coverage for the bounty verification tool with proper dependency mocking.

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

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

Great contribution! LGTM.

Copy link
Copy Markdown
Contributor

@jaxint jaxint left a comment

Choose a reason for hiding this comment

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

Great contribution! LGTM.

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

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/M PR: 51-200 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants