Bounty #427: Add ledger entry type filters#511
Conversation
|
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 adds ledger entry type filtering across the backend API and frontend HTML routes. A new validation layer enforces known entry types and maps "all"/empty to no filter. The API endpoint accepts a ChangesLedger entry type filtering
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 |
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Reviewed current head 09a99b326b13eabe0da2ca457486eb8de80872d9 as a non-author.
I checked the ledger filter path across app/ledger_views.py, app/main.py, app/public_routes.py, app/templates/ledger.html, and the regression coverage in tests/test_bounty_pages.py. The implementation keeps blank and type=all requests unfiltered, normalizes valid type names, returns a bounded 400 for unsupported types, and preserves proof hashes on filtered payment rows. I also checked the HTML route directly: /ledger?type=bogus returns the same bounded 400, while case/whitespace-normalized values such as Bounty_Payment and all render successfully.
Validation:
uv run --extra dev pytest -q tests/test_bounty_pages.py::test_ledger_page_and_api_filter_by_entry_type tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable tests/test_ledger_views.py->4 passeduv run --extra dev pytest -q tests/test_bounty_pages.py tests/test_ledger_views.py tests/test_public_routes.py->11 passeduv run --extra dev pytest -q->415 passeduv run --extra dev ruff format --check .->79 files already formatteduv run --extra dev ruff check .->All checks passed!uv run --extra dev mypy app->Success: no issues found in 30 source filesuv run --extra dev python scripts/docs_smoke.py->docs smoke okgit diff --check origin/main...HEAD-> cleangit diff --no-ext-diff origin/main...HEAD | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks found
GitHub readback showed the quality workflow passing on this head. I do not see a blocker in the reviewed scope.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/test_bounty_pages.py (1)
479-502:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd boundary assertions for normalization paths (
type=BOUNTY_PAYMENTand blank/whitespace).The feature normalizes case and trims empty filters to unfiltered mode, but this test only checks lowercase and
all. Add explicit assertions for uppercase and blank/whitespace values to lock in that behavior.Proposed test additions
payment_rows = client.get("/api/v1/ledger?type=bounty_payment") assert payment_rows.status_code == 200 assert [row["type"] for row in payment_rows.json()] == ["bounty_payment"] assert payment_rows.json()[0]["proof_hash"] == proof.hash + uppercase_rows = client.get("/api/v1/ledger?type=BOUNTY_PAYMENT") + assert uppercase_rows.status_code == 200 + assert [row["type"] for row in uppercase_rows.json()] == ["bounty_payment"] + + blank_rows = client.get("/api/v1/ledger?type= ") + assert blank_rows.status_code == 200 + assert len(blank_rows.json()) >= 1 @@ all_page = client.get("/ledger?type=all") assert all_page.status_code == 200 assert 'href="/ledger" aria-current="page"' in all_page.text + blank_page = client.get("/ledger?type= ") + assert blank_page.status_code == 200 + assert 'href="/ledger" aria-current="page"' in blank_page.textAs per coding guidelines
tests/**/*.py: "Focus on whether tests prove the changed behavior and include negative, replay, boundary, or regression cases where relevant."
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0aade768-c057-4bf8-ab72-79f875ef3a87
📒 Files selected for processing (6)
app/ledger_views.pyapp/main.pyapp/public_routes.pyapp/static/style.cssapp/templates/ledger.htmltests/test_bounty_pages.py
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Reviewed current head 5d707a8dabde2f7837d77deb967ccab24b4033b3 as non-author GHX5T-SOL.
This is a current-head follow-up to my earlier approval on 09a99b326b13eabe0da2ca457486eb8de80872d9. The new commit only strengthens the ledger type-filter regression after CodeRabbit's boundary note: tests/test_bounty_pages.py now covers uppercase type=BOUNTY_PAYMENT normalization for API and page routes, and blank/whitespace API filters still return the unfiltered ledger stream. That addresses the missing boundary coverage without changing the implementation surface.
Validation on this exact head:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /home/kali/money/mergework/.venv/bin/python -m pytest -q tests/test_bounty_pages.py::test_ledger_page_and_api_filter_by_entry_type tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable tests/test_ledger_views.py->4 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /home/kali/money/mergework/.venv/bin/python -m pytest -q tests/test_bounty_pages.py tests/test_ledger_views.py tests/test_public_routes.py->11 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /home/kali/money/mergework/.venv/bin/python -m pytest -q->415 passed/home/kali/money/mergework/.venv/bin/ruff format --check .->79 files already formatted/home/kali/money/mergework/.venv/bin/ruff check .->All checks passed!PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /home/kali/money/mergework/.venv/bin/python -m mypy app->Success: no issues found in 30 source filesPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /home/kali/money/mergework/.venv/bin/python scripts/docs_smoke.py->docs smoke okgit diff --check upstream/main...HEAD-> cleangit diff --no-ext-diff upstream/main...HEAD | gitleaks stdin --no-banner --redact --exit-code 1-> no leaks found
GitHub readback shows the PR is open, non-draft, mergeable CLEAN, with quality workflow and CodeRabbit successful. I do not see a remaining blocker on the current head.
GHX5T-SOL
left a comment
There was a problem hiding this comment.
Re-reviewed current head 5d707a8dabde2f7837d77deb967ccab24b4033b3 after the added ledger type-normalization coverage. The follow-up commit addresses the CodeRabbit normalization-boundary note by covering uppercase type=BOUNTY_PAYMENT, blank/whitespace filters, and the normalized HTML current-state link. Validation rerun locally: focused ledger tests 4 passed; touched public-route/ledger tests 11 passed; full pytest 415 passed; Ruff format/check passed; mypy app passed; docs smoke passed; git diff --check origin/main...HEAD clean; diff-only Gitleaks found no leaks. GitHub quality checks are passing and CodeRabbit skipped the latest rerun.
Refs #427
This adds type filters to the public ledger so contributors can scan one workflow at a time instead of reading every reserve, payment, release, transfer, claim, and genesis row together.
Before:
/ledgeralways showed the latest ledger rows as one mixed stream./api/v1/ledgercould limit rows but could not filter by entry type.After:
/ledgershows filter links for All, Bounty Reserve, Bounty Payment, Bounty Release, GitHub claim, Wallet transfer, and Genesis./api/v1/ledger?type=bounty_paymentreturns only payment rows while keeping proof hashes attached.type=allstays unfiltered; unsupported types return a bounded 400.Checked against the ledger entry types produced by
app/ledger/service.py.Validation:
./.venv/bin/python -m pytest tests/test_bounty_pages.py::test_ledger_page_and_api_filter_by_entry_type tests/test_bounty_pages.py::test_ledger_and_proof_pages_make_bounty_payments_scannable tests/test_ledger_views.py -q-> 4 passed./.venv/bin/python -m ruff check app/ledger_views.py app/main.py app/public_routes.py tests/test_bounty_pages.py-> passed./.venv/bin/python -m ruff format --check app/ledger_views.py app/main.py app/public_routes.py tests/test_bounty_pages.py-> passed./.venv/bin/python -m mypy app/ledger_views.py app/public_routes.py app/main.py-> passedgit diff --check-> cleanSummary by CodeRabbit
New Features
Bug Fixes
Tests