Add source modules and comprehensive unit tests (99% coverage)#2
Merged
Merged
Conversation
- Add four core modules: config, comment_parser, github_client, webhook_handler - Add 62 unit tests with 99% coverage - Add pyproject.toml with pytest/ruff/coverage tooling - Add .gitignore Co-Authored-By: dominicpape <dominicpape@gmx.net>
Keramikus-97
commented
Jun 6, 2026
Comment on lines
+99
to
+111
| async def list_issue_comments( | ||
| self, owner: str, repo: str, issue_number: int | ||
| ) -> list[IssueComment]: | ||
| data = await self._request("GET", f"/repos/{owner}/{repo}/issues/{issue_number}/comments") | ||
| return [ | ||
| IssueComment( | ||
| id=c["id"], | ||
| body=c.get("body") or "", | ||
| user_login=c["user"]["login"], | ||
| html_url=c["html_url"], | ||
| ) | ||
| for c in data | ||
| ] |
Owner
Author
There was a problem hiding this comment.
🚩 list_issue_comments does not handle pagination
The list_issue_comments method at src/opencode_github/github_client.py:99-111 makes a single GET request without pagination parameters. GitHub's API defaults to 30 items per page, so issues/PRs with more than 30 comments will silently return only the first page. This is fine for an initial implementation but could cause subtle data loss in production if the caller assumes all comments are returned.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
fatal: couldn't find remote ref devin/1780753521-add-modules-and-tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The repo had no source code or tests — only a README and a GitHub Actions workflow. This PR adds four Python modules implementing the integration logic implied by the workflow, plus a full test suite.
Modules added (
src/opencode_github/):config.py—Configdataclass loaded from env vars (GITHUB_TOKEN,ANTHROPIC_API_KEY,OPENCODE_MODEL, etc.) with validationcomment_parser.py— regex-based extraction of/oc//opencodecommands from comment bodies, with quoted-argument splittinggithub_client.py— asynchttpx-based GitHub REST API wrapper (GitHubClient) for PRs, comments, reactionswebhook_handler.py— webhook signature verification (HMAC-SHA256), event classification, and payload parsing forissue_comment/pull_request_review_commentTest suite (
tests/): 62 tests across 4 test files, 99.43% line coverage. Usespytest,pytest-asyncio, andrespxfor HTTP mocking.Tooling:
pyproject.tomlwithrufffor linting/formatting,pytest-covwith 80% minimum threshold.Link to Devin session: https://app.devin.ai/sessions/77c1168b8c7f448c82e6a2d0df18cda2
Requested by: @Keramikus-97