Scope MCP work proof guidance by repo#352
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds an optional normalized ChangesRepository-scoped work proof submission
Security hardening and typing/test tweaks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds repo-scoped selection for the submit_work_proof MCP tool so issue_number lookups can disambiguate bounties across repositories.
Changes:
- Add optional
repoargument parsing/validation and require it to be used only withissue_number. - Apply repo scoping to the bounty lookup query (case-insensitive match).
- Add tests covering repo-scoped selection and new invalid selector cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_api_mcp.py | Adds coverage for repo-scoped issue_number selection and validates new selector rules. |
| app/mcp.py | Updates MCP tool description to mention repo and output format options. |
| app/main.py | Implements repo argument parsing and applies repo scoping to issue_number bounty lookup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if repo is None: | ||
| return None | ||
| if len(repo) > 200: | ||
| raise ValueError("repo is too long") |
| Bounty.issue_number == positive_int_arg("issue_number") | ||
| ) | ||
| if repo_selector is not None: | ||
| issue_query = issue_query.where(func.lower(Bounty.repo) == repo_selector) |
| "Return submission instructions, optionally for a bounty_id or issue_number " | ||
| "and repo, with text or json format" |
TateLyman
left a comment
There was a problem hiding this comment.
Blocking issue: current head fails the required type check because app/ledger/service.py removed the CursorResult casts around the conditional update(...) calls in pay_bounty() and close_bounty(), but the code still reads claimed.rowcount. SQLAlchemy's typed Session.execute() result is inferred as Result[Any], so mypy rejects rowcount. This is also visible in hosted CI.\n\nEvidence:\n- GitHub Quality, readiness, docs, and image checks is failing in the Type check step.\n- Local repro: uv run --extra dev python -m mypy app/ledger/service.py app/main.py app/mcp.py -> app/ledger/service.py:670: error: "Result[Any]" has no attribute "rowcount" and app/ledger/service.py:741: error: "Result[Any]" has no attribute "rowcount".\n- The failing lines are the post-update guards in pay_bounty() and close_bounty(). Restoring the CursorResult[Any] cast or otherwise typing those update results as a cursor result should unblock mypy.\n\nAdditional validation:\n- uv run --extra dev python -m pytest tests/test_api_mcp.py::test_mcp_submit_work_proof_scopes_issue_number_by_repo tests/test_api_mcp.py::test_mcp_submit_work_proof_rejects_invalid_bounty_selectors -q -> 12 passed.\n- uv run --extra dev python -m pytest tests/test_security.py::test_oauth_next_path_rejects_external_or_headerlike_paths -q -> 14 passed.\n- uv run --extra dev ruff check app/ledger/service.py app/main.py app/mcp.py tests/test_api_mcp.py tests/test_security.py -> passed.\n- uv run --extra dev ruff format --check app/ledger/service.py app/main.py app/mcp.py tests/test_api_mcp.py tests/test_security.py -> passed.\n- git diff --check origin/main...HEAD -> clean.\n\nScope note: this PR also includes OAuth redirect hardening and ledger typing edits beyond the repo-scoped MCP guidance, so after the mypy fix it may be worth keeping only the distinct #315 change if PR #351 remains the cleaner version.
Refs #315
Bounty #315
Summary
reposelector for MCPsubmit_work_proofcalls that useissue_number.repoand structured/text formats.Validation
python -m pytest tests/test_api_mcp.py -k submit_work_proofpython -m pytestpython -m ruff check .python -m ruff format --check .python -m mypy appSummary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests