feat: implement Gitea webhook support#74
Conversation
- Implement getEvent() for push and pull_request events - Implement validateWebhookEvent() with HMAC-SHA256 validation - Parse webhook payloads to match GitHub adapter format - Add comprehensive test coverage for all webhook scenarios - Test push events with affected files tracking - Test pull request events including external/fork detection - Test signature validation (valid and invalid cases) - Test error handling for invalid payloads and unsupported events - Add abstract method stub for PHPStan compatibility Resolves webhook functionality for Gitea adapter
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Greptile SummaryThis PR implements the previously stubbed Key observations:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: "feat: implement Gite..." |
tests/VCS/Adapter/GiteaTest.php
Outdated
| public function testGetEvent(): void | ||
| { | ||
| $this->markTestSkipped('Will be implemented in follow-up PR'); | ||
| // Base class requires this method - implemented via specific event tests below | ||
| $this->assertTrue(true); | ||
| } |
There was a problem hiding this comment.
Trivially-passing assertion provides no coverage
$this->assertTrue(true) is a no-op test — it will always pass regardless of the implementation state, and gives false confidence in test coverage. The PR description says "Base class requires this method — implemented via specific event tests below," but a comment explaining this (with no assertion) or delegating to one of the more specific tests would communicate intent more clearly without adding a meaningless green tick.
tests/VCS/Adapter/GiteaTest.php
Outdated
| public function testGetEvent(): void | ||
| { | ||
| $this->markTestSkipped('Will be implemented in follow-up PR'); | ||
| // Base class requires this method - implemented via specific event tests below |
There was a problem hiding this comment.
Nice idea of splitting it for different types of webhook pyloads.
Can you please remove this method, also from GitHub, and implement those specific event tests in GitHub as well?
| $this->assertIsArray($result); | ||
| $this->assertEmpty($result); | ||
| } | ||
|
|
There was a problem hiding this comment.
All tests you implemented are great, but they serve unit-test purpose, by mocking expected payloads.
Let's add E2E tests that actually configured webhook on Gitea, and triggers it by making a push and pull request.
We can point webhook to request-catcher - we can introduce this container in docker-compose - just like in appwrite/appwrite.
We can then have method to get last request, and use it to get payload in tests after triggering it.
Something like this, but simpler: https://github.com/appwrite/appwrite/blob/dabe98d4a1cc150dda639767ba105da5b491dd3b/tests/e2e/Scopes/Scope.php#L314
(In Appwrite, we have multiple different request catchers, but here, we can just use one)
… and removed the testgetevent
Resolves webhook functionality for Gitea adapter