Add treasury reserve capacity status#625
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR computes treasury reserve metrics from recent ledger entries and pending create-bounty proposals via ChangesTreasury Status Reporting
Possibly related PRs
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
Maintainer note: this PR is intended as the first operational step after the treasury proposal changes, not as a cap-policy change. The path I suggest is:
This PR is a maintainer PR and has no bounty request. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0119e1b1-abc8-4742-8672-693d512816b0
📒 Files selected for processing (9)
app/admin.pyapp/templates/admin.htmlapp/treasury.pyapp/treasury_routes.pydocs/admin-runbook.mddocs/agent-guide.mddocs/api-examples.mdtests/test_security.pytests/test_treasury_proposals.py
…apacity-visibility # Conflicts: # tests/test_treasury_proposals.py
Thanhdn1984
left a comment
There was a problem hiding this comment.
Review of PR #625: Add treasury reserve capacity status
Head commit: checked against current HEAD
CI: all checks pass (Quality/readiness/docs/image checks ✅, CodeRabbit review skipped)
Merge state: clean
Files inspected (9 files, +279/-4)
-
app/treasury.py(+66): New_recent_bounty_reserve_entries()andtreasury_status()functions._recent_bounty_reserve_entriescorrectly filters bybounty_reserveentry type, treasury account, and 24h window with proper ordering.treasury_status()aggregates executed reserves, pending create-bounty proposals, available capacity, and next capacity release time.max(... , 0)correctly floors available capacity at zero.min(release_times)returns the soonest upcoming release — correct.- Edge case:
replace(tzinfo=None)in tests suggests DB stores naive UTC; the code handles this consistently.
-
app/treasury_routes.py(+6): NewGET /api/v1/treasury/statusendpoint — clean, usessession_scopeproperly, returns dict directly (FastAPI JSON serialization). -
app/admin.py(+1/-1): Addstreasury_statusto admin page context — minimal, clean import. -
app/templates/admin.html(+51): Treasury reserve capacity section with semantic HTML,aria-label, conditional rendering for pending proposals table. Proper use of{% if %}guards. -
tests/test_treasury_proposals.py(+131): Two thorough tests:test_treasury_status_includes_recent_reserves_and_pending_proposals: verifies cap, executed, pending, available, next release, and pending bounty list.test_treasury_status_includes_reserve_at_exact_24h_boundary: boundary condition — entry at exactly 24h ago is included butnext_capacity_release_atisNone(correct, since it expires atnow).
-
tests/test_security.py(+6/-1): Updated admin page assertions to verify treasury section renders, and tightened regex for webhook summaryaria-labeldisambiguation. -
docs/(+13/-1): Updated agent-guide, api-examples, and admin-runbook with new endpoint documentation.
Findings
- No security issues: endpoint is read-only, no auth required (consistent with other public treasury endpoints).
- No conflicts with active maintainer branches observed.
- Code quality: consistent with existing patterns, proper type annotations, clean separation of concerns.
- Minor observation:
_pending_action_payloadsis reused — good code reuse rather than duplicating query logic.
LGTM. Clean, well-tested feature addition.
|
Reviewed for #578 at current head
So the operator can be told that nothing is limiting create capacity even though pending proposals are the limiter. This needs either a distinct pending-proposal blocking message in |
|
Addressed the pending-create capacity wording finding in The admin page now explicitly says pending create-bounty proposals are using current create-bounty capacity when Validation:
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b6811479-8733-4a25-8cd4-40c98da0d6c4
📒 Files selected for processing (2)
app/templates/admin.htmltests/test_security.py
|
Addressed CodeRabbit's test nit in Validation:
|
Summary
Adds read-only treasury reserve capacity visibility for maintainers and agents:
GET /api/v1/treasury/status/admintreasury reserve capacity panel with pending create-bounty proposalsThis is a maintainer PR. I am not claiming or requesting a bounty for it.
Why
Fresh bounty rounds are now proposal-gated and reserve-capped. Maintainers need to see the rolling 24h reserve cap, executed reserves, pending create-bounty reserve, remaining create capacity, and next release time before deciding whether to open or wait on new rounds.
Validation
./.venv/bin/python -m pytest(483 passed)./.venv/bin/python -m ruff format --check ../.venv/bin/python -m ruff check ../.venv/bin/python -m mypy app./.venv/bin/python scripts/docs_smoke.pySummary by CodeRabbit
New Features
Documentation
Tests