Skip to content

test: split bounty API route coverage#416

Merged
ramimbo merged 1 commit into
ramimbo:mainfrom
tolga-tom-nook:split-bounty-api-tests
May 26, 2026
Merged

test: split bounty API route coverage#416
ramimbo merged 1 commit into
ramimbo:mainfrom
tolga-tom-nook:split-bounty-api-tests

Conversation

@tolga-tom-nook
Copy link
Copy Markdown
Contributor

@tolga-tom-nook tolga-tom-nook commented May 26, 2026

Summary

  • Bounty MRWK bounty: split oversized test modules #410
  • Move the multi-award and status-filter bounty API route tests out of tests/test_api_mcp.py into focused tests/test_bounty_api_routes.py.
  • Preserve the existing assertions and test names for bounty capacity, paid/exhausted state, closed state, terminal visibility, and status filtering.
  • Keep this scoped to test organization only; no application behavior changes.

Evidence

Preflight before submission: MRWK bounty API showed issue #410 open with awards_remaining=3; GitHub issue #410 was open. Existing open PR #415 also targets #410, but it splits security URL validation tests, so this is a distinct test-module split from tests/test_api_mcp.py.

Validation

  • ./.venv/bin/python -m pytest tests/test_bounty_api_routes.py tests/test_api_mcp.py -q -> 81 passed
  • ./.venv/bin/python -m pytest -q -> 377 passed
  • ./.venv/bin/python -m ruff check . -> passed
  • ./.venv/bin/python -m ruff format --check . -> passed
  • ./.venv/bin/python -m mypy app -> passed
  • git diff --check -> clean

Summary by CodeRabbit

  • Tests
    • Restructured and expanded bounty API test coverage for multi-award scenarios, including capacity accounting, payment transitions, status filtering validation, and terminal state behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 426e3908-a072-4883-8e35-bbddf37ef5f4

📥 Commits

Reviewing files that changed from the base of the PR and between 5439fb0 and 4dd9d77.

📒 Files selected for processing (2)
  • tests/test_api_mcp.py
  • tests/test_bounty_api_routes.py
💤 Files with no reviewable changes (1)
  • tests/test_api_mcp.py

📝 Walkthrough

Walkthrough

This PR reorganizes bounty API multi-award tests by consolidating them from test_api_mcp.py into a new dedicated module test_bounty_api_routes.py. The new test suite covers capacity accounting, status transitions (open → paid → closed), terminal bounty visibility, and query-parameter filtering with comprehensive assertions on field values and API responses.

Changes

Bounty API Multi-Award Tests Migration

Layer / File(s) Summary
New test module setup and imports
tests/test_bounty_api_routes.py
FastAPI TestClient, database schema, bounty ledger, and app initialization for route testing.
Multi-award bounty capacity and status transitions
tests/test_bounty_api_routes.py
Tests for open bounty capacity fields, paid status after multiple exhaustion cycles with balance updates, closed status after partial payouts, and terminal bounties remaining visible while inactive in list/detail endpoints and /api/v1/status.
Status query filtering
tests/test_bounty_api_routes.py
Tests for /api/v1/bounties?status=... filtering covering open, paid, closed with case-insensitive and whitespace tolerance, plus HTTP 400 validation for invalid status values.
Old test removal
tests/test_api_mcp.py
Deletion of multi-award bounty REST API test block.

Possibly related PRs

  • ramimbo/mergework#393: Bounty API routes were refactored from app/main.py to app/bounty_api.py, affecting the same /api/v1/bounties list and detail endpoints exercised in this PR's new tests.

Suggested labels

mrwk:accepted

Suggested reviewers

  • MolhamHamwi
  • Karry2019web

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: splitting bounty API route test coverage into a separate test module.
Description check ✅ Passed The description is comprehensive with a clear summary, evidence of the issue being addressed, detailed validation results, and test evidence confirmation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@alan747271363-art
Copy link
Copy Markdown
Contributor

Reviewed the split against Bounty #410 and the current PR head 4dd9d77.

No blockers from my pass. The change is test-organization only: the multi-award bounty API route coverage is moved out of tests/test_api_mcp.py into tests/test_bounty_api_routes.py, with the original assertions and scenarios preserved for capacity fields, paid/exhausted state, closed state, terminal visibility, and status filtering. I did not see application-code changes or unrelated test rewrites.

Validation run locally in a clean review worktree after installing the project-declared dev dependencies from pyproject.toml:

  • .\.venv\Scripts\python.exe -m pytest tests/test_bounty_api_routes.py tests/test_api_mcp.py -q -> 81 passed
  • .\.venv\Scripts\python.exe -m ruff check tests/test_bounty_api_routes.py tests/test_api_mcp.py -> passed
  • .\.venv\Scripts\python.exe -m ruff format --check tests/test_bounty_api_routes.py tests/test_api_mcp.py -> passed
  • .\.venv\Scripts\python.exe -m mypy app -> passed
  • GitHub CI for 4dd9d77 -> success

@ramimbo ramimbo merged commit e59148b into ramimbo:main May 26, 2026
2 checks passed
@ramimbo ramimbo added mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded labels May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants