Skip to content

Refs #580: Add bounty list JSON shortcut#596

Merged
ramimbo merged 1 commit into
ramimbo:mainfrom
jakerated-r:codex/b580-bounty-list-json
May 28, 2026
Merged

Refs #580: Add bounty list JSON shortcut#596
ramimbo merged 1 commit into
ramimbo:mainfrom
jakerated-r:codex/b580-bounty-list-json

Conversation

@jakerated-r
Copy link
Copy Markdown
Contributor

@jakerated-r jakerated-r commented May 28, 2026

Refs #580

Summary

  • Add a View JSON results shortcut to the public /bounties page.
  • Preserve the active bounty list filters in the API link: status, q, non-default sort, and limit.
  • Cover the context URL builder and rendered bounty page links with regression tests.

Why

The human bounty list already supports status filters, text search, sorting, and row limits. The matching API endpoint already supports the same workflow, but contributors and maintainers had to manually rewrite /bounties?... into /api/v1/bounties?... to inspect the machine-readable result set. This adds the missing bridge from the public list to the exact JSON result set being viewed.

Distinctness

Validation

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_public_routes.py tests/test_bounty_pages.py::test_bounties_page_renders_and_filters_by_status tests/test_bounty_pages.py::test_bounties_page_honors_limit_filter -q -> 4 passed, 1 warning
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_bounty_pages.py tests/test_public_routes.py -q -> 14 passed, 1 warning
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 478 passed, 1 warning
  • uv run --extra dev ruff check app/public_routes.py tests/test_public_routes.py tests/test_bounty_pages.py -> passed
  • uv run --extra dev ruff format --check app/public_routes.py tests/test_public_routes.py tests/test_bounty_pages.py -> 3 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python scripts/docs_smoke.py -> docs smoke ok
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m mypy app/public_routes.py -> success
  • git diff --check -> clean

No private data, wallet material, credentials, production mutation, fund movement, MRWK price/off-ramp claims, exchange/liquidity claims, bridge claims, or fabricated payout claims are included.

Summary by CodeRabbit

  • New Features

    • Added a "View JSON results" link on the bounties page that allows users to view the API data in JSON format while respecting all active filters, sorting preferences, and pagination limits.
  • Tests

    • Enhanced test coverage to verify JSON result link generation with various filter, sort, and pagination combinations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

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: 2597e21f-fabe-4bb6-8650-e870cbef1cb8

📥 Commits

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

📒 Files selected for processing (4)
  • app/public_routes.py
  • app/templates/bounties.html
  • tests/test_bounty_pages.py
  • tests/test_public_routes.py

📝 Walkthrough

Walkthrough

The PR adds a _bounties_api_url() helper to construct /api/v1/bounties endpoints with query parameters, integrates it into public_bounties_context(), and renders a "View JSON results" link on the bounties page. Tests verify the URL construction and rendered HTML across various filter/sort/limit scenarios.

Changes

Bounties JSON API results link

Layer / File(s) Summary
API URL builder
app/public_routes.py
Added urlencode import and _bounties_api_url(...) helper that constructs /api/v1/bounties URLs with conditional query parameters for status, search text, sort, and limit.
Context integration and template link
app/public_routes.py, app/templates/bounties.html
public_bounties_context() now derives api_results_url via the helper. Bounties template displays a "View JSON results" link bound to the computed URL.
Test coverage
tests/test_public_routes.py, tests/test_bounty_pages.py
Unit tests verify api_results_url generation with normalized parameters and limit preservation. Integration tests confirm rendered HTML includes correctly escaped JSON links for unfiltered, status-filtered, and search/sort/limit queries.

Possibly related PRs

  • ramimbo/mergework#394: Introduced public_bounties_context() and filter-normalization logic that this PR extends with api_results_url and the JSON results link.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Bounty Pr Focus ⚠️ Warning PR claims focus on 4 files (+17 lines) but commit adds 137 files (entire repository). Diff includes massive unrelated scope beyond "Add bounty list JSON shortcut." Clarify whether this commit should be split: bounty JSON feature (4 files) should be separate from repository initialization. Verify PR matches stated changes on GitHub.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title names the changed surface (bounty list JSON shortcut) and includes the reference (Refs #580), meeting the requirement for a short, concrete title.
Description check ✅ Passed Description includes all required sections: Summary, Why (motivation), Distinctness, Validation with specific test results, and Related bounty reference. All test evidence items are checked.
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 PR contains no README, docs, or public comment modifications; code changes are technical (JSON link feature) with no investment, price, cash-out, or security claims.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Copy link
Copy Markdown
Contributor

@Squirbie Squirbie 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 #596 at current head d868ec4 and approved. Evidence: inspected app/public_routes.py, app/templates/bounties.html, tests/test_public_routes.py, and tests/test_bounty_pages.py. Confirmed the new bounties JSON shortcut mirrors the public /bounties state into /api/v1/bounties, preserving normalized status, trimmed q, non-default sort, and limit, while leaving the default unfiltered URL as /api/v1/bounties. Also checked that q="issue #580" encodes as issue+%23580, rendered query separators are escaped in HTML, and the change does not touch auth, admin, payout, wallet, treasury, or mutation paths. Validation: focused public/bounty page tests -> 4 passed; ruff check -> passed; ruff format --check -> already formatted; mypy app/public_routes.py -> success; docs smoke -> ok; git diff --check origin/main...HEAD -> clean; git merge-tree --write-tree origin/main HEAD -> clean. I refreshed origin/main before reviewing; the actual current-base diff is 4 files / 33 insertions, so the earlier repository-initialization warning is not present against current origin/main.

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 d868ec43895ac1d40509c04d85ee149f1d5b5e99.

Verdict: approve.

This is a clean public-page shortcut for #580. The /bounties page now exposes the matching JSON API URL for the current view, while preserving the same public-list controls instead of sending users to a generic unfiltered API result.

Evidence:

  • Inspected app/public_routes.py, app/templates/bounties.html, tests/test_public_routes.py, and tests/test_bounty_pages.py.
  • _bounties_api_url() carries status, trimmed q, non-default sort, and limit into /api/v1/bounties using urlencode.
  • Default /bounties correctly links to /api/v1/bounties without an empty query string.
  • Filtered cases preserve the active view, including status=paid, q=public, sort=reward, and limit=2; the rendered template escapes & as expected in HTML.
  • The change is distinct from the activity JSON shortcut, wallet-list GitHub links, and account-claim CTA PRs.

Validation:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_public_routes.py tests\test_bounty_pages.py::test_bounties_page_renders_and_filters_by_status tests\test_bounty_pages.py::test_bounties_page_honors_limit_filter -q -> 4 passed.
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_bounty_pages.py tests\test_public_routes.py -q -> 14 passed.
  • .\.venv\Scripts\python.exe -m ruff check app\public_routes.py tests\test_public_routes.py tests\test_bounty_pages.py -> passed.
  • .\.venv\Scripts\python.exe -m ruff format --check app\public_routes.py tests\test_public_routes.py tests\test_bounty_pages.py -> 3 files 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 bounty-list JSON results link.

@ramimbo ramimbo merged commit 36cdfc2 into ramimbo:main May 28, 2026
2 checks passed
@ramimbo ramimbo added mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded labels May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mrwk:accepted Maintainer accepted for payout mrwk:paid Ledger payment recorded

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants