[Fix] Resolves issue with GitHub App Auto Creation#1153
Conversation
📝 WalkthroughWalkthroughThe GitHub app manifest conversion process is enhanced with better observability and error reporting. A User-Agent header is added to outbound HTTP requests, conversion failures are logged with full response details, and error messages from the GitHub API response are extracted and included in the ValidationException. A test verifies the request is sent to the correct endpoint. ChangesGitHub App Manifest Conversion Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/Actions/GithubApp/CreateGithubAppFromManifest.php (1)
13-13: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueOptional: Add PHPDoc
@throwsannotation.The method throws
ValidationExceptionbut lacks a PHPDoc block documenting this. As per coding guidelines,@throwsannotations must reflect reality.📝 Proposed PHPDoc addition
+ /** + * Create a GitHub App from a manifest code. + * + * `@throws` ValidationException + */ public function create(string $code): GithubApp🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php` at line 13, The create method in CreateGithubAppFromManifest::create throws a ValidationException but has no PHPDoc; add a PHPDoc block above the public function create(string $code): GithubApp documenting the thrown exception (e.g., `@throws` ValidationException) so tools and readers know this can be raised; ensure the exception class is the correct namespaced type used in the method.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php`:
- Around line 33-40: The validation error builds a message in
CreateGithubAppFromManifest::(throw ValidationException::withMessages) that
always includes a colon even when $message is empty, producing "HTTP 404):.";
change the logic that builds 'status_message' so the colon and message are only
appended when $message is non-empty (e.g., compute $status_message = $message
!== '' ? ': '.$message : '' and pass that into the __('Failed to convert
manifest (HTTP :status):status_message.') call or adjust the translation string
to not hardcode the colon), ensuring the thrown
ValidationException::withMessages uses the cleaned-up $status_message.
In `@tests/Feature/GithubAppTest.php`:
- Around line 81-84: Update the Http::assertSent closure in the test to also
check that the outgoing request method is POST and that the User-Agent header
set in the Action (line 24) is present and equals the expected value; locate the
Http::assertSent(...) closure and add checks against $request->method() ===
'POST' and $request->header('User-Agent') (or headerLine) matching the Action's
User-Agent value so the assertion validates URL, body, method, and header.
---
Outside diff comments:
In `@app/Actions/GithubApp/CreateGithubAppFromManifest.php`:
- Line 13: The create method in CreateGithubAppFromManifest::create throws a
ValidationException but has no PHPDoc; add a PHPDoc block above the public
function create(string $code): GithubApp documenting the thrown exception (e.g.,
`@throws` ValidationException) so tools and readers know this can be raised;
ensure the exception class is the correct namespaced type used in the method.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 692b0892-ea29-4766-aea6-3ee75859b9d8
📒 Files selected for processing (2)
app/Actions/GithubApp/CreateGithubAppFromManifest.phptests/Feature/GithubAppTest.php
Github App automatic creation currently fails with the error:
links/0/schema', [] is not a null or object.This was due to Laravel automatically sending and empty array on post, whereas Github expects a null or empty string. This PR resolves this by moving to sending the post manually instead of using the ->post helper.
Summary by CodeRabbit