Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/pr_queue_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from collections import defaultdict
from typing import Any

BOUNTY_REF_RE = re.compile(r"\b(?:bounty|refs?|fixes|closes|claims?)\s+#(\d+)", re.IGNORECASE)
BOUNTY_REF_RE = re.compile(
r"\b(?:bounty|refs?|references?|fixes|closes|claims?|resolves?)\s+#(\d+)",
re.IGNORECASE,
)
Comment on lines +11 to +14
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.

NOISY_TITLE_PREFIX_RE = re.compile(r"^\s*(?:\[[^\]]+\]\s*)+")
UNSTABLE_MERGE_STATES = {"blocked", "conflicting", "dirty", "unknown", "unstable"}
GH_TIMEOUT_SECONDS = 30
Expand Down
5 changes: 4 additions & 1 deletion scripts/submission_quality_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from urllib.error import HTTPError, URLError
from urllib.request import urlopen

BOUNTY_REF_RE = re.compile(r"\b(?:bounty|refs?|fixes|closes|claims?)\s+#(\d+)", re.IGNORECASE)
BOUNTY_REF_RE = re.compile(
r"\b(?:bounty|refs?|references?|fixes|closes|claims?|resolves?)\s+#(\d+)",
re.IGNORECASE,
)
Comment on lines +14 to +17
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.

EVIDENCE_RE = re.compile(
r"\b(pytest|ruff|mypy|validation|verified|test evidence|checks? passed)\b",
re.IGNORECASE,
Expand Down
27 changes: 27 additions & 0 deletions tests/test_pr_queue_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,33 @@ def test_pr_queue_health_accepts_claim_command_reference() -> None:
assert report["missing_bounty_references"] == []


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"] == []

Comment on lines +130 to +155
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.”


def test_pr_queue_health_markdown_report_includes_required_sections() -> None:
report = analyze_queue(
{
Expand Down
22 changes: 22 additions & 0 deletions tests/test_submission_quality_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ def test_submission_quality_gate_accepts_claim_command_reference() -> None:
} in result["checks"]


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

Comment on lines +69 to +89
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.”


def test_submission_quality_gate_fails_missing_reference() -> None:
result = evaluate_submission(
{
Expand Down