Skip to content

Share GitHub issue JSON request helper#898

Closed
sayuru-akash wants to merge 1 commit into
ramimbo:mainfrom
sayuru-akash:codex/846-github-json-request-helper
Closed

Share GitHub issue JSON request helper#898
sayuru-akash wants to merge 1 commit into
ramimbo:mainfrom
sayuru-akash:codex/846-github-json-request-helper

Conversation

@sayuru-akash
Copy link
Copy Markdown

@sayuru-akash sayuru-akash commented Jun 4, 2026

Bounty #846

Summary

  • extract a shared GitHub JSON request helper in app/github_issue_finalization.py
  • keep POST, GET, PATCH, and list-response behavior behind the existing small wrappers
  • remove the now-redundant _read_json wrapper while preserving empty-object fallback behavior for non-object responses

Why this fits #846

This is a focused maintainability cleanup in one module. It reduces repeated request/open/read boilerplate across GitHub issue finalization helpers without changing bounty lifecycle semantics, labels, comments, ledger, wallet, treasury, payout, or public API behavior.

Duplicate/current check

Validation

  • UV_CACHE_DIR=.uv-cache uv run pytest tests/test_github_issue_finalization.py -q -> 17 passed.
  • UV_CACHE_DIR=.uv-cache uv run ruff check app/github_issue_finalization.py tests/test_github_issue_finalization.py -> passed.
  • UV_CACHE_DIR=.uv-cache uv run ruff format --check app/github_issue_finalization.py tests/test_github_issue_finalization.py -> 2 files already formatted.
  • UV_CACHE_DIR=.uv-cache uv run mypy app/github_issue_finalization.py -> success.
  • git diff --check -> clean.

No private data, credentials, wallet material, payout execution, treasury mutation, ledger mutation, bridge, exchange, cash-out, MRWK price behavior, or issue mutation was used.

Summary by CodeRabbit

  • Refactor
    • Improved internal code organization for GitHub API interactions.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

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: b58b5055-f8e0-43ec-b44b-5743cb59cd19

📥 Commits

Reviewing files that changed from the base of the PR and between d4d0e48 and ad2c7d4.

📒 Files selected for processing (1)
  • app/github_issue_finalization.py

📝 Walkthrough

Walkthrough

Refactored HTTP/JSON plumbing in app/github_issue_finalization.py by introducing centralized request helpers _request_json_value() and _request_json(), then updating _post_json(), _get_json(), _get_json_list(), and _patch_json() to delegate to them. Existing timeout and decode behavior unchanged.

Changes

HTTP JSON Request Plumbing

Layer / File(s) Summary
Centralized JSON request helpers
app/github_issue_finalization.py
_request_json_value() executes opener-backed requests with timeout=10 and decodes JSON; _request_json() wraps it to guarantee dict results, replacing the older _read_json() function.
HTTP wrapper function refactoring
app/github_issue_finalization.py
_post_json(), _get_json(), _get_json_list(), and _patch_json() delegate request and decode logic to the new helpers, removing redundant per-function HTTP/JSON handling.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concretely names the changed surface: a shared GitHub JSON request helper extraction. It directly maps to the main refactoring work.
Description check ✅ Passed Description includes summary, evidence of validation, bounty tracking, scope clarity, and test results. All key template sections are adequately addressed.
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 app/github_issue_finalization.py with no documentation changes, no investment/price/cash-out claims, and existing docs properly describe MRWK as native project coin.
Bounty Pr Focus ✅ Passed PR refactors app/github_issue_finalization.py to introduce _request_json_value() and _request_json() helpers, update wrappers, and remove _read_json(). 13 test cases validate changes; no scope creep.

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

@xiefuzheng713-alt xiefuzheng713-alt 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 ad2c7d453a1e0bdf3be81a2e6dc229d62aa0fe60.

I focused on app/github_issue_finalization.py. The refactor keeps the existing _github_request() construction path, preserves the timeout=10 opener behavior, keeps empty-body JSON reads returning {}, keeps dict wrappers returning {} for non-object responses, and leaves _get_json_list() returning only dict items from list responses. The changed call sites still route POST/GET/PATCH through the same small wrappers, so this is a maintainability extraction without bounty lifecycle, label, comment, paid-finalization, ledger, wallet, or treasury behavior changes.

Validation I ran locally:

  • uv run --python 3.12 --extra dev python -m pytest tests/test_github_issue_finalization.py -q -> 17 passed.
  • uv run --python 3.12 --extra dev ruff check app/github_issue_finalization.py tests/test_github_issue_finalization.py -> passed.
  • uv run --python 3.12 --extra dev ruff format --check app/github_issue_finalization.py tests/test_github_issue_finalization.py -> 2 files already formatted.
  • uv run --python 3.12 --extra dev mypy app/github_issue_finalization.py -> success.
  • uv run --python 3.12 --extra dev python scripts/docs_smoke.py -> docs smoke ok.
  • git diff --check origin/main...HEAD -> clean.
  • git merge-tree --write-tree origin/main HEAD -> clean tree 3f2b900d8a93bca6f0637b842411d8fe8978cb05.

I also checked the open PR list for other changes touching app/github_issue_finalization.py; #898 was the only current open PR on that file. GitHub shows Quality and CodeRabbit successful and the PR merge state is CLEAN.

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