Skip to content

feat: Implement Bounty Claiming System (Issue #16)#141

Closed
HuiNeng6 wants to merge 1 commit intoSolFoundry:mainfrom
HuiNeng6:fix/claiming-clean
Closed

feat: Implement Bounty Claiming System (Issue #16)#141
HuiNeng6 wants to merge 1 commit intoSolFoundry:mainfrom
HuiNeng6:fix/claiming-clean

Conversation

@HuiNeng6
Copy link

@HuiNeng6 HuiNeng6 commented Mar 20, 2026

Summary

Implements the Bounty Claiming System as specified in Issue #16.

Changes

Models (backend/app/models/bounty.py)

  • Added \CLAIMED\ status to \BountyStatus\ enum
  • Added \VALID_STATUS_TRANSITIONS\ with claim-aware transitions
  • Added claim-related models:
    • \ClaimHistoryRecord\ - Internal storage for claim events
    • \BountyClaimRequest\ - Request body for claiming
    • \BountyUnclaimRequest\ - Request body for releasing
    • \BountyClaimantResponse\ - Current claimant info
    • \BountyClaimHistoryItem\ / \BountyClaimHistoryResponse\ - History endpoints
  • Added \claimant_id\ and \claim_history\ fields to \BountyDB\
  • Added \claimant_id\ and \claimed_at\ fields to \BountyResponse\

Service (backend/app/services/bounty_service.py)

  • Implemented \claim_bounty()\ - Claim an open bounty
  • Implemented \unclaim_bounty()\ - Release a claimed bounty
  • Implemented \get_claimant()\ - Get current claimant
  • Implemented \get_claim_history()\ - Get claim history with pagination

API (backend/app/api/bounties.py)

  • \POST /api/bounties/{id}/claim\ - Claim a bounty
  • \DELETE /api/bounties/{id}/claim\ - Release a claim
  • \GET /api/bounties/{id}/claimant\ - Get current claimant
  • \GET /api/bounties/{id}/claim-history\ - Get claim history

Tests (backend/tests/test_bounty_claim.py)

  • Test claiming open bounty
  • Test claiming non-existent bounty
  • Test double-claim protection
  • Test unclaim by claimant
  • Test unclaim by non-claimant fails
  • Test get claimant
  • Test claim history tracking

Bug Fix

  • Renamed \metadata\ column to \extra_data\ in notification.py (SQLAlchemy reserved word conflict)

Test Results

\
7 passed in 4.93s
\\

Closes #16

Summary by CodeRabbit

  • New Features

    • Bounty claiming and unclaiming with complete claim history tracking
    • Solution submission management and listing for bounties
    • Claimant information and claim status lookup
  • Changes

    • Bounty API endpoint paths restructured
    • Search and autocomplete endpoints removed
    • Notification metadata field renamed to extra_data
    • Bounty tier naming simplified (T1, T2, T3)

- Add CLAIMED status to BountyStatus enum
- Add claim/unclaim endpoints to bounties API
- Add claimant info to BountyResponse
- Add claim history tracking with ClaimHistoryRecord
- Add tests for claim lifecycle operations

Endpoints:
- POST /api/bounties/{id}/claim - Claim a bounty
- DELETE /api/bounties/{id}/claim - Release a claim
- GET /api/bounties/{id}/claimant - Get current claimant
- GET /api/bounties/{id}/claim-history - Get claim history

Fix: notification.py metadata column renamed to extra_data (SQLAlchemy reserved word)
@HuiNeng6
Copy link
Author

Closing to create clean PR

@github-actions
Copy link

⚠️ Missing Solana wallet address

@HuiNeng6, your PR doesn't include a Solana wallet address. We need this to send your $FNDRY bounty payout.

Please edit your PR description and add your Solana wallet address.

You have 24 hours to add your wallet or this PR will be automatically closed.


SolFoundry Review Bot

@github-actions
Copy link

⚠️ Changes Requested (Fix #1) (Score: 5.2/10 — minimum: 6/10)

Issues found:

  • [GPT-5.4] Spec completeness gaps: the claim lifecycle is missing several required product behaviors, including reputation-based validation, tier-specific rules, deadline automation, and GitHub integration.
  • [GPT-5.4] Structural coherence concerns: the bounty models and router appear to have been expanded in a way that introduces naming and lifecycle inconsistencies relative to the existing application design.
  • [GPT-5.4] Test coverage is too narrow for an auth-sensitive backend feature; the current coverage does not convincingly exercise the full set of required success and failure paths.
  • [GPT-5.4] There are signs of partial integration risk, where some submitted changes may not fully align with the project’s established persistence and API patterns.
  • [Gemini 2.5 Pro] The implementation is missing key business logic required by the specification, such as rule-based validation, automated deadline management, and third-party service integrations.

Suggestions:

  • [GPT-5.4] Revisit the feature against the issue spec and validate each acceptance criterion as a first-class requirement, especially the claim rules, deadline behavior, and external integration points.
  • [GPT-5.4] Tighten project coherence by keeping the bounty lifecycle model consistent across API, service, and persistence layers, with clear separation of responsibilities.
  • [GPT-5.4] Expand test coverage to include negative paths, lifecycle transitions, and authorization-sensitive scenarios so the implementation is verifiably production-ready.

Please address these items and push an update.


SolFoundry Review Bot

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR refactors the bounty API from a search/autocomplete-focused design to a CRUD-and-claim-based architecture. The router prefix moves to /api/bounties with removal of GET /search and GET /autocomplete endpoints. Added endpoints handle bounty creation, listing (with filters for status, tier, skills), retrieval, updates, deletion, and lifecycle operations for submissions and claiming (POST/DELETE claim, GET claimant, GET claim history). Models are redesigned with BountyTier enum values renamed (TIER_1/2/3 → T1/T2/T3), BountyStatus updated (removed CANCELLED, added IN_PROGRESS and PAID), and new models introduced for claim tracking and submissions. The service layer replaces SQLAlchemy-backed search functionality with an in-memory synchronous CRUD service including claim state transitions validated against VALID_STATUS_TRANSITIONS. A notification model field is renamed (metadataextra_data). New tests validate claim, unclaim, claimant retrieval, and claim history functionality using an autouse fixture to isolate test state.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

approved, paid

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements core claim endpoints and models (POST/DELETE /claim, GET /claimant, GET /claim-history) but lacks deadline enforcement, reputation gates, T2/T3 differentiation, GitHub integration, auto-release logic, and background tasks required by Issue #16. Add reputation validation gates, implement deadline-based auto-release with background task, integrate GitHub API for issue comments, differentiate T2/T3 claim rules, and add deadline enforcement logic.
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and directly describes the main change: implementing a bounty claiming system, which is the primary focus of this changeset.
Out of Scope Changes check ✅ Passed The PR includes changes to bounty.py models, bounty_service.py service layer, bounties.py API router, main.py mount configuration, notification.py field rename, and a new test file, all directly supporting the bounty claiming feature and addressing the linked issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Important

Merge conflicts detected (Beta)

  • Resolve merge conflict in branch fix/claiming-clean
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-requested fix-1 missing-wallet PR is missing a Solana wallet for bounty payout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant