Skip to content

Refs #406: Align script bounty reference verbs#555

Open
Baijack-star wants to merge 4 commits into
ramimbo:mainfrom
Baijack-star:codex/b406-script-linking-verbs
Open

Refs #406: Align script bounty reference verbs#555
Baijack-star wants to merge 4 commits into
ramimbo:mainfrom
Baijack-star:codex/b406-script-linking-verbs

Conversation

@Baijack-star
Copy link
Copy Markdown

@Baijack-star Baijack-star commented May 28, 2026

Summary

  • align the submission quality gate and PR queue health bounty-reference regexes with the webhook's GitHub linking verb families
  • accept fix/fixes/fixed, close/closes/closed, resolve/resolves/resolved, ref(s), reference(s), bounty, and /claim style references
  • add suffix-boundary regressions so suffixed references such as Fixes #<issue>abc, Fixes #<issue>_abc, and Fixes #<issue>-abc do not get parsed as issue references
  • keep both direct script entrypoints working after the shared parser extraction

Refs #406

Validation

  • ./.venv/bin/python scripts/pr_queue_health.py --help -> ok
  • ./.venv/bin/python scripts/submission_quality_gate.py --help -> ok
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 42 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest -q -> 424 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 -> 4 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m mypy scripts/bounty_refs.py scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success
  • git diff --check -> clean

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

📝 Walkthrough

Walkthrough

Adds a shared bounty-reference regex module and switches two validation scripts to import and use it; updates their failure messages and extends tests to accept many GitHub linking keyword variants and to reject invalid suffixed references.

Changes

Bounty reference keyword expansion

