Skip to content

Show pending payouts on account views#730

Open
Jorel97 wants to merge 2 commits into
ramimbo:mainfrom
Jorel97:codex/647-671-account-pending-payouts
Open

Show pending payouts on account views#730
Jorel97 wants to merge 2 commits into
ramimbo:mainfrom
Jorel97:codex/647-671-account-pending-payouts

Conversation

@Jorel97
Copy link
Copy Markdown

@Jorel97 Jorel97 commented May 31, 2026

Bounty #647
Source issue: #671

Summary

  • Adds account-level pending payout summaries for accepted-but-not-yet-executed pay_bounty proposals.
  • Extends /api/v1/accounts/{account} with a separate pending_payouts summary.
  • Extends /api/v1/accounts/{account}/accepted-work with separate pending_summary and pending_payouts rows.
  • Adds a public account-page pending payouts section that clearly labels queued work as not proof-backed paid work.
  • Keeps proof-backed accepted_work, balance, latest proof, and ledger fields unchanged until treasury execution creates a proof.

Verification

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_account_routes.py -q -> 6 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_api_mcp.py -k "account" -q -> 7 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_serializers.py -k "account or accepted" -q -> 2 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_account_routes.py tests\test_api_mcp.py tests\test_serializers.py -k "account or accepted" -q -> 16 passed
  • .\.venv\Scripts\python.exe -m ruff check app\accounts.py app\serializers.py tests\test_account_routes.py -> All checks passed
  • .\.venv\Scripts\python.exe -m ruff format --check app\accounts.py app\serializers.py tests\test_account_routes.py -> 3 files already formatted
  • git diff --check -> passed

Duplicate Check

Scope

No balance, proof, ledger, wallet transfer, treasury execution, payout rule, exchange, bridge, cash-out, price, private data, credential, or production mutation behavior changed.

Summary by CodeRabbit

  • New Features

    • Added a "Pending payouts" section to account pages showing pending awards, MRWK totals, and next execution time
    • Account APIs now expose pending treasury payouts separately from accepted work, and list proposal/bounty details and execution timing
  • Bug Fixes

    • Account pages and APIs gracefully fall back to zeroed summary and empty list if pending-payout retrieval fails
  • Tests

    • Added tests covering pending payouts display, API exposure, and fallback behavior

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 007c39b0-bfcc-40d2-a5b2-b0148206ad68

📥 Commits

Reviewing files that changed from the base of the PR and between b395523 and 3b34e92.

📒 Files selected for processing (4)
  • app/accounts.py
  • app/serializers.py
  • app/templates/account.html
  • tests/test_account_routes.py

📝 Walkthrough

Walkthrough

Adds pending treasury payout data to account APIs and the account page. Implements serializers that query and summarize pending pay_bounty proposals, wires them into account context builders, renders a “Pending payouts” UI section, and adds tests including a failure fallback.

Changes

Pending Payout Feature

Layer / File(s) Summary
Pending payout query and aggregation
app/serializers.py
Adds _payload_account_filter, pending_payouts_for_account, pending_payout_summary, empty_pending_payout_summary, and safe_pending_payouts_for_account to query/shape pending pay_bounty proposals and produce a summary.
Account context builders
app/accounts.py
Updates account_api_context, account_accepted_work_context, and account_page_context to include pending_summary and pending_payouts in returned contexts.
Account page pending payouts section
app/templates/account.html
Renders summary metrics and a conditional list of pending treasury proposals with safe URL/reference handling; minor separator change in accepted-work display.
Tests: pending payouts separate from paid work
tests/test_account_routes.py
Adds tests creating pending and paid bounty scenarios, asserting API and HTML expose separate pending summaries/payouts and a fallback when pending serialization fails.

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Show pending payouts on account views' directly describes the main feature change—adding pending payout visibility on account endpoints and pages.
Description check ✅ Passed The description includes summary, evidence section with verification, duplicate check, and scope—covering the required template structure with concrete test results and impact boundaries.
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 claims, price claims, cash-out/off-ramp claims, or fabricated payout claims found. Language clearly distinguishes pending from paid work.
Bounty Pr Focus ✅ Passed Diff matches stated files and surfaces. Includes comprehensive test coverage (success and failure paths). No scope creep—strictly limited to pending payout display.

✏️ 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

@Difficult-Burger Difficult-Burger left a comment

Choose a reason for hiding this comment

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

Found one blocking UI regression in the pending payouts account section.

app/templates/account.html:98 renders the bounty/issue separator as ·:

{% if payout.bounty_url and pending_issue_url %} · {% endif %}

The existing accepted-work section in the same template uses the normal separator (·) at the equivalent bounty/issue join. With the current PR head, any pending payout row that has both bounty_url and a safe public issue_url will show mojibake in the public account page. This is easy to miss because the new route test only checks for the presence of the proposal link and amounts, not the rendered separator text.

Verification run locally from PR head b3955232d585166e6fae6ca352e2a719a2f5b4a5 in an isolated checkout with the dollar-hunt-mergework conda env:

  • sed -n '80,140p' app/templates/account.html -> confirmed · in the new pending-payout section
  • LC_ALL=C rg -n "Â|·|pending_issue_url|pending_submission_url" app/templates/account.html -> line 98 has ·; line 148 has the existing correct ·
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest tests/test_account_routes.py -q -> 6 passed
  • python -m ruff check app/accounts.py app/serializers.py tests/test_account_routes.py -> All checks passed

Please replace the mojibake separator with the same separator style used by the existing accepted-work row, or use plain ASCII if preferred. The underlying account/pending-payout data path otherwise looks coherent from this pass.

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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 02918334-db07-4fa4-8613-d9688705b971

📥 Commits

Reviewing files that changed from the base of the PR and between 0eb12a3 and b395523.

📒 Files selected for processing (4)
  • app/accounts.py
  • app/serializers.py
  • app/templates/account.html
  • tests/test_account_routes.py

Comment thread app/accounts.py Outdated
Comment thread app/accounts.py Outdated
Comment thread app/serializers.py
@Jorel97
Copy link
Copy Markdown
Author

Jorel97 commented May 31, 2026

Thanks for the review. I pushed 3b34e92 to address the blocking separator issue and the related quick wins:

  • replaced the mojibake separator in the pending-payout row with · and aligned the accepted-work separator too
  • made account/API/page pending-payout loading use a safe fallback like accepted-work summaries
  • aligned account API shape so pending_summary is the summary and pending_payouts is the row list
  • added an account-scoped canonical JSON prefilter before parsing pending payout proposals
  • added regression coverage for the separator and fallback path

Verification after the update:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_account_routes.py tests\test_api_mcp.py tests\test_serializers.py -k "account or accepted" -q -> 17 passed
  • .\.venv\Scripts\python.exe -m ruff check app\accounts.py app\serializers.py tests\test_account_routes.py -> passed
  • .\.venv\Scripts\python.exe -m ruff format --check app\accounts.py app\serializers.py tests\test_account_routes.py -> passed
  • git diff --check -> passed

Copy link
Copy Markdown
Contributor

@xyjk0511 xyjk0511 left a comment

Choose a reason for hiding this comment

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

Reviewed PR #730 at current head 3b34e9281bf1cbca97d288061f6854496dffd93a.

No blocker found in the updated pending-payout account view/API change.

What I checked:

  • The prior mojibake blocker from head b3955232 is fixed on the current head: the pending-payout bounty/issue separator now renders as ASCII-safe · instead of ·.
  • The existing accepted-work separator was also normalized to ·, so the template now uses the same safe separator style in both pending and proof-backed sections.
  • Pending payout rows are kept separate from proof-backed paid work: account balance and accepted-work summary still come only from ledger/proof rows, while pending proposals are exposed under separate pending_summary and pending_payouts fields.
  • pending_payouts_for_account() filters pending pay_bounty proposals for the target account and then re-validates the parsed payload account before returning rows.
  • The query prefilter matches the repository's canonical compact JSON format from canonical_json().
  • Public links still flow through safe_public_url() in the template before rendering bounty, issue, or submission links.
  • Regression tests now cover the pending-vs-paid separation, the rendered no-mojibake condition, and the safe fallback path when pending payout lookup fails.

Validation I ran locally:

  • uv run --python 3.12 --with pytest pytest tests/test_account_routes.py -q -> 7 passed, 1 warning.
  • uv run --python 3.12 --with pytest pytest tests/test_account_routes.py tests/test_api_mcp.py tests/test_serializers.py -k "account or accepted" -q -> 17 passed, 80 deselected, 1 warning.
  • uvx ruff check app/accounts.py app/serializers.py tests/test_account_routes.py -> passed.
  • uvx ruff format --check app/accounts.py app/serializers.py tests/test_account_routes.py -> 3 files already formatted.
  • .\.venv\Scripts\python.exe scripts\docs_smoke.py -> docs smoke ok.
  • git diff --check origin/main...HEAD -> clean.
  • gh pr checks 730 --repo ramimbo/mergework -> Quality/readiness/docs/image checks passed; CodeRabbit was still pending at review time.

No private data, credentials, wallet material, production mutation, price/exchange/bridge/off-ramp claims, or fabricated payout claims used.

Copy link
Copy Markdown

@JONASXZB JONASXZB 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 3b34e9281bf1cbca97d288061f6854496dffd93a as a non-author.

No blocker found in the pending-payout account view/API changes. Evidence checked:

  • inspected account_api_context, account_accepted_work_context, and account_page_context to confirm pending payout rows are reported separately from proof-backed accepted work and balances;
  • inspected pending_payouts_for_account and the payload filter, including the final exact payload.get("to_account") == account guard after the SQL contains prefilter;
  • confirmed pending summary totals use only pending proposal rows and that accepted work/proof fields remain driven by ledger/proof data;
  • checked the account template section and verified the earlier mojibake separator is replaced with · in both pending and accepted rows;
  • ran python -m pytest tests/test_account_routes.py tests/test_api_mcp.py tests/test_serializers.py -k 'account or accepted' -q -> 17 passed, 80 deselected, 1 warning;
  • ran python -m ruff check app/accounts.py app/serializers.py tests/test_account_routes.py, python -m ruff format --check ..., python -m mypy app, and git diff --check origin/main...HEAD;
  • checked a merge-tree against current origin/main; no conflict markers or both-modified conflict diagnostics were present.

Hosted commit status for this head is green (CodeRabbit: success / Review skipped).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants