Skip to content

Share submission requirement action construction#917

Open
pqmfei wants to merge 1 commit into
ramimbo:mainfrom
pqmfei:pqmfei/846-share-submission-requirement-actions
Open

Share submission requirement action construction#917
pqmfei wants to merge 1 commit into
ramimbo:mainfrom
pqmfei:pqmfei/846-share-submission-requirement-actions

Conversation

@pqmfei
Copy link
Copy Markdown
Contributor

@pqmfei pqmfei commented Jun 5, 2026

Summary

  • add a small internal _next_action() helper for submission requirement action dictionaries
  • reuse it across open/full/closed/unknown availability actions and issue-vs-PR submission mode actions
  • add focused coverage for open PR/evidence mode action ordering and text

Bounty

Bounty #846

Duplicate/scope check

  • Public bounty API showed MRWK bounty: 100 MRWK - code cleanup and maintainability improvements #846 live/open with effective award capacity.
  • Open PR file-overlap checks found no open PR touching app/submission_requirements.py.
  • Searches for submission_requirements.py + next_actions and work_proof_submission_requirements + next_actions returned no same-scope open PR.
  • This is distinct from open page/API/MCP/helper PRs; it only consolidates the internal submission-requirements action dict construction.

Validation

  • .\.venv\Scripts\python.exe -m pytest tests\test_mcp_work_proof.py tests\test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_bounty_guidance tests\test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_generic_guidance tests\test_api_mcp.py::test_mcp_submit_work_proof_structures_terminal_bounty_availability -q -> 12 passed, 1 existing Starlette/httpx warning.
  • .\.venv\Scripts\python.exe -m pytest tests\test_mcp_work_proof.py tests\test_serializers.py tests\test_bounty_api_routes.py tests\test_api_mcp.py -q -> 145 passed, 1 existing Starlette/httpx warning.
  • .\.venv\Scripts\python.exe -m pytest -q -> 791 passed, 1 existing Starlette/httpx warning.
  • .\.venv\Scripts\python.exe -m ruff check . -> passed.
  • .\.venv\Scripts\python.exe -m ruff format --check . -> 111 files already formatted.
  • .\.venv\Scripts\python.exe -m mypy app -> success across 42 source files.
  • .\.venv\Scripts\python.exe scripts\docs_smoke.py -> docs smoke ok.
  • git diff --check origin/main...HEAD -> clean.
  • git merge-tree --write-tree origin/main HEAD -> clean tree bc3fbdda2d6aa283a9aff3365ef91c355aded568.

Scope

Maintainability-only helper extraction in app/submission_requirements.py plus focused tests. No public submission-requirements text, bounty lifecycle behavior, ledger behavior, wallet behavior, treasury behavior, payout behavior, proposal execution, admin-token behavior, private data, exchange, bridge, cash-out, or MRWK price behavior changed.

Summary by CodeRabbit

  • Refactor

    • Improved internal code structure for submission requirements handling.
  • Tests

    • Added test coverage for work proof submission requirements validation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Review Change Stack

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: 899970b9-946c-4160-8137-3668fb96c65b

📥 Commits

Reviewing files that changed from the base of the PR and between d4d0e48 and 86cc78e.

📒 Files selected for processing (2)
  • app/submission_requirements.py
  • tests/test_mcp_work_proof.py

📝 Walkthrough

Walkthrough

This PR refactors action dictionary construction in work_proof_submission_requirements by extracting a reusable _next_action() helper and applying it throughout the function's issue-submission, PR/evidence, and final action lists. A new test validates the open availability path behavior.

Changes

Action construction refactoring

Layer / File(s) Summary
Helper definition and issue-submission refactoring
app/submission_requirements.py, tests/test_mcp_work_proof.py
_next_action() helper returns id, required, and text keys. Issue-submission mode_actions converted to use the helper instead of inline dicts.
PR/evidence branch and availability selection refactoring
app/submission_requirements.py
PR/evidence mode_actions entries and first_action selection for all availability values refactored to use _next_action(), keeping existing id/text pairings intact.
Next_actions list construction refactoring
app/submission_requirements.py
Entries for check_duplicate_scope, include_review_evidence, and wait_for_maintainer_acceptance replaced with _next_action() calls while preserving list structure.
Test coverage for open availability path
tests/test_mcp_work_proof.py
New test asserts ordered next_actions IDs and validates confirm_award_slot and include_bounty_reference text payloads for availability="open".

Possibly related PRs

  • ramimbo/mergework#347: Modifies work_proof_submission_requirements structured action construction and state-dependent next_actions output.
  • ramimbo/mergework#704: Introduces and exposes the submission_requirements structure that this PR refactors action construction for.
  • ramimbo/mergework#382: Centers on work_proof_submission_requirements producing the "open" next_actions payload that this PR validates with extracted test coverage.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title directly names the changed surface—a new internal helper for constructing submission requirement actions—and is concrete and specific.
Description check ✅ Passed The description includes all required sections: summary of changes, evidence (bounty number, scope check, validation results), test coverage, and scope boundaries.
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 No investment, price, cash-out, fabricated payout, or private security claims found in modified files. MRWK used appropriately as acceptance label and reward descriptor only.
Bounty Pr Focus ✅ Passed PR correctly limits scope to app/submission_requirements.py and tests/test_mcp_work_proof.py. Refactors using _next_action helper with focused tests. No unrelated changes detected.

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

Copy link
Copy Markdown
Contributor

@szx19970521 szx19970521 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 86cc78e for #838.

This is a behavior-preserving maintainability refactor. I inspected app/submission_requirements.py and tests/test_mcp_work_proof.py and verified that _next_action() centralizes the existing action dictionary shape while preserving the same ids, required flags, and text for open/full/closed/unknown availability paths and issue-vs-PR submission modes. The new test locks the open PR/evidence ordering and representative text for confirm_award_slot and include_bounty_reference.

Validation performed locally on this exact head:

` ext
python -m pytest tests/test_mcp_work_proof.py tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_bounty_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_returns_structured_generic_guidance tests/test_api_mcp.py::test_mcp_submit_work_proof_structures_terminal_bounty_availability -q

12 passed, 1 existing warning

python -m pytest tests/test_mcp_work_proof.py tests/test_serializers.py tests/test_bounty_api_routes.py tests/test_api_mcp.py -q

145 passed, 1 existing warning

python -m ruff check app/submission_requirements.py tests/test_mcp_work_proof.py

All checks passed

python -m ruff format --check app/submission_requirements.py tests/test_mcp_work_proof.py

2 files already formatted

python -m mypy app/submission_requirements.py

Success: no issues found in 1 source file

python scripts/docs_smoke.py

docs smoke ok

`

GitHub state checked before approval: mergeable=true, CodeRabbit success, and no prior human review on this head. I did not see a hosted Quality check run for this PR head, so this approval relies on the local validation above plus the successful CodeRabbit pre-merge checks. No blocker found.

Copy link
Copy Markdown

@NiXouuuu NiXouuuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current-head review for 86cc78e. I inspected app/submission_requirements.py and tests/test_mcp_work_proof.py. The _next_action helper preserves the id/required/text action shape for open/full/closed/unknown availability, issue mode, and PR/evidence mode; the new test locks open PR/evidence action ordering plus representative confirm_award_slot and include_bounty_reference text. Local validation on this head: focused pytest -> 12 passed, 1 existing Starlette/httpx warning; tests/test_mcp_work_proof.py -> 9 passed; ruff check app/submission_requirements.py tests/test_mcp_work_proof.py -> passed; ruff format --check app/submission_requirements.py tests/test_mcp_work_proof.py -> 2 files already formatted; mypy app/submission_requirements.py -> success; python scripts/docs_smoke.py -> docs smoke ok; git diff --check origin/main...HEAD -> clean; git merge-tree origin/main HEAD -> clean tree bc3fbdda2d6aa283a9aff3365ef91c355aded568. GitHub state checked: mergeable=true, CodeRabbit status success/review skipped, no hosted check-runs exist on this head, so mergeStateStatus remains UNSTABLE because the standard quality workflow did not run. No blockers found in the focused maintainability refactor.

Copy link
Copy Markdown

@Errordog2 Errordog2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the submission requirement action-construction refactor.

Validation performed locally:

  • .venv\Scripts\python.exe -m pytest tests/test_mcp_work_proof.py -k "submission_requirements or work_proof_guidance_json or generic_work_proof_guidance" -> 8 passed
  • .venv\Scripts\python.exe -m ruff check app/submission_requirements.py tests/test_mcp_work_proof.py -> passed
  • .venv\Scripts\python.exe -m ruff format --check app/submission_requirements.py tests/test_mcp_work_proof.py -> passed
  • .venv\Scripts\python.exe -m mypy app/submission_requirements.py app/mcp_work_proof.py -> passed
  • git diff --check -> passed
  • git merge-tree $(git merge-base origin/main HEAD) origin/main HEAD -> clean merge

The helper removes repeated action dictionaries while preserving the existing open/full/closed/unknown and issue/pr submission action ordering. The new open PR-mode test covers the important default path. Looks good to me.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants