Skip to content

Refs #580: Link GitHub balances to claim flow#595

Open
Luzijano wants to merge 1 commit into
ramimbo:mainfrom
Luzijano:bounty-wallet-claim-status
Open

Refs #580: Link GitHub balances to claim flow#595
Luzijano wants to merge 1 commit into
ramimbo:mainfrom
Luzijano:bounty-wallet-claim-status

Conversation

@Luzijano
Copy link
Copy Markdown
Contributor

@Luzijano Luzijano commented May 28, 2026

Refs #580

Summary

  • Add a clear claim CTA on public github:* account pages when the account has a non-zero MRWK balance.
  • Point contributors to /me so they can sign in, link a wallet, and claim their GitHub-held balance.
  • Add regression coverage for the account-page claim path.

Why

After a bounty is paid to github:<login>, the account page shows the balance and transfer status, but the next action is easier to miss. This makes the contributor claim workflow easier to discover from the public account page.

Tests

  • ./.venv/bin/python -m pytest -q tests/test_wallet_api.py tests/test_api_mcp.py::test_explorer_links_ledger_proof_and_account --tb=short
  • ./.venv/bin/python -m ruff format --check tests/test_wallet_api.py
  • ./.venv/bin/python -m ruff check tests/test_wallet_api.py

Summary by CodeRabbit

  • New Features
    • Users with GitHub-linked accounts now see a notice on their account page when they have available MRWK balances to claim. The notice prompts them to sign in and link a wallet to access their balance.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

The account page template now conditionally renders a notice block that prompts users to claim their MRWK balance when they have a linked GitHub account with a non-zero balance. A new test verifies the notice and claim link render correctly.

Changes

GitHub Balance Claim Notice

Layer / File(s) Summary
Account page GitHub balance claim CTA
app/templates/account.html, tests/test_wallet_api.py
Account template conditionally displays a claim notice with a /me link when github_login is present and balance_mrwk is not "0"; test seeds a GitHub balance entry and verifies the rendered CTA and link.
🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Bounty Pr Focus ⚠️ Warning PR introduces unrelated file (.htmlhintrc) not mentioned in scope, and lacks the zero-balance negative test requested in review comments despite the template guarding on balance_mrwk != "0". Remove .htmlhintrc or document its purpose; add test_account_page_hides_claim_cta_for_zero_github_balance test as suggested in review to validate boundary condition.
Description check ❓ Inconclusive The description covers summary, motivation, and test commands but lacks the structured template sections like Evidence, Test Evidence checklist, and MRWK bounty reference. Fill in the Evidence section with confusion/bug details, bounty capacity check, intended surfaces, and expected PR size. Complete the Test Evidence checklist and confirm Related bounty reference in MRWK section.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the changed surface (GitHub balances claim flow linking) and is concrete and specific.
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.
Mergework Public Artifact Hygiene ✅ Passed No investment, price, cash-out, fabricated payout, or security claims found. Messaging properly describes MRWK balance claims to wallets, aligned with README's guidance on supported transfer paths.

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


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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 26a49cce-1a2c-4dfd-9c36-b5766477cb71

📥 Commits

Reviewing files that changed from the base of the PR and between bcd5cd4 and 2212da7.

📒 Files selected for processing (2)
  • app/templates/account.html
  • tests/test_wallet_api.py

Comment thread tests/test_wallet_api.py
Comment on lines +546 to +565
def test_account_page_links_github_balance_to_claim_flow(sqlite_url: str) -> None:
create_schema(sqlite_url)
with session_scope(sqlite_url) as session:
ensure_genesis(session)
add_ledger_entry(
session,
entry_type="test_github_balance",
from_account=TREASURY_ACCOUNT,
to_account="github:alice",
amount_microunits=7_000_000,
reference="test-github-claim-cta",
)
client = TestClient(create_app(database_url=sqlite_url, webhook_secret="secret"))

account_page = client.get("/accounts/github:alice")

assert account_page.status_code == 200
assert "This GitHub account has MRWK available" in account_page.text
assert 'href="/me">sign in to link a wallet and claim the balance</a>' in account_page.text

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a zero-balance negative boundary test for the CTA.

This test proves only the positive branch. The template guard also depends on account.balance_mrwk != "0", so add a companion case asserting the CTA is absent when github:* balance is exactly zero.

Suggested test addition
+def test_account_page_hides_claim_cta_for_zero_github_balance(sqlite_url: str) -> None:
+    create_schema(sqlite_url)
+    client = TestClient(create_app(database_url=sqlite_url, webhook_secret="secret"))
+
+    account_page = client.get("/accounts/github:alice")
+
+    assert account_page.status_code == 200
+    assert "This GitHub account has MRWK available" not in account_page.text
+    assert 'href="/me">sign in to link a wallet and claim the balance</a>' not in account_page.text

As per coding guidelines, “tests/**/*.py: Do not request docstrings. Focus on whether tests prove the changed behavior and include negative, replay, boundary, or regression cases where relevant.”

Copy link
Copy Markdown

@eliasx45 eliasx45 left a comment

Choose a reason for hiding this comment

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

Reviewed current head 2212da71ef21bd2c18d2c38dfdf16220990aaae8.

Verdict: approve.

The change is narrow and matches the #580 contributor-flow goal: public github:* account pages with a non-zero MRWK balance now surface the next action and send the contributor to /me, where the existing GitHub sign-in/link/claim flow lives. I do not see this overlapping the separate wallet-list, activity JSON, or bounty-list JSON shortcuts.

Evidence:

  • Inspected app/templates/account.html and tests/test_wallet_api.py.
  • The CTA is gated to account.github_login accounts and a non-zero formatted balance, so ordinary wallet/native accounts do not get the GitHub claim prompt.
  • The new regression seeds github:alice with 7 MRWK, renders /accounts/github:alice, and asserts the claim notice plus /me link are present.
  • Existing /me coverage still proves signed-in users see the available GitHub balance and the claim flow.

Validation:

  • .\.venv\Scripts\python.exe -m pytest -q tests\test_wallet_api.py tests\test_api_mcp.py::test_explorer_links_ledger_proof_and_account --tb=short -> 34 passed.
  • .\.venv\Scripts\python.exe -m ruff check tests\test_wallet_api.py -> passed.
  • .\.venv\Scripts\python.exe -m ruff format --check tests\test_wallet_api.py -> 1 file already formatted.
  • git diff --check origin/main...HEAD -> clean.
  • git merge-tree --write-tree origin/main HEAD -> clean merge tree.

I do not see a blocker in this claim-discovery CTA.

@ramimbo
Copy link
Copy Markdown
Owner

ramimbo commented May 28, 2026

Thanks for the focused UX work and review evidence. I cannot accept this from #580 in the current pass because #580 is now filled and closed, and the attempted follow-up UX round (#603) could not be reserved due to the current treasury epoch reserve cap.

Please do not treat this as accepted or payable from #580. Maintainers can reconsider or request a retarget after a future active reserved UX round exists.

@eliasx45
Copy link
Copy Markdown

Acknowledged. I will not treat this PR as accepted or payable from #580 based on my review. My prior review only verified the code/evidence state at that head; maintainer acceptance and any retargeting/reservation decision remains with maintainers.

Copy link
Copy Markdown

@barnacleagent-svg barnacleagent-svg left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVED

Scope: Adds a claim-flow CTA on account pages for GitHub accounts with non-zero balance. Small template change (+5 lines in account.html) plus focused test.

Checklist:

  • git diff --check origin/master...HEAD - clean
  • Diff: +23/-0 across 2 files
  • Tests pass (new test_account_page_links_github_balance_to_claim_flow)
  • Template logic guards on both github_login and non-zero balance, avoiding false CTA for unlinked accounts
  • Follows existing UI patterns (.notice class)

Conclusion: Clean, focused, well-tested. Ready to merge.

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

Labels

mrwk:needs-info More information needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants