Expose admin payout award state#288
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR enhances the bounty payout API to return detailed award-state information and payment metadata after processing a bounty payment. The endpoint now fetches and includes the updated bounty status, award counts, submission source, and proof metadata. A comprehensive test validates the enriched response, verifies database state, and exercises duplicate-submission protection. ChangesPayout Flow Enhancement
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_security.py`:
- Around line 318-322: Change the duplicate-submission assertion to ensure
deduping is based solely on submission_url: after the original first_payload,
send a second payload that reuses the same "submission_url" but changes
"to_account" (e.g., "github:bob") and assert the response indicates "submission
already paid"/duplicate; update the analogous duplicate check section around the
later block (the other payload at 338-340) the same way so both tests verify
URL-only dedupe.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5167b5d8-cdc2-401c-b359-7d9ef3640124
📒 Files selected for processing (2)
app/main.pytests/test_security.py
|
Addressed the duplicate-submission coverage note in The duplicate admin payout call now reuses the same Re-validation:
|
97190af to
a3e89e4
Compare
|
Rebased this branch onto current Re-validation after conflict resolution:
|
Karry2019web
left a comment
There was a problem hiding this comment.
Review PR #288: Expose admin payout award state
Evidence
Files inspected:
app/main.py—api_pay_bounty()response enriched withbounty_status,awards_paid,awards_remaining,submission_url,proof_url,ledger_sequencetests/test_security.py—test_admin_payout_api_reports_award_state_and_blocks_duplicate_submission
Behavior checked:
- After payment, response now includes
bounty_status: 'open',awards_paid: 1,awards_remaining: 1(for max_awards=2 bounty) — reads from existingbounty_to_dict() submission_urlcomes fromproof.public_jsonpayload, properly parsedproof_urlandledger_sequencefrom the Proof model- Duplicate submission on same submission_url returns 400 as expected
- CI: all checks pass (CodeRabbit: success)
Result: LGTM, no blockers. Clean enhancement — adds observability without changing behavior.
Karry2019web
left a comment
There was a problem hiding this comment.
Review ✅ APPROVED
FILES INSPECTED: app/main.py, tests/test_security.py
BEHAVIOR CHECKED:
- Admin payout endpoint now returns:
bounty_status,awards_paid,awards_remaining,submission_url,proof_url,ledger_sequencealongside existingproof_hash. bounty_state = bounty_to_dict(bounty)andproof_payload = json.loads(proof.public_json)provide the source data.
TESTS VERIFIED:
test_admin_payout_api_reports_award_state_and_blocks_duplicate_submission— comprehensive 3-scenario test:- First payout: asserts status=paid, bounty_status=open, awards_paid=1, awards_remaining=1, correct to_account, submission_url, proof_hash, proof_url, ledger_sequence (int).
- Duplicate submission: returns 400 with "submission already paid", bounty awards_paid NOT incremented (remains 1), balance unchanged.
- Second distinct payout: fills remaining slot, bounty_status=paid, awards_paid=2, awards_remaining=0.
SECURITY: Duplicate submission prevention is critical for ledger integrity.
Excellent PR for #283.
Refs #283
Summary
bounty_status,awards_paid,awards_remaining)submission_url,proof_url, andledger_sequencealongside the proof hashsubmission already paidwithout incrementing awards or creating a second paymentValidation
uv run pytest tests/test_security.py -quv run pytest tests/test_webhooks.py tests/test_activity.py -quv run ruff check app/main.py tests/test_security.pyuv run ruff format --check app/main.py tests/test_security.pygit diff --checkSummary by CodeRabbit
New Features
Bug Fixes
Tests