Skip to content

Conversation

saidsef
Copy link
Owner

@saidsef saidsef commented Jul 21, 2025

This PR introduces significant improvements to the GitHub PR/issue analyzer functions:

Key Changes:

  • Changed all function return types from strings to structured dictionaries with status/message format
  • Updated logging to use consistent dictionary format with status codes
  • Improved error handling and documentation across all functions
  • Made return formats more consistent and machine-readable
  • Added more detailed docstrings explaining the return structure

Benefits:

  • Better structured output that's easier to parse programmatically
  • More consistent error handling and logging
  • Improved developer experience when working with the API
  • Better alignment with REST API best practices

Related PR: modelcontextprotocol/python-sdk#993

resolves: #74

@Copilot Copilot AI review requested due to automatic review settings July 21, 2025 17:58
@saidsef saidsef added the enhancement New feature or request label Jul 21, 2025
@saidsef saidsef self-assigned this Jul 21, 2025
@saidsef saidsef added the enhancement New feature or request label Jul 21, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes the return types of multiple async functions in the GitHub issues/PR analyzer from string-based returns to structured dictionary returns. The primary goal is to improve API consistency and enable better programmatic handling of responses by providing status information alongside messages.

  • Changes function return type annotations from str to Dict[str, Any]
  • Updates function implementations to return structured dictionaries with "status" and "message" keys
  • Standardizes logging format to use structured dictionaries instead of formatted strings

Copy link

github-actions bot commented Jul 21, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

github-actions[bot]
github-actions bot previously approved these changes Jul 21, 2025
github-actions[bot]
github-actions bot previously approved these changes Jul 21, 2025
github-actions[bot]
github-actions bot previously approved these changes Jul 22, 2025
@saidsef saidsef changed the title feat: functions annottation to dict feat: standardize GitHub API functions return types and improve error handling Jul 22, 2025
@saidsef
Copy link
Owner Author

saidsef commented Jul 22, 2025

/code pr

Copy link
Owner Author

@saidsef saidsef left a comment

Choose a reason for hiding this comment

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

🤖

  • Good practice changing returns to dicts with status and messages for consistency.
  • In get_github_pr_diff: consider returning pr_diff actual content, currently returns strified pr_diff in success dict which may limit usability.
  • In get_github_pr_content: correctly return pr_info dict on success, no stringification needed.
  • Update logging calls to use dicts with status and message improves log clarity.
  • In update_github_pr_description and others: good to capture and return error messages as dict.
  • In list_github_issues_prs: ensure "issue" param is well documented and validated ('pr' or 'issue') to avoid misusage.
  • In create_github_issue and update_github_issue, labels argument kept as list[str]; confirm this matches self.gi methods signature.
  • In get_ipv4_ipv6_info: combines ipv6 inside ipv4 dict under 'ipv6' key, cleanly done.
  • Across: consider minor consistency in log message formats, e.g. "No changes..." logs as 'error' may be better as 'info' or 'warning' depending on intent.
  • Consider adding type hints imports for Dict, Any or use what’s standard for this file.
  • No visible errors flagged on modified lines, tidy and structured code improvements.

> gpt-4.1-mini [pr | 3]

@saidsef saidsef changed the title feat: standardize GitHub API functions return types and improve error handling feat: standardise GitHub API functions return types and improve error handling Jul 22, 2025
@saidsef saidsef merged commit 7cc94a9 into main Jul 23, 2025
5 checks passed
@saidsef saidsef deleted the types-dict branch July 23, 2025 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: standardize GitHub API functions return types and improve error handling

1 participant