Simplify bounty sorting key selection#879
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)
📝 WalkthroughWalkthroughRefactors bounty sorting to use typed per-mode key functions registered in ChangesBounty Sorting Refactoring
Estimated code review effort3 (Moderate) — ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
xiefuzheng713-alt
left a comment
There was a problem hiding this comment.
Approved for the current head cdff05b4b8f17e8173334af9b498fbb7d3809173.
I reviewed app/bounty_sorting.py and tests/test_bounty_sorting.py. The refactor keeps the same public sorting contract while moving the duplicated branch bodies into named key helpers: newest still sorts by descending id, reward/available still use Decimal(str(...)) with id tie-breaks, and available/awards still prefer the effective fields with the same fallback fields.
Validation I ran locally:
uv run --python 3.12 --extra dev python -m pytest tests/test_bounty_sorting.py tests/test_bounty_pages.py::test_bounties_page_and_api_sort_public_rows tests/test_api_mcp.py::test_mcp_list_bounties_honors_sort_argument -q-> 10 passed, 1 existing Starlette/httpx warning.uv run --python 3.12 --extra dev ruff check app/bounty_sorting.py tests/test_bounty_sorting.py-> passed.uv run --python 3.12 --extra dev ruff format --check app/bounty_sorting.py tests/test_bounty_sorting.py-> 2 files already formatted.uv run --python 3.12 --extra dev mypy app/bounty_sorting.py-> success.git diff --check-> clean.git merge-tree --write-tree origin/main HEAD-> clean tree6baa80a23af966ca53050e160949780bfebb29ad.
I also checked that this is not my PR, there were no prior human reviews on this head, and the only existing PR comment was the non-actionable CodeRabbit walkthrough. The GitHub Quality check was still in progress when I checked, with no failure observed; the focused local checks cover the changed helper and its public API/page/MCP callers.
|
Bounty #838 current-head review for PR #879. Reviewed head Verdict: no blocker found. The refactor moves each sort mode into named key helpers and a dispatch table, while preserving descending sort semantics and the id tie-breaks for newest, reward, available MRWK, and award slots. The new tests cover normalization, invalid/control-character rejection, and all supported orderings. GitHub state checked: |
MolhamHamwi
left a comment
There was a problem hiding this comment.
Reviewed current head cdff05b for the #838 review bounty. I inspected app/bounty_sorting.py and tests/test_bounty_sorting.py, checked the GitHub PR state, and ran python3 -m pytest tests/test_bounty_sorting.py -q locally: 8 passed.
Functionally the refactor keeps the existing ordering behavior: each extracted key function still uses the same descending sort key and the effective_* fallbacks remain equivalent to the previous inline lambdas. The new parametrized tests cover normalization, invalid/control-character rejection, and the supported sort orders.
However, this branch is currently not merge-ready because GitHub reports mergeable=CONFLICTING / mergeStateStatus=DIRTY against the current base. Please rebase or merge current main and rerun the sorting tests before maintainers consider it ready.
Refs #846
Summary
sort_bounties()branch bodies with named sort-key helpers and a single key dispatch tableValidation
uv run --python 3.12 --extra dev python -m pytest tests/test_bounty_sorting.py tests/test_bounty_pages.py::test_bounties_page_and_api_sort_public_rows tests/test_api_mcp.py::test_mcp_list_bounties_honors_sort_argument -q-> 10 passed, 1 existing Starlette/httpx warninguv run --python 3.12 --extra dev ruff check app/bounty_sorting.py tests/test_bounty_sorting.py-> passeduv run --python 3.12 --extra dev ruff format --check app/bounty_sorting.py tests/test_bounty_sorting.py-> 2 files already formatteduv run --python 3.12 --extra dev mypy app/bounty_sorting.py-> successgit diff --check-> cleangit merge-tree --write-tree origin/main HEAD-> clean treeabda6f4c7b8cc6d19c1ef4bc0fd2711b121cfce1Scope: maintainability-only cleanup in the shared bounty sorting helper. No public API contract, ledger behavior, wallet behavior, treasury behavior, payout behavior, or bounty lifecycle semantics are changed.
Summary by CodeRabbit
Refactor
Tests