Skip to content

Add source modules and comprehensive unit tests (99% coverage)#2

Merged
Keramikus-97 merged 1 commit into
mainfrom
devin/1780753521-add-modules-and-tests
Jun 6, 2026
Merged

Add source modules and comprehensive unit tests (99% coverage)#2
Keramikus-97 merged 1 commit into
mainfrom
devin/1780753521-add-modules-and-tests

Conversation

@Keramikus-97

Copy link
Copy Markdown
Owner

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.pyConfig dataclass loaded from env vars (GITHUB_TOKEN, ANTHROPIC_API_KEY, OPENCODE_MODEL, etc.) with validation
  • comment_parser.py — regex-based extraction of /oc//opencode commands from comment bodies, with quoted-argument splitting
  • github_client.py — async httpx-based GitHub REST API wrapper (GitHubClient) for PRs, comments, reactions
  • webhook_handler.py — webhook signature verification (HMAC-SHA256), event classification, and payload parsing for issue_comment / pull_request_review_comment

Test suite (tests/): 62 tests across 4 test files, 99.43% line coverage. Uses pytest, pytest-asyncio, and respx for HTTP mocking.

Tooling: pyproject.toml with ruff for linting/formatting, pytest-cov with 80% minimum threshold.

Note: A CI workflow (tests.yml) was prepared but couldn't be pushed due to OAuth workflow scope limitations. It can be added manually.

Link to Devin session: https://app.devin.ai/sessions/77c1168b8c7f448c82e6a2d0df18cda2
Requested by: @Keramikus-97

- 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 Keramikus-97 merged commit e421994 into main Jun 6, 2026
@Keramikus-97 Keramikus-97 deleted the devin/1780753521-add-modules-and-tests branch June 6, 2026 13:51

@Keramikus-97 Keramikus-97 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Details

@Keramikus-97 Keramikus-97 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Details

@Keramikus-97 Keramikus-97 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

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
]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

🚩 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.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

fatal: couldn't find remote ref devin/1780753521-add-modules-and-tests

opencode session  |  github run

@Keramikus-97 Keramikus-97 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.

1 participant