Layer / File(s) Summary
Shared bounty ref regex
scripts/bounty_refs.py, scripts/__init__.py
Adds LINKED_BOUNTY_VERBS and a compiled BOUNTY_REF_RE; adds module docstring to scripts/__init__.py.
Validation script updates
scripts/pr_queue_health.py, scripts/submission_quality_gate.py
Both scripts now import BOUNTY_REF_RE instead of defining local regexes and update their "missing_bounty_reference"/failure detail messages to list accepted reference formats (including Fixes #<issue>).
Test coverage for expanded keyword variants
tests/test_pr_queue_health.py, tests/test_submission_quality_gate.py
Adds tests that iterate accepted GitHub linking keyword variants and assert they are recognized, adds tests that reject suffixed invalid references (#310abc), adds entrypoint --help subprocess checks, and updates expected report/assertion text.

Possibly related PRs

  • ramimbo/mergework#438: Both PRs modify accepted /claim #<issue> patterns and update missing-bounty-reference messaging/tests.
  • ramimbo/mergework#324: Overlaps on scripts/pr_queue_health.py bounty-reference detection and tests.
  • ramimbo/mergework#325: Overlaps on scripts/submission_quality_gate.py bounty-reference parsing and messaging.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue #123 is about normalizing GitHub account lookup inputs, which is unrelated to the PR's objective of aligning script bounty reference verbs. No code in this PR addresses account canonicalization or account-path coverage. Verify the correct linked issue. Issue #406 should be linked if that is the actual blocker/objective for bounty-reference alignment.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refs #406: Align script bounty reference verbs' clearly and concretely names the changed surface—centralizing and aligning bounty-reference regex patterns across scripts.
Out of Scope Changes check ✅ Passed All changes are scoped to bounty-reference parsing, regex centralization, and test coverage. No account normalization, API changes, or MCP modifications present.
Mergework Public Artifact Hygiene ✅ Passed README correctly describes MRWK as native ledger coin with future bridges/snapshots requiring discussion; no investment/price/cash-out claims in PR changes or documentation.
Bounty Pr Focus ✅ Passed PR changes match Bounty #406 scope: centralized bounty-ref regex, GitHub linking verbs, suffix-boundary regressions, direct execution fix, tests. All 6 files in-scope; no unrelated modifications.
Description check ✅ Passed PR description covers objectives, changes, validation results, and reference to bounty issue #406.

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

@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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dbf4e60e-adec-4a8f-bc79-5441f171b60a

📥 Commits

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

📒 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 thread scripts/pr_queue_health.py Outdated
Comment thread tests/test_pr_queue_health.py
Comment thread tests/test_submission_quality_gate.py
@Baijack-star
Copy link
Copy Markdown
Author

Follow-up pushed in b3d72b10b1b7ca8a59215df2cfbbbeb029bf018f addressing the CodeRabbit comments:

  • added standalone Claim #... and Claims #... cases to both parser regression tests;
  • moved the shared bounty-reference regex into scripts/bounty_refs.py so the queue-health and submission-gate scripts use one definition;
  • added scripts/__init__.py so mypy resolves the shared module consistently.

Local validation after the follow-up: focused parser tests 36 passed, full pytest 418 passed, ruff check/format passed, mypy on the script modules passed, and git diff --check is clean.

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/test_pr_queue_health.py (1)

169-187: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Expand malformed-suffix regression cases for boundary coverage.

This test only guards Fixes #310abc``. Add _ and `-` suffixed variants (e.g., `#310_abc`, `#310-abc`) to lock the full suffix-boundary contract.

Proposed test tightening
-def test_pr_queue_health_rejects_linking_keyword_issue_suffix() -> None:
+@pytest.mark.parametrize("body", ["Fixes `#310abc`", "Fixes `#310_abc`", "Fixes `#310-abc`"])
+def test_pr_queue_health_rejects_linking_keyword_issue_suffix(body: str) -> None:
     report = analyze_queue(
         {
             "bounties": [{"number": 310, "state": "OPEN", "awards_remaining": 1}],
             "pull_requests": [
                 {
                     "number": 8,
                     "title": "Harden bounty queue checks",
-                    "body": "Fixes `#310abc`",
+                    "body": body,
                     "merge_state": "clean",
                     "labels": [],
                 }
             ],
         }
     )

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.”


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7633a3a0-5a8d-453e-aa43-7b1b3c571302

📥 Commits

Reviewing files that changed from the base of the PR and between 6da1abc and b3d72b1.

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

@tinyopsstudio
Copy link
Copy Markdown

Reviewed PR #555 at b3d72b10b1b7ca8a59215df2cfbbbeb029bf018f for the shared bounty-reference parser extraction.

I found a blocker in the current head: both public CLI scripts now fail when executed directly by path.

Evidence:

  • inspected scripts/pr_queue_health.py, scripts/submission_quality_gate.py, scripts/bounty_refs.py, and the new parser tests;
  • the parser tests pass when pytest imports the scripts as modules, but both scripts are also user-facing CLI entrypoints and the PR body validates them with .venv/bin/python ... style script paths;
  • running the current head directly fails before argparse/help can run because from scripts.bounty_refs import BOUNTY_REF_RE cannot resolve when sys.path[0] is the scripts/ directory.

Reproduction 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 -> 36 passed
  • .venv/bin/python scripts/pr_queue_health.py --help -> ModuleNotFoundError: No module named 'scripts.bounty_refs'
  • .venv/bin/python scripts/submission_quality_gate.py --help -> ModuleNotFoundError: No module named 'scripts.bounty_refs'

Expected: both direct script commands should reach argparse/help and continue to work for the documented contributor and agent workflows.

Suggested fix: keep the shared parser, but make direct script execution work too, either by using a local fallback import from bounty_refs when the package import fails, or by otherwise ensuring the repository root is on sys.path before importing scripts.bounty_refs. Add direct CLI smoke coverage for both entrypoints so this does not regress again.

@Baijack-star
Copy link
Copy Markdown
Author

Follow-up pushed in commit 0a05ac1 to cover the remaining suffix-boundary nitpick.\n\nAdded malformed linking-keyword regressions for underscore and hyphen suffixes in addition to the existing alpha suffix case:\n- Fixes #310abc, Fixes #310_abc, Fixes #310-abc in tests/test_pr_queue_health.py\n- mirrored Fixes #319abc, Fixes #319_abc, Fixes #319-abc in tests/test_submission_quality_gate.py\n\nValidation:\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_pr_queue_health.py::test_pr_queue_health_rejects_linking_keyword_issue_suffix tests/test_submission_quality_gate.py::test_submission_quality_gate_rejects_linking_keyword_issue_suffix -q -> 6 passed\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 40 passed\n- ./.venv/bin/python -m ruff check tests/test_pr_queue_health.py tests/test_submission_quality_gate.py -> passed\n- ./.venv/bin/python -m ruff format --check tests/test_pr_queue_health.py tests/test_submission_quality_gate.py -> 2 files already formatted\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m mypy scripts/bounty_refs.py scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success\n- git diff --check -> clean

@tinyopsstudio
Copy link
Copy Markdown

Current-head follow-up for PR #555 at 0a05ac1c1e51d4f9656ca980503dfbcc4faffd3c: the suffix-boundary tests were expanded, but the direct CLI blocker is still present.

Recheck evidence:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 40 passed
  • .venv/bin/python scripts/pr_queue_health.py --help -> ModuleNotFoundError: No module named 'scripts.bounty_refs'
  • .venv/bin/python scripts/submission_quality_gate.py --help -> ModuleNotFoundError: No module named 'scripts.bounty_refs'

The remaining fix is still to make scripts.bounty_refs importable when these scripts are executed directly by path, or add a local fallback import from bounty_refs, then cover both direct CLI entrypoints.

@Baijack-star
Copy link
Copy Markdown
Author

Follow-up pushed in commit 582ebde addressing the direct script entrypoint issue reported in review.\n\nReproduced before fix:\n- ./.venv/bin/python scripts/pr_queue_health.py --help failed with ModuleNotFoundError: No module named 'scripts'\n- ./.venv/bin/python scripts/submission_quality_gate.py --help failed with the same import error\n\nFix:\n- When either script is executed directly, it now adds the repository root to sys.path before importing the shared scripts.bounty_refs module.\n- Added direct --help smoke regressions for both entrypoints so package imports and direct CLI execution are both covered.\n\nValidation after fix:\n- ./.venv/bin/python scripts/pr_queue_health.py --help -> ok\n- ./.venv/bin/python scripts/submission_quality_gate.py --help -> ok\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_pr_queue_health.py::test_pr_queue_health_script_entrypoint_loads_shared_parser tests/test_submission_quality_gate.py::test_submission_quality_gate_script_entrypoint_loads_shared_parser -q -> 2 passed\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 42 passed\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest -q -> 424 passed\n- ./.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\n- ./.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 -> 4 files already formatted\n- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m mypy scripts/bounty_refs.py scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success\n- git diff --check -> clean

@tinyopsstudio
Copy link
Copy Markdown

Current-head follow-up for PR #555 at 582ebde3be56b6511005b3d48b8a0a362b2e1a10: my direct CLI blocker is fixed.

Recheck evidence:

  • .venv/bin/python scripts/pr_queue_health.py --help reaches argparse/help successfully
  • .venv/bin/python scripts/submission_quality_gate.py --help reaches argparse/help successfully
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 42 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest -q -> 424 passed
  • Ruff check/format on scripts/__init__.py, scripts/bounty_refs.py, the two scripts, and their tests -> passed / 6 files already formatted
  • mypy scripts/bounty_refs.py scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success
  • git diff --check origin/main...HEAD -> clean
  • GitHub CI Quality, readiness, docs, and image checks -> passed

No remaining blocker in my reviewed slice. CodeRabbit was still pending when I rechecked, so maintainers may still want to wait for that bot result.

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.

2 participants