Skip to content

Ignore native bounty ids in queue refs#547

Open
tinyopsstudio wants to merge 11 commits into
ramimbo:mainfrom
tinyopsstudio:tinyops-pr-queue-native-bounty-ref
Open

Ignore native bounty ids in queue refs#547
tinyopsstudio wants to merge 11 commits into
ramimbo:mainfrom
tinyopsstudio:tinyops-pr-queue-native-bounty-ref

Conversation

@tinyopsstudio
Copy link
Copy Markdown

@tinyopsstudio tinyopsstudio commented May 27, 2026

Bounty #406

Summary:

  • keep PR queue health focused on GitHub bounty issue references instead of native MRWK bounty ids
  • ignore phrases like live bounty #66 / MRWK bounty #66 while still accepting issue #406, Refs #406, and /claim #406
  • update the missing-reference copy and add regression coverage for mixed native-bounty-id plus GitHub-issue evidence text

Evidence:

Verification:

  • uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q
  • uv run --extra dev python -m pytest -q
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Broader recognition of bounty/issue reference keywords and optional native prefixes.
  • Improvements

    • Explicit issue references now take precedence; duplicate references are de-duplicated in reports.
    • Reports add an "Issue #" wording variant.
    • Native-prefixed bounty mentions are ignored when a matching explicit issue reference exists.
  • Tests

    • Added tests covering boolean entries being ignored, native-vs-issue precedence, and missing-issue detection; updated report formatting assertions.

Review Change Stack

Bounty ramimbo#427: scripts/pr_queue_health.py
Bounty ramimbo#427: tests/test_pr_queue_health.py
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: be933268-2ce5-4199-ab10-1079f784ce0b

📥 Commits

Reviewing files that changed from the base of the PR and between 918d029 and dcf8b6b.

📒 Files selected for processing (2)
  • scripts/pr_queue_health.py
  • tests/test_pr_queue_health.py

📝 Walkthrough

Walkthrough

Expanded the bounty-reference regex to detect more keywords and optional native prefixes; adjusted extraction to deduplicate and ignore native-prefixed bounty mentions; extended the missing-bounty message wording; added tests for boolean refs, native vs explicit refs, and markdown formatting.

Changes

Bounty Reference Parsing

Layer / File(s) Summary
Pattern updates
scripts/pr_queue_health.py
BOUNTY_REF_RE regex broadened to match "bounty", "issue", "refs", "fixes", "closes", and "claims" with optional `live
Reference extraction and dedupe
scripts/pr_queue_health.py
_bounty_refs uses finditer, builds a deduplicated set of referenced numbers, excludes boolean bounty_refs entries, and skips bounty matches when a native-like prefix is present.
Messaging update and tests
scripts/pr_queue_health.py, tests/test_pr_queue_health.py
missing_bounty_reference message extended to include Issue #<issue> phrasing; added tests: test_pr_queue_health_ignores_boolean_explicit_bounty_refs, test_pr_queue_health_ignores_native_bounty_ids_when_issue_ref_is_present, and test_pr_queue_health_requires_issue_ref_when_only_native_bounty_id_is_present; adjusted expected markdown formatting.

Possibly Related PRs

  • ramimbo/mergework#438: Modifies BOUNTY_REF_RE and missing bounty references messaging to recognize /claim #<issue> formats with corresponding test updates.
  • ramimbo/mergework#413: Modifies missing bounty references and markdown reporting strings that directly interact with this PR's messaging changes.
  • ramimbo/mergework#324: Introduces bounty/refs parsing behavior that this PR extends and refines.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Ignore native bounty ids in queue refs' directly names the main changed surface and clearly summarizes the primary change in the pull request.
Description check ✅ Passed The description contains all required sections: Summary, Evidence, and Test Evidence with verification commands. It clearly explains the problem, solution, and expected behavior.
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 modifies only code files (pr_queue_health.py script/tests). No README, docs, or public comments found with investment, price, cash-out, off-ramp, fabricated payout claims, or security details.
Bounty Pr Focus ✅ Passed Diff matches stated files; BOUNTY_REF_RE expanded with native_prefix filter, _bounty_refs filters booleans, three regression tests added for native bounty scenarios. No unrelated scope.

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c075eaa7-7daa-426e-b4ea-dea56fe7d5a7

📥 Commits

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

📒 Files selected for processing (2)
  • scripts/pr_queue_health.py
  • tests/test_pr_queue_health.py

Comment thread tests/test_pr_queue_health.py
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.

I found one correctness issue that still leaves the advertised native-id case noisy.

The new pattern only suppresses live bounty #... and MRWK bounty #..., but the PR title and summary describe ignoring native bounty ids in general. A body that uses the natural wording native bounty #66 / issue #406 still matches bounty #66, so analyze_queue emits unknown_bounty_reference even though the GitHub issue ref is present.

Repro I ran on this branch:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python - <<'PY'
from scripts.pr_queue_health import analyze_queue
fixture = {
    "bounties": [{"number": 406, "state": "OPEN", "awards_remaining": 16}],
    "pull_requests": [{
        "number": 547,
        "title": "Refs #406: Ignore native bounty ids",
        "body": "Evidence: native bounty #66 / issue #406 preflight returned status=open.",
        "merge_state": "clean",
        "labels": [],
    }],
}
report = analyze_queue(fixture)
print(report["summary"])
print(report["closed_bounty_references"])
PY

Observed:

{'pull_requests': 1, 'open_bounties': 1, 'closed_or_exhausted_bounties': 0, 'closed_bounty_references': 1, 'missing_bounty_references': 0, 'dirty_or_unstable_merge_state': 0, 'needs_info': 0, 'duplicate_scope_groups': 0}
[{'pull_request': 547, 'title': 'Refs #406: Ignore native bounty ids', 'url': None, 'reason': 'unknown_bounty_reference', 'detail': 'Referenced bounty #66 was not in input'}]

The focused suite itself passes (PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_pr_queue_health.py -q, 10 passed), so this likely needs an added regression case and either a broader native-id prefix list or parsing that prefers explicit issue/refs/fixes/closes/claims references over generic native bounty evidence text.

@tinyopsstudio
Copy link
Copy Markdown
Author

Addressed the requested-change case in the updated PR head db9e5e9fafbf22fc9426a8ac78773a31e740cd24.

What changed:

  • broadened the native-id filter to skip native bounty #... and internal bounty #... alongside live bounty #... and MRWK bounty #...;
  • added regression rows for both native bounty #66 / issue #406 and internal bounty #66, issue #406.

Repro from the review now returns no queue-health finding:

{'pull_requests': 1, 'open_bounties': 1, 'closed_or_exhausted_bounties': 0, 'closed_bounty_references': 0, 'missing_bounty_references': 0, 'dirty_or_unstable_merge_state': 0, 'needs_info': 0, 'duplicate_scope_groups': 0}
[]

Validation after the update:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 10 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 415 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted
  • git diff --check -> clean

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.

Thanks for the update. I rechecked the requested-change case on head db9e5e9fafbf22fc9426a8ac78773a31e740cd24; the native/internal wording that failed before is now covered and resolves cleanly to the GitHub issue reference.

Validation run locally:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_pr_queue_health.py -q -> 10 passed
  • ./.venv/bin/python -m ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • ./.venv/bin/python -m ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • git diff --check origin/main...HEAD -> clean

I also reran the ad hoc parser smoke for these bodies and each produced zero closed_bounty_references and zero missing_bounty_references:

  • native bounty #66 / issue #406
  • internal bounty #66, issue #406
  • MRWK bounty #66 / issues #406
  • live bounty #66 / issue #406

No remaining blocker from my earlier requested-change finding.

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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e058d6a8-16b4-4053-8c2b-2c85bdb0a281

📥 Commits

Reviewing files that changed from the base of the PR and between 67e738a and db9e5e9.

📒 Files selected for processing (2)
  • scripts/pr_queue_health.py
  • tests/test_pr_queue_health.py

Comment thread scripts/pr_queue_health.py
Comment thread tests/test_pr_queue_health.py
@tinyopsstudio
Copy link
Copy Markdown
Author

Addressed the latest CodeRabbit edge-case comments in PR head 2ed82bd29cbc64f13aae6736305a3835402b6760.

What changed:

  • replaced the fixed-width negative-lookbehind regex with a broader reference matcher plus a native-prefix filter, so live bounty #66 and live\tbounty #66 are ignored as native/live evidence ids;
  • kept normal non-native wording such as relive bounty #66, archive bounty #66, and plain bounty #66 as valid GitHub bounty references;
  • added a native-only negative test so a PR body with only live bounty #66 and no GitHub issue ref reports missing_bounty_reference;
  • kept the mixed native/live plus explicit GitHub issue coverage for MRWK bounty #66 maps to issue #406, native bounty #66 / issue #406, and internal bounty #66, issue #406.

Extra parser sanity check:

live bounty #66 => []
live  bounty #66 => []
live	bounty #66 => []
MRWK bounty #66 maps to issue #406 => [406]
native bounty #66 / issue #406 => [406]
internal bounty #66, issue #406 => [406]
relive bounty #66 => [66]
archive bounty #66 => [66]
bounty #66 => [66]

Validation:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 12 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 417 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted
  • git diff --check -> clean

@tinyopsstudio
Copy link
Copy Markdown
Author

Addressed the CodeRabbit whitespace/native-only follow-up on the updated PR branch.

What changed:

  • replaced the fixed-width negative-lookbehind bounty regex with an optional native-prefix capture;
  • native-prefixed bounty ids now ignore live, MRWK, native, and internal prefixes with arbitrary whitespace before bounty;
  • normal bounty references still count, including the boundary case relive bounty #406;
  • added regression coverage for live bounty #66, live\tbounty #67, and a native-bounty-only PR that must still report missing_bounty_reference.

Validation:

  • uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 11 passed
  • uv run --extra dev python -m pytest -q -> 416 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted

@tinyopsstudio
Copy link
Copy Markdown
Author

Correction/remote-branch verification: I fetched the exact TinyOps branch currently backing this PR and verified head ae62167 / PR head 2ed82bd29cbc64f13aae6736305a3835402b6760.

The branch content handles the CodeRabbit edge cases:

live bounty #66 => []
live  bounty #66 => []
live	bounty #66 => []
MRWK bounty #66 maps to issue #406 => [406]
native bounty #66 / issue #406 => [406]
internal bounty #66, issue #406 => [406]
relive bounty #66 => [66]
archive bounty #66 => [66]
bounty #66 => [66]

Validation on the fetched remote branch:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 11 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 416 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted
  • git diff --check -> clean

Note: my previous follow-up used the local patch worktree count before fetching the exact branch state; the fetched remote branch evidence above is the authoritative verification.

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.

Current-head review for PR #547 at ae621671071caf3cb44f4bae03e3ea2c3946a3f5.

The queue-health behavior looks fixed for the earlier native-id cases, but I found a merge-readiness blocker in the typed validation path: mypy scripts/pr_queue_health.py fails on the new _bounty_refs() implementation.

refs is first inferred as list[int] in the explicit bounty_refs branch:

refs = [item for item in explicit if isinstance(item, int)]

The same local name is then reassigned to set() in the text-parsing branch and used with .add(...):

refs = set()
...
refs.add(int(match.group("number")))

That makes the script fail the project's typed check:

.\.venv\Scripts\python.exe -m mypy scripts\pr_queue_health.py
scripts\pr_queue_health.py:62: error: Incompatible types in assignment (expression has type "set[Never]", variable has type "list[int]")  [assignment]
scripts\pr_queue_health.py:66: error: "list[int]" has no attribute "add"; maybe "append" or "extend"?  [attr-defined]
Found 2 errors in 1 file (checked 1 source file)

The runtime behavior and formatting checks I ran are otherwise good:

.\.venv\Scripts\python.exe -m pytest tests\test_pr_queue_health.py -q
# 11 passed

.\.venv\Scripts\python.exe -m ruff check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# All checks passed!

.\.venv\Scripts\python.exe -m ruff format --check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# 2 files already formatted

git diff --check origin/main...HEAD
# clean

Suggested fix: avoid reusing the refs local with two incompatible container types, e.g. name the explicit list separately and use refs: set[int] = set() for the parsed branch before returning sorted(refs).

@tinyopsstudio
Copy link
Copy Markdown
Author

Addressed the mypy failure reported on the latest PR #547 review in head 918d029145865f5f1dcf253c49655b5df6d3e51a.

What changed:

  • stopped reusing refs for both the explicit list[int] path and the parsed-reference set[int] path;
  • renamed the explicit list to explicit_refs;
  • annotated the parsed reference accumulator as refs: set[int].

Validation on the updated branch:

  • uv run --extra dev python -m mypy scripts/pr_queue_health.py -> success
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 11 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 416 passed
  • git diff --check -> clean

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.

Follow-up current-head review for PR #547 at 918d029145865f5f1dcf253c49655b5df6d3e51a.

My earlier requested-change finding is resolved. The _bounty_refs() implementation no longer reuses refs for both a list[int] and a set[...]; it now keeps explicit refs in explicit_refs and declares the parsed branch as refs: set[int] = set(), so the typed check passes while preserving the native-bounty-id parser behavior.

Validation I ran on the fetched PR head:

.\.venv\Scripts\python.exe -m mypy scripts\pr_queue_health.py
# Success: no issues found in 1 source file

.\.venv\Scripts\python.exe -m pytest tests\test_pr_queue_health.py -q
# 11 passed

.\.venv\Scripts\python.exe -m ruff check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# All checks passed!

.\.venv\Scripts\python.exe -m ruff format --check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# 2 files already formatted

git diff --check origin/main...HEAD
# clean

GitHub still showed CodeRabbit as pending when I checked, so this approval is scoped to the current diff, the prior mypy blocker, focused queue-health validation, formatting, and diff hygiene.

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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a066499f-d596-464b-b976-785f05000c1f

📥 Commits

Reviewing files that changed from the base of the PR and between ae62167 and 918d029.

📒 Files selected for processing (1)
  • scripts/pr_queue_health.py

Comment thread scripts/pr_queue_health.py Outdated
@tinyopsstudio
Copy link
Copy Markdown
Author

Addressed the remaining CodeRabbit boolean edge case on PR head dcf8b6b6dcd0c5edc134e95e008c63282185f9ee.

What changed:

  • filtered explicit bounty_refs with isinstance(item, int) and not isinstance(item, bool), so True and False are not interpreted as refs 1 and 0;
  • added regression coverage proving boolean-only explicit refs are ignored while a real integer ref still counts.

Validation:

  • uv run --extra dev python -m mypy scripts/pr_queue_health.py -> passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_pr_queue_health.py -q -> 12 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q -> 417 passed
  • uv run --extra dev ruff check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> passed
  • uv run --extra dev ruff format --check scripts/pr_queue_health.py tests/test_pr_queue_health.py -> 2 files already formatted
  • git diff --check -> clean

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.

Follow-up current-head review for PR #547 at dcf8b6b6dcd0c5edc134e95e008c63282185f9ee.

The remaining boolean edge case from CodeRabbit is fixed in this head. Explicit bounty_refs now filters with isinstance(item, int) and not isinstance(item, bool), so True and False are not interpreted as refs 1 and 0, while real integer refs still count. The new regression covers boolean-only refs and mixed boolean plus real integer refs.

Validation I ran on the fetched PR head:

.\.venv\Scripts\python.exe -m mypy scripts\pr_queue_health.py
# Success: no issues found in 1 source file

.\.venv\Scripts\python.exe -m pytest tests\test_pr_queue_health.py -q
# 12 passed

.\.venv\Scripts\python.exe -m ruff check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# All checks passed!

.\.venv\Scripts\python.exe -m ruff format --check scripts\pr_queue_health.py tests\test_pr_queue_health.py
# 2 files already formatted

git diff --check origin/main...HEAD
# clean

CodeRabbit was still processing when I checked, so this approval is scoped to the resolved boolean/ref parsing edge case, the prior mypy blocker, focused tests, formatting, and diff hygiene on this head.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Copy link
Copy Markdown

@barnacleagent-svg barnacleagent-svg left a comment

Choose a reason for hiding this comment

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

Verdict: APPROVED

Scope: Updates BOUNTY_REF_RE regex to ignore "live", "mrwk", "native", "internal" prefixed bounty references. Also fixes explicit_refs type check to filter out bool instances. Prevents false bounty ref detection from native bounty ID mentions.

Checklist:

  • Diff: focused regex change + type fix
  • Tests cover prefix and non-prefix cases
  • Type check fix prevents bool-passing-as-int issues
  • Follows same pattern as PR #548

Conclusion: Well-implemented. Ready to merge.

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