Share duplicate attempt response#922
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 refactors ChangesDuplicate active attempt response centralization
Possibly related issues
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
Follow-up on the CodeRabbit pre-merge warning: I rechecked the PR file list and local diff after the review completed.\n\n- GitHub PR file list: only |
Zejia
left a comment
There was a problem hiding this comment.
Reviewed current head 05f3a15c16844db4bf56fae1e9c73c8137f7f3a2 as a non-author.
Scope checked:
app/bounty_attempts.py: verified the duplicated active-attempt 409 response is extracted into_duplicate_active_attempt_response()and reused by both the normal duplicate path and theIntegrityErrorfallback path.- Confirmed the public response shape is preserved: status remains
duplicate_active_attempt, the serializedattemptstill usesbounty_attempt_to_dict(existing, now), andwarningsare still computed withbounty_attempt_warnings(session, bounty, now). - Checked GitHub state before review: PR open,
mergeStateStatus=CLEAN,mergeable=MERGEABLE, hosted Quality/readiness/docs/image check successful, CodeRabbit reported no actionable comments, and no prior human reviews or #838 claims for this head were visible.
Validation run from a clean PR checkout:
/Users/jimmy/Documents/Playground/bounty-work/mergework/.venv/bin/python -m pytest tests/test_bounty_attempts.py -q-> 12 passed./Users/jimmy/Documents/Playground/bounty-work/mergework/.venv/bin/ruff check app/bounty_attempts.py-> passed./Users/jimmy/Documents/Playground/bounty-work/mergework/.venv/bin/ruff format --check app/bounty_attempts.py-> 1 file already formatted./Users/jimmy/Documents/Playground/bounty-work/mergework/.venv/bin/mypy app/bounty_attempts.py-> success.git diff --check origin/main...HEAD-> clean.git merge-tree --write-tree origin/main HEAD-> clean treedf4cf11b657d6ce9077bd0897ba0869f39bae189.
No blocker found in this focused maintainability cleanup.
aunysillyme
left a comment
There was a problem hiding this comment.
Reviewed current head 05f3a15c16844db4bf56fae1e9c73c8137f7f3a2.
Refs #838 review bounty.
What I checked:
app/bounty_attempts.py:_duplicate_active_attempt_response()preserves the existing 409 JSON shape for duplicate active attempts, includingstatus, serializedattempt, and currentwarnings.- The normal duplicate path still returns the existing active attempt before creating a new row.
- The
IntegrityErrorfallback still rolls back, reloads the bounty/attempt state, raises the previous hard 409 only when no matching active attempt exists, and otherwise returns the same duplicate response helper. - Scope stays limited to response construction reuse; it does not change attempt lifecycle semantics, warnings calculation, bounty availability, ledger, wallet, treasury, payout, admin-token, private data, exchange, bridge, cash-out, or MRWK price behavior.
Validation I ran on this exact head:
uv run --python 3.12 --extra dev python -m pytest tests/test_bounty_attempts.py::test_bounty_attempts_register_list_duplicate_and_release -q-> 1 passed, 1 existing Starlette/httpx warning.uv run --python 3.12 --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_bounty_api_routes.py -q-> 32 passed, 1 existing Starlette/httpx warning.uv run --python 3.12 --extra dev ruff check app/bounty_attempts.py-> passed.uv run --python 3.12 --extra dev ruff format --check app/bounty_attempts.py-> 1 file already formatted.uv run --python 3.12 --extra dev mypy app/bounty_attempts.py-> success.uv run --python 3.12 --extra dev python scripts/docs_smoke.py-> docs smoke ok.git diff --check origin/main...HEAD-> clean.git merge-tree --write-tree origin/main HEAD-> clean treedf4cf11b657d6ce9077bd0897ba0869f39bae189.
GitHub state checked before review: PR open, mergeable=MERGEABLE, hosted Quality, readiness, docs, and image checks successful, CodeRabbit successful, and no human reviews on current head visible before this review.
Duplicate/scope check: #838 bounty row 109 is open with 30 effective awards remaining; #922 was the only same-scope open PR surfaced by the duplicate-active-attempt search, with #920/#916 covering different surfaces.
No blocker found.
Bounty #846
Summary
duplicate_active_attempt409 JSON response into a private helper inapp/bounty_attempts.py.IntegrityErrorfallback path.Why this fits #846
This is a focused maintainability cleanup: the route currently builds the same duplicate-attempt response in two places. Sharing the response construction keeps the two duplicate paths in sync without changing the public API contract.
Duplicate / scope check
gh pr list --repo ramimbo/mergework --state open --search "duplicate_active_attempt OR active attempt duplicate OR IntegrityError bounty_attempts"did not show a same-scope open PR.gh search prs "duplicate_active_attempt bounty_attempts repo:ramimbo/mergework" --state openreturned no same-scope PR.Validation
uv run --python 3.12 --extra dev python -m pytest tests/test_bounty_attempts.py::test_bounty_attempts_register_list_duplicate_and_release -quv run --python 3.12 --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_bounty_api_routes.py -quv run --python 3.12 --extra dev ruff check app/bounty_attempts.pyuv run --python 3.12 --extra dev ruff format --check app/bounty_attempts.pyuv run --python 3.12 --extra dev mypy app/bounty_attempts.pyuv run --python 3.12 --extra dev python scripts/docs_smoke.pygit diff --check origin/main...HEADgit merge-tree --write-tree origin/main HEAD-> clean treeabda6f4c7b8cc6d19c1ef4bc0fd2711b121cfce1Scope
No public API contract, attempt lifecycle state, bounty availability logic, ledger behavior, wallet behavior, treasury behavior, payout behavior, proposal execution, admin-token behavior, private data, credentials, secrets, exchange, bridge, cash-out, or MRWK price behavior changed.
Summary by CodeRabbit