8000 If build has failed, show correct error page by vermakhushboo · Pull Request #9569 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

If build has failed, show correct error page #9569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 26, 2025

Conversation

vermakhushboo
Copy link
Member
@vermakhushboo vermakhushboo commented Mar 24, 2025

What does this PR do?

If router tries to access a domain of a failed build, show appropriate error message.

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • New Features
    • Enhanced error notifications for build failures, providing clearer, actionable feedback when a build does not complete successfully.
    • Improved deployment error handling that distinguishes between different build states, ensuring more accurate guidance for users to check logs for further details.
    • Added a new test case to validate deployment behavior for failed builds.
  • Bug Fixes
    • Introduced a specific error handling mechanism for failed builds, improving the granularity of error reporting.

@vermakhushboo vermakhushboo requested a review from Meldiron March 24, 2025 10:21
Copy link
coderabbitai bot commented Mar 24, 2025

Walkthrough

This pull request enhances error handling for build processes by adding a specific configuration for the BUILD_FAILED exception, introducing a new constant in the Exception class, and updating the controller's routing logic to throw distinct exceptions based on deployment status. These modifications ensure that failed builds are reported with a dedicated error message and code, while also refining checks for pending or in-progress build states.

Changes

Files Change Summary
app/config/errors.php
src/Appwrite/Extend/Exception.php
Added the BUILD_FAILED error handling mechanism. In the configuration file, an entry is added with name, description, and code 400, and a new constant BUILD_FAILED (value 'build_failed') is defined in the Exception class.
app/controllers/general.php Enhanced the router’s error handling logic: now it throws an AppwriteException with type BUILD_NOT_READY when status is waiting, processing, or building, and throws an AppwriteException with type BUILD_FAILED when status is failed.
tests/e2e/Services/Sites/SitesCustomServerTest.php Added a new test method testDomainForFailedDeloyment to verify the handling of failed deployments, including checks for deployment status and error messages.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Controller as General Controller
    participant ExceptionHandler as AppwriteException

    Client->>Controller: Initiate deployment request
    Controller->>Controller: Check deployment status
    alt Status is waiting/processing/building
        Controller->>ExceptionHandler: Throw BUILD_NOT_READY exception
    else Status is failed
        Controller->>ExceptionHandler: Throw BUILD_FAILED exception
    end
Loading

Suggested reviewers

  • Meldiron

Poem

I'm a tiny rabbit, hopping with delight,
In a world of code, I bring changes to light.
BUILD_FAILED now stands with its name so clear,
And routing checks chase away any fear.
My ears perk up as errors now sing—
A code garden blooming, oh what joy they bring!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
github-actions bot commented Mar 24, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
github-actions bot commented Mar 24, 2025

✨ Benchmark results

  • Requests per second: 925
  • Requests with 200 status code: 166,479
  • P99 latency: 0.19926614

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 925 1,206
200 166,479 217,119
P99 0.19926614 0.153714083

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)

2397-2432: Good test addition, but there's a typo in the method name.

The test effectively verifies that an appropriate error page is displayed when attempting to access a domain associated with a failed build. However, the method name should be corrected.

-    public function testDomainForFailedDeloyment(): void
+    public function testDomainForFailedDeployment(): void
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd18edc and 3b9318c.

📒 Files selected for processing (2)
  • app/controllers/general.php (1 hunks)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/controllers/general.php
🧰 Additional context used
🧬 Code Definitions (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (4)
tests/e2e/Services/Sites/SitesBase.php (5)
  • setupSite (20-33)
  • setupSiteDomain (329-347)
  • createDeployment (237-245)
  • getDeployment (171-179)
  • cleanupSite (69-78)
tests/e2e/Client.php (2)
  • Client (8-317)
  • call (167-277)
tests/e2e/Services/Functions/FunctionsBase.php (2)
  • createDeployment (224-232)
  • getDeployment (160-168)
src/Executor/Executor.php (1)
  • call (290-416)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: scan

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)

2397-2432: Method name has a typo, but implementation correctly tests failed build error handling.

The test method successfully verifies that when a router attempts to access a domain associated with a failed build, the correct error message is displayed. However, there's a typo in the method name: testDomainForFailedDeloyment should be testDomainForFailedDeployment.

-    public function testDomainForFailedDeloyment(): void
+    public function testDomainForFailedDeployment(): void
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b9318c and 583a18d.

📒 Files selected for processing (1)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: E2E Service Test (Messaging)
  • GitHub Check: E2E Service Test (Migrations)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (Realtime)
  • GitHub Check: E2E Service Test (Databases)
  • GitHub Check: E2E Service Test (Teams)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (Locale)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Health)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: Benchmark
  • GitHub Check: E2E General Test
  • GitHub Check: Unit Test
  • GitHub Check: scan

@Meldiron Meldiron merged commit 3b1f2af into feat-sites Mar 26, 2025
31 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 26, 2025
2 tasks
@coderabbitai coderabbitai bot mentioned this pull request Apr 2, 2025
2 tasks
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.

2 participants
0