Skip to content

chore: custom format instance in specs#10830

Merged
Meldiron merged 3 commits into1.8.xfrom
chore-formatinstance
Nov 18, 2025
Merged

chore: custom format instance in specs#10830
Meldiron merged 3 commits into1.8.xfrom
chore-formatinstance

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

@ChiragAgg5k ChiragAgg5k commented Nov 18, 2025

allows you to override formatInstance if extending the parent specs

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 18, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

A new protected helper method getFormatInstance() was added to the Specs class to encapsulate format instance creation logic. The method uses a match expression to handle 'swagger2' and 'open-api3' formats, throwing an exception for unknown types. Two existing call sites that previously contained inlined match expressions were refactored to use this new helper method, reducing code duplication.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file affected with straightforward method extraction
  • Homogeneous refactoring pattern applied consistently at two call sites
  • No complex logic introduced; verification needed to ensure match expression behavior is preserved identically across both refactored locations

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a description explaining the purpose of extracting the format instance logic, benefits of the refactoring, and any relevant context.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refactoring to extract a custom format instance helper method in the Specs class.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-formatinstance

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 275ff3d and 5a8a900.

📒 Files selected for processing (1)
  • src/Appwrite/Platform/Tasks/Specs.php (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/Appwrite/Platform/Tasks/Specs.php (3)
src/Appwrite/SDK/Specification/Format/Swagger2.php (1)
  • Swagger2 (25-886)
src/Appwrite/SDK/Specification/Format/OpenAPI3.php (1)
  • OpenAPI3 (24-886)
src/Appwrite/Extend/Exception.php (1)
  • Exception (7-465)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: E2E Service Test (Teams)
  • GitHub Check: E2E Service Test (Storage)
  • GitHub Check: E2E Service Test (Sites)
  • GitHub Check: E2E Service Test (VCS)
  • GitHub Check: E2E Service Test (Migrations)
  • GitHub Check: E2E Service Test (Webhooks)
  • GitHub Check: E2E Service Test (Projects)
  • GitHub Check: E2E Service Test (Proxy)
  • GitHub Check: E2E Service Test (Databases/TablesDB)
  • GitHub Check: E2E Service Test (Account)
  • GitHub Check: E2E Service Test (FunctionsSchedule)
  • GitHub Check: E2E Service Test (Functions)
  • GitHub Check: E2E Service Test (Console)
  • GitHub Check: E2E Service Test (Databases/Legacy)
  • GitHub Check: E2E Service Test (Avatars)
  • GitHub Check: E2E Service Test (Site Screenshots)
  • GitHub Check: E2E Service Test (Dev Keys)
  • GitHub Check: E2E General Test
  • GitHub Check: Benchmark
🔇 Additional comments (2)
src/Appwrite/Platform/Tasks/Specs.php (2)

48-52: LGTM!

The match expression correctly handles both format types and provides clear error messaging for unsupported formats. The use of argument spreading is appropriate.


300-300: LGTM! Good refactoring.

The refactoring successfully eliminates code duplication by centralizing format instantiation logic while maintaining the same behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 18, 2025

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
imagemagick 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-c++ 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-dev 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-heic 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jpeg 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-jxl 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-libs 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-openexr 7.1.2.3-r0 CVE-2025-62171 HIGH
imagemagick-webp 7.1.2.3-r0 CVE-2025-62171 HIGH
libecpg 17.6-r0 CVE-2025-12818 HIGH
libecpg-dev 17.6-r0 CVE-2025-12818 HIGH
libpq 17.6-r0 CVE-2025-12818 HIGH
libpq-dev 17.6-r0 CVE-2025-12818 HIGH
libxml2 2.13.8-r0 CVE-2025-49794 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49796 CRITICAL
libxml2 2.13.8-r0 CVE-2025-49795 HIGH
libxml2 2.13.8-r0 CVE-2025-6021 HIGH
postgresql17-dev 17.6-r0 CVE-2025-12818 HIGH
github.com/containerd/containerd/v2 v2.0.2 CVE-2024-25621 HIGH
golang.org/x/crypto v0.31.0 CVE-2025-22869 HIGH
golang.org/x/oauth2 v0.24.0 CVE-2025-22868 HIGH
stdlib 1.22.10 CVE-2025-47907 HIGH
stdlib 1.22.10 CVE-2025-58183 HIGH
stdlib 1.22.10 CVE-2025-58186 HIGH
stdlib 1.22.10 CVE-2025-58187 HIGH
stdlib 1.22.10 CVE-2025-58188 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors duplicated code in the Specs task by extracting a repetitive match expression into a reusable method. The purpose is to improve code maintainability by reducing duplication.

  • Introduced getFormatInstance() method to centralize format instance creation logic
  • Replaced inline match expression with method call to reduce code duplication

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 18, 2025

✨ Benchmark results

  • Requests per second: 1,202
  • Requests with 200 status code: 216,379
  • P99 latency: 0.161240353

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,202 1,288
200 216,379 231,869
P99 0.161240353 0.158178738

@Meldiron Meldiron merged commit e6039cf into 1.8.x Nov 18, 2025
42 checks passed
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.

3 participants