Skip to content

Bound parsed bounty references#477

Open
jtc268 wants to merge 1 commit into
ramimbo:mainfrom
jtc268:codex/b406-bound-bounty-refs-195314
Open

Bound parsed bounty references#477
jtc268 wants to merge 1 commit into
ramimbo:mainfrom
jtc268:codex/b406-bound-bounty-refs-195314

Conversation

@jtc268
Copy link
Copy Markdown

@jtc268 jtc268 commented May 26, 2026

Summary

  • skip oversized numeric bounty references in submission and PR queue parsing instead of crashing on Python's integer conversion guard
  • preserve valid bounty refs that appear alongside an oversized ref
  • add regressions for both submission_quality_gate.py and pr_queue_health.py

Refs #406.

Root cause

Both scripts converted every Refs #<digits> match with int(...). A very long digit run raises ValueError before the tools can return a controlled missing/valid bounty-reference result.

Validation

  • uv run --extra dev python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q
  • uv run --extra dev ruff check scripts/submission_quality_gate.py scripts/pr_queue_health.py tests/test_submission_quality_gate.py tests/test_pr_queue_health.py
  • uv run --extra dev 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
  • uv run --extra dev python -m mypy scripts/submission_quality_gate.py scripts/pr_queue_health.py
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Improved bounty reference parsing to safely ignore oversized or invalid reference values.
    • Added defensive error handling to prevent processing of malformed inputs.
  • Tests

    • Added test coverage for edge cases with oversized numeric bounty references.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

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: 5ea1b131-ff35-4849-826f-c78ce60af62b

📥 Commits

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

📒 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

📝 Walkthrough

Walkthrough

Both pr_queue_health.py and submission_quality_gate.py add a MAX_BOUNTY_REF constant and update their bounty reference extraction logic to filter oversized numeric references. Each module includes corresponding test coverage validating that excessively large numeric Refs tokens are safely ignored.

Changes

Bounty reference capping for oversized numeric refs

Layer / File(s) Summary
Bounty ref capping in pr_queue_health
scripts/pr_queue_health.py, tests/test_pr_queue_health.py
MAX_BOUNTY_REF constant caps allowable ref integers. _bounty_refs converts regex matches to int, filters refs exceeding the cap, and returns deduplicated sorted list. Test test_pr_queue_health_ignores_oversized_numeric_bounty_refs verifies oversized refs are ignored.
Bounty ref capping in submission_quality_gate
scripts/submission_quality_gate.py, tests/test_submission_quality_gate.py
MAX_BOUNTY_REF constant caps allowable ref integers with defensive try/except wrapping. _bounty_refs skips non-integer matches and filters refs exceeding the cap. Test test_submission_quality_gate_ignores_oversized_numeric_bounty_refs verifies oversized refs are ignored while valid refs are kept.

Possibly related PRs

  • ramimbo/mergework#325: Both PRs modify scripts/submission_quality_gate.py bounty-reference parsing behavior.
  • ramimbo/mergework#438: Both PRs modify the same bounty-reference extraction logic in scripts/pr_queue_health.py and scripts/submission_quality_gate.py.
  • ramimbo/mergework#313: Both PRs implement defensive handling for oversized numeric identifiers across different contexts.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Bound parsed bounty references' directly names the changed surface and accurately reflects the main change of adding bounds to bounty reference parsing.
Description check ✅ Passed The description covers the summary, root cause, validation steps, and related bounty reference, matching the template structure with all critical sections completed.
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 477 adds bounty reference bounds-checking and documentation. README and AGENTS.md correctly describe MRWK as native to the ledger and reference future bridges. No problematic claims found.
Bounty Pr Focus ✅ Passed PR changes match stated files: two scripts modified with MAX_BOUNTY_REF and try/except parsing, two focused tests added. No unrelated scope creep; narrowly targets Bounty #406 issue.

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

@carpedkm carpedkm left a comment

Choose a reason for hiding this comment

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

Reviewed PR #477 at current head 54fd6264bf8fbde3c15a6e669cb3f11275d361bc. No blocker found.

Evidence checked:

  • The 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.
  • Both bounty-reference parsers now skip oversized numeric matches instead of letting Python integer conversion limits abort the queue/gate tools.
  • Valid bounty references that appear alongside an oversized ref are preserved; I also manually read back both helper paths and confirmed Refs #<5000 digits> plus Refs #406 resolves to [406] in both scripts.
  • The added regressions cover both the PR queue analyzer and submission quality gate path.
  • GitHub checks are passing: CodeRabbit and Quality, readiness, docs, and image checks.

Validation run locally on this head:

  • ./.venv/bin/python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q -> 34 passed
  • ./.venv/bin/python -m pytest -q -> 416 passed
  • ./.venv/bin/python -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/bin/python -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/bin/python -m mypy scripts/submission_quality_gate.py scripts/pr_queue_health.py -> success
  • ./.venv/bin/python scripts/docs_smoke.py -> docs smoke ok
  • git diff --check origin/main...HEAD -> clean

This is a narrow defensive fix and looks ready to merge from my review.

Copy link
Copy Markdown

@er1c-cartman er1c-cartman 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 54fd6264bf8fbde3c15a6e669cb3f11275d361bc. No blocker found.

What I checked:

  • The diff is limited to scripts/submission_quality_gate.py, scripts/pr_queue_health.py, and their tests.
  • Both bounty-reference parsers now handle Python's huge-integer conversion guard by skipping an oversized numeric #<digits> reference instead of aborting the whole tool.
  • Valid references that appear alongside the oversized one are preserved, so a body like Refs #<5000 digits> followed by Refs #406 still resolves to the actionable bounty reference.
  • The new regressions cover both affected surfaces: submission quality gate and PR queue health.

Validation I ran on this head:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest tests/test_submission_quality_gate.py tests/test_pr_queue_health.py -q
# 34 passed
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m pytest -q
# 416 passed
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev ruff check scripts/submission_quality_gate.py scripts/pr_queue_health.py tests/test_submission_quality_gate.py tests/test_pr_queue_health.py
# All checks passed!
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev 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
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python -m mypy scripts/submission_quality_gate.py scripts/pr_queue_health.py
# Success: no issues found in 2 source files
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --extra dev python scripts/docs_smoke.py
# docs smoke ok
git diff --check origin/main...HEAD
# clean

GitHub status readback for 54fd6264bf8fbde3c15a6e669cb3f11275d361bc: CodeRabbit is successful. This looks ready from my 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.

3 participants