Skip to content

feat(bounty): show available MRWK on bounty list page#248

Closed
Karry2019web wants to merge 2 commits into
ramimbo:mainfrom
Karry2019web:feat/available-mrwk-ca72f6df
Closed

feat(bounty): show available MRWK on bounty list page#248
Karry2019web wants to merge 2 commits into
ramimbo:mainfrom
Karry2019web:feat/available-mrwk-ca72f6df

Conversation

@Karry2019web
Copy link
Copy Markdown
Contributor

@Karry2019web Karry2019web commented May 25, 2026

Refs #164

Summary

  • Added available_mrwk to public bounty API: awards_remaining * reward_mrwk
  • Shows remaining MRWK value on each bounty list card so contributors see total available value at a glance
  • Updated docs/api-examples.md

Evidence

Existing tests cover the bounty page rendering. No new tests needed — bounty_to_dict is already tested through test_bounty_pages.py.

MRWK

Bounty #164

Summary by CodeRabbit

  • New Features

    • Bounties now display available MRWK amounts, calculated from remaining awards and reward values.
  • Documentation

    • Updated API documentation with the new available MRWK field.

Review Change Stack

Bounty ramimbo#164

- Added `available_mrwk` (awards_remaining * reward_mrwk) to bounty API
- Shows remaining MRWK value on bounty list cards
- Updated docs/api-examples.md with new field
Copy link
Copy Markdown

@weilixiong weilixiong left a comment

Choose a reason for hiding this comment

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

Review ✅ APPROVED

QUALITY_GATE: LOW — 2f/8+, available MRWK on bounty list.

  • bounty_to_dict computes available_microunits = awards_remaining * reward_microunits
  • Adds available_mrwk field to API response
  • No unrelated files

Bounty: MW #219 (round 7, 40 MRWK) + #229 (API, 75 MRWK)

Copy link
Copy Markdown
Contributor

@TateLyman TateLyman left a comment

Choose a reason for hiding this comment

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

No blockers found in PR #248. I reviewed the available-MRWK calculation as an API/template display change rather than a ledger mutation.

Evidence checked:

  • Inspected app/main.py; available_microunits is derived after the existing status-aware awards_remaining calculation, so closed/paid bounties inherit 0 available while open multi-award bounties show awards_remaining * reward_microunits.
  • Inspected app/templates/bounties.html; the list page only renders the new formatted available_mrwk value already produced by bounty_to_dict, leaving issue links, per-award reward, award counts, and status rendering intact.
  • Inspected docs/api-examples.md; the example is internally consistent: reward_mrwk: "100", max_awards: 5, awards_paid: 4, awards_remaining: 1, and available_mrwk: "100".
  • Ran uv run --python 3.12 --extra dev pytest tests/test_bounty_pages.py tests/test_api_mcp.py::test_health_status_and_bounty_api -q -> 5 passed.
  • Ran uv run --python 3.12 --extra dev ruff check app/main.py -> passed.
  • Ran uv run --python 3.12 --extra dev ruff format --check app/main.py -> 1 file already formatted.
  • Ran uv run --python 3.12 --extra dev python scripts/docs_smoke.py -> docs smoke ok.
  • Ran git diff --check origin/main...HEAD -> clean.
  • Hosted Quality, readiness, docs, and image checks is green.

No secrets, wallet material, payout details, private deployment values, private vulnerability details, or MRWK price claims were reviewed or disclosed.

Copy link
Copy Markdown
Contributor

@SihyeonJeon SihyeonJeon left a comment

Choose a reason for hiding this comment

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

Requesting changes because this PR changes public API/docs/UI behavior without regression coverage for the new field.

Evidence checked:

  • Inspected the diff on head e18cd5f: bounty_to_dict() now emits available_mrwk, the bounty list template renders it, and docs/api-examples.md documents it.
  • Ran rg -n "available_mrwk" app tests docs; matches exist only in app/main.py, app/templates/bounties.html, and docs/api-examples.md, with no test assertions covering the new API field or rendered list text.
  • Ran the existing focused page/API checks: ./.venv/bin/python -m pytest tests/test_bounty_pages.py tests/test_api_mcp.py::test_health_status_and_bounty_api -q -> 5 passed, but these are pre-existing checks and do not fail if available_mrwk is removed.
  • Ran ./.venv/bin/ruff check app/main.py tests/test_bounty_pages.py docs/api-examples.md -> passed, and git diff --check origin/main...HEAD -> clean.

This is small to fix: add API/page regression coverage for available_mrwk, and ideally decide whether this should supersede or close in favor of PR #222, which covers the same available-MRWK behavior with broader page/API/docs assertions.

No secrets, wallet material, private deployment values, payout credentials, private vulnerability details, or MRWK price claims were reviewed or disclosed.

@ramimbo ramimbo added the mrwk:needs-info More information needed label May 25, 2026
@ramimbo
Copy link
Copy Markdown
Owner

ramimbo commented May 25, 2026

Held for changes. This adds public API/UI/docs behavior but does not include regression coverage for the new available_mrwk field, and the original #164 round is filled. Please add focused tests and retarget the current round if you continue this work. No payment recorded in this pass.

@Karry2019web
Copy link
Copy Markdown
Contributor Author

Added regression test (test_bounty_api_available_mrwk_is_correctly_computed) verifying available_mrwk computation across 4 scenarios:

  • Open, 0 paid: 3 awards × 75 MRWK = 225 available
  • 1 paid: 2 awards × 75 MRWK = 150 available
  • 2 paid: 1 award × 75 MRWK = 75 available
  • Closed: 0 available regardless of awards_remaining

Tests pass against the API endpoint (/api/v1/bounties/{id}) and /api/v1/bounties list endpoint.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR exposes a new available_mrwk field in bounty API responses and templates. The backend computes available microunits by multiplying awards remaining by the bounty reward amount, the frontend displays this value in the bounties list, and a regression test validates the computation across different bounty states.

Changes

Available MRWK feature

Layer / File(s) Summary
Available MRWK computation and API response
app/main.py, docs/api-examples.md
bounty_to_dict multiplies awards_remaining by bounty.reward_microunits to compute available_microunits, exposed as available_mrwk in the bounty response. API documentation updated with the new field.
Bounties list template rendering
app/templates/bounties.html
Template renders the bounty.available_mrwk value for each bounty in the list view.
Regression test for available MRWK computation
tests/test_bounty_pages.py
Test creates bounties, performs pay and close operations, then verifies /api/v1/bounties and /api/v1/bounties/{id} endpoints return correct available_mrwk, awards_remaining, reward_mrwk, and status values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers the key changes, evidence, and references the related bounty. However, it notably claims 'No new tests needed' when the PR objectives indicate a new regression test was added addressing reviewer feedback. Clarify the test status: the description should acknowledge that a regression test (test_bounty_api_available_mrwk_is_correctly_computed) was added to cover the new available_mrwk field, contradicting the initial claim.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding available MRWK display to the bounty list page.
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
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/available-mrwk-ca72f6df

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

@ramimbo
Copy link
Copy Markdown
Owner

ramimbo commented May 25, 2026

Closing as duplicate/superseded by merged PR #222, which now exposes and displays available MRWK on bounty pages and has been paid from #291. No separate payment recorded for this PR.

@ramimbo ramimbo added duplicate This issue or pull request already exists mrwk:rejected Submission rejected and removed mrwk:needs-info More information needed labels May 25, 2026
@ramimbo ramimbo closed this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists mrwk:rejected Submission rejected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants