Skip to content

Accept resolve and reference verbs in bounty checks#554

Open
zzzzzzzzzzzzzzm wants to merge 1 commit into
ramimbo:mainfrom
zzzzzzzzzzzzzzm:codex/b406-reference-verbs
Open

Accept resolve and reference verbs in bounty checks#554
zzzzzzzzzzzzzzm wants to merge 1 commit into
ramimbo:mainfrom
zzzzzzzzzzzzzzm:codex/b406-reference-verbs

Conversation

@zzzzzzzzzzzzzzm
Copy link
Copy Markdown

@zzzzzzzzzzzzzzm zzzzzzzzzzzzzzm commented May 28, 2026

Summary

  • accept Resolve(s) #N and Reference(s) #N bounty refs in submission and queue health checks
  • align the local quality scripts with the webhook parser, which already supports these GitHub-style linking verbs
  • add regression coverage for both scripts

Refs #406

Validation

  • .\\.venv\\Scripts\\python.exe -m pytest tests\\test_submission_quality_gate.py tests\\test_pr_queue_health.py -q -> 34 passed
  • .\\.venv\\Scripts\\python.exe -m ruff check scripts\\submission_quality_gate.py scripts\\pr_queue_health.py tests\\test_submission_quality_gate.py tests\\test_pr_queue_health.py -> passed
  • .\\.venv\\Scripts\\python.exe -m ruff format --check scripts\\submission_quality_gate.py scripts\\pr_queue_health.py tests\\test_submission_quality_gate.py tests\\test_pr_queue_health.py -> 4 files already formatted
  • .\\.venv\\Scripts\\python.exe -m mypy scripts\\submission_quality_gate.py scripts\\pr_queue_health.py -> success
  • .\\.venv\\Scripts\\python.exe -m pytest -q -> 416 passed

Summary by CodeRabbit

  • New Features

    • Pull request and submission processing now recognize "references" and "resolves" keywords when linking to bounties.
  • Tests

    • Added test coverage for new keyword recognition patterns.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

This PR expands bounty-reference pattern recognition across two scripts. The BOUNTY_REF_RE regex in both pr_queue_health.py and submission_quality_gate.py now matches "references" and "resolves" keywords alongside existing patterns when extracting issue numbers from PR bodies and submission text. Two tests validate that the new keywords are correctly recognized.

Changes

Bounty reference pattern expansion

Layer / File(s) Summary
Bounty reference regex expansion
scripts/pr_queue_health.py, scripts/submission_quality_gate.py
Both scripts update BOUNTY_REF_RE from \b(?:bounty|refs?|fixes|closes|claims?)\s+#(\d+) to \b(?:bounty|refs?|references?|fixes|closes|claims?|resolves?)\s+#(\d+), extending keyword matching to include "reference(s)" and "resolve(s)" while maintaining numeric issue reference capture.
Test coverage for reference keyword variants
tests/test_pr_queue_health.py, tests/test_submission_quality_gate.py
New test test_pr_queue_health_accepts_resolve_and_reference_words verifies queue analysis accepts "Resolves #310" and "References #310" in PR bodies. New parameterized test test_submission_quality_gate_accepts_resolve_and_reference_words validates "Resolves #319", "Reference #319", and "References #319" all pass evaluation with correct bounty reference extraction.

Possibly related PRs

  • ramimbo/mergework#438: Updates the same BOUNTY_REF_RE patterns with alternative keyword variants.
  • ramimbo/mergework#324: Introduced the PR queue health tool and associated bounty-reference extraction logic.
  • ramimbo/mergework#342: Updates submission gate bounty-reference detection and warning logic for related pattern usage.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Bounty Pr Focus ⚠️ Warning Guidance messages still omit "Resolve(s)" and "Reference(s)" verbs; test coverage missing singular verb forms ("Resolve #N"). Update error messages in both scripts and add singular "Resolve" test cases to match expanded regex behavior.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concretely describes the main change: expanding bounty reference checks to accept 'resolve' and 'reference' verbs, which matches the core objective.
Description check ✅ Passed The description covers the summary, validation steps, and test evidence, though it deviates from the template format by using a 'Validation' section instead of the prescribed 'Evidence' and 'Test Evidence' structure.
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 PR contains only technical regex updates for bounty reference detection; no investment, price, cash-out, payout claims, or security details disclosed.

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

@Baijack-star Baijack-star 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 ac7fadf3ecc30fc09b7c8a737a9af591f08662e0 for the reference-verb parser change.

Thanks for tightening these two local gates. The focused tests pass, but I found one remaining consistency gap with the stated goal of aligning these scripts with the webhook parser.

app/webhooks/github.py accepts the full GitHub-style close/fix/resolve verb families: close, closes, closed, fix, fixes, fixed, resolve, resolves, and resolved, plus reference(s). This PR only extends the script regexes to references? and resolves?, so both scripts still reject several forms the webhook would pay from. On this head:

Fix #319         gate=fail queue_missing=1 webhook=[319]
Fixed #319       gate=fail queue_missing=1 webhook=[319]
Close #319       gate=fail queue_missing=1 webhook=[319]
Closed #319      gate=fail queue_missing=1 webhook=[319]
Resolved #319    gate=fail queue_missing=1 webhook=[319]

Those are not obscure aliases: they are part of GitHub's normal closing keyword family. That means an agent can still pass the accepted-label webhook path but fail the pre-submission gate or appear as missing a bounty reference in queue health. Please mirror the webhook pattern for the same verb families in both scripts and add regression rows for the missed forms.

Validation run locally on this head:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 34 passed
  • ./.venv/bin/python -m ruff check scripts/pr_queue_health.py scripts/submission_quality_gate.py tests/test_pr_queue_health.py tests/test_submission_quality_gate.py -> passed
  • ./.venv/bin/python -m ruff format --check scripts/pr_queue_health.py scripts/submission_quality_gate.py tests/test_pr_queue_health.py tests/test_submission_quality_gate.py -> already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m mypy scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c3425413-210f-4793-b167-37807dafe3e3

📥 Commits

Reviewing files that changed from the base of the PR and between d8532d4 and ac7fadf.

📒 Files selected for processing (4)
  • scripts/pr_queue_health.py
  • scripts/submission_quality_gate.py
  • tests/test_pr_queue_health.py
  • tests/test_submission_quality_gate.py

Comment on lines +11 to +14
BOUNTY_REF_RE = re.compile(
r"\b(?:bounty|refs?|references?|fixes|closes|claims?|resolves?)\s+#(\d+)",
re.IGNORECASE,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update missing-reference guidance to match accepted verbs.

The parser now accepts reference(s) and resolve(s), but the missing-reference message still only advertises Bounty, Refs, and /claim. Please align the guidance string so users see the full valid set.

Comment on lines +14 to +17
BOUNTY_REF_RE = re.compile(
r"\b(?:bounty|refs?|references?|fixes|closes|claims?|resolves?)\s+#(\d+)",
re.IGNORECASE,
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep submission error text consistent with expanded regex.

BOUNTY_REF_RE now accepts reference(s) and resolve(s), but the failure hint still documents only Bounty, Refs, and /claim. Updating that message will prevent avoidable user confusion.

Comment on lines +130 to +155
def test_pr_queue_health_accepts_resolve_and_reference_words() -> None:
report = analyze_queue(
{
"bounties": [{"number": 310, "state": "OPEN", "awards_remaining": 1}],
"pull_requests": [
{
"number": 8,
"title": "Harden bounty submission checks",
"body": "Resolves #310",
"merge_state": "clean",
"labels": [],
},
{
"number": 9,
"title": "Harden bounty queue checks",
"body": "References #310",
"merge_state": "clean",
"labels": [],
},
],
}
)

assert report["summary"]["missing_bounty_references"] == 0
assert report["missing_bounty_references"] == []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add singular verb coverage for this regression test.

This test validates plural forms, but not singular Resolve #310 / `Reference `#310, which are also accepted by the regex. Add those cases to lock the contract.

As per coding guidelines, “tests/**/*.py: Do not request docstrings. Focus on whether tests prove the changed behavior and include negative, replay, boundary, or regression cases where relevant.”

Comment on lines +69 to +89
def test_submission_quality_gate_accepts_resolve_and_reference_words() -> None:
for text in ("Resolves #319", "Reference #319", "References #319"):
result = evaluate_submission(
{
"submission_text": f"""
Summary:
Harden the bounty reference parser.

{text}

Validation:
- pytest passed.
""",
"bounties": [{"number": 319, "state": "OPEN", "awards_remaining": 1}],
"pull_requests": [],
}
)

assert result["status"] == "pass"
assert result["bounty_reference"] == 319

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Include Resolve #319`` in the new keyword regression set.

You already cover Resolves and Reference(s). Add singular Resolve to fully pin the expanded regex behavior.

As per coding guidelines, “tests/**/*.py: Do not request docstrings. Focus on whether tests prove the changed behavior and include negative, replay, boundary, or regression cases where relevant.”

@tinyopsstudio
Copy link
Copy Markdown

Reviewed PR #554 at ac7fadf3ecc30fc09b7c8a737a9af591f08662e0 for the local bounty-reference parser surfaces.

Evidence checked:

  • inspected scripts/pr_queue_health.py, scripts/submission_quality_gate.py, tests/test_pr_queue_health.py, and tests/test_submission_quality_gate.py;
  • confirmed both local parsers now accept GitHub-style resolve / resolves and reference / references issue-linking verbs while preserving the existing bounty/ref/fix/close/claim forms;
  • confirmed the new queue-health regression clears missing_bounty_references when PR bodies use Resolves #310 and References #310;
  • confirmed the new submission-quality regression passes Resolves #319, Reference #319, and References #319 and records the expected bounty reference;
  • checked the webhook parser boundary in app/webhooks/github.py; it already accepts resolve/reference forms, so this aligns the local preflight scripts with the accepted-label path.

Validation:

  • ad hoc parser probe across both scripts for Resolve #310, Resolves #310, Reference #310, and References #310 -> queue missing-reference count 0 and submission gate pass / bounty reference 310 for all four forms
  • focused regressions: tests/test_submission_quality_gate.py::test_submission_quality_gate_accepts_resolve_and_reference_words and tests/test_pr_queue_health.py::test_pr_queue_health_accepts_resolve_and_reference_words -> 2 passed
  • tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 34 passed
  • full test suite -> 416 passed
  • Ruff check on the touched scripts/tests -> passed
  • Ruff format check on the touched scripts/tests -> 4 files already formatted
  • mypy scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success
  • git diff --check origin/main...HEAD -> clean
  • GitHub PR checks showed 1 passing check and no failures when rechecked after the initial CodeRabbit pending state

Assessment: no blocker found in this parser slice. The change is focused, covered on both local gates, and does not add private data, wallet material, production mutation, price, liquidity, exchange, bridge, off-ramp, or fabricated payout claims.

@tinyopsstudio
Copy link
Copy Markdown

Correction to my prior comment: after rechecking the current review thread, I agree the current head still has a merge blocker.

My validation covers the newly added resolve / resolves and reference / references forms only. It should not be read as a full no-blocker approval for merge.

The remaining gap is the one already called out in review: app/webhooks/github.py accepts the broader GitHub closing keyword family (fix, fixes, fixed, close, closes, closed, resolve, resolves, resolved, plus reference(s)), while the two local scripts still do not accept all of those forms. To fully align the local gates with the webhook parser, this PR should mirror that verb family in both script regexes and add regression rows for the missed forms.

Copy link
Copy Markdown

@eliasx45 eliasx45 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 ac7fadf3ecc30fc09b7c8a737a9af591f08662e0.

Verdict: request changes.

The behavioral change is small and reasonable: both queue-health and submission-quality parsing now recognize reference(s) and resolve(s) style bounty references, with focused tests for those cases. The branch itself is stale against current main, though, and cannot be merged cleanly as submitted.

Evidence:

  • Current diff is scoped to scripts/pr_queue_health.py, scripts/submission_quality_gate.py, tests/test_pr_queue_health.py, and tests/test_submission_quality_gate.py.
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_pr_queue_health.py tests\test_submission_quality_gate.py -q -> 34 passed.
  • .\.venv\Scripts\python.exe -m ruff check scripts\pr_queue_health.py scripts\submission_quality_gate.py tests\test_pr_queue_health.py tests\test_submission_quality_gate.py -> passed.
  • .\.venv\Scripts\python.exe -m ruff format --check scripts\pr_queue_health.py scripts\submission_quality_gate.py tests\test_pr_queue_health.py tests\test_submission_quality_gate.py -> already formatted.
  • git diff --check origin/main...HEAD -> clean.
  • git merge-tree --write-tree origin/main HEAD -> conflicts.

Blocking issue:

  • The branch conflicts with current main in all four touched files: scripts/pr_queue_health.py, scripts/submission_quality_gate.py, tests/test_pr_queue_health.py, and tests/test_submission_quality_gate.py.

Required fix: rebase or merge current main, resolve those conflicts, and rerun the same focused tests/ruff checks on the resolved branch. Once the merge state is clean, the actual parser/test change should be straightforward to re-review.

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