Skip to content

feat: improve SDK PR summary with platform grouping and clipboard copy#11639

Merged
ChiragAgg5k merged 4 commits into1.9.xfrom
improve-sdk-pr-summary
Mar 25, 2026
Merged

feat: improve SDK PR summary with platform grouping and clipboard copy#11639
ChiragAgg5k merged 4 commits into1.9.xfrom
improve-sdk-pr-summary

Conversation

@ChiragAgg5k
Copy link
Member

Summary

  • Groups PR links by platform (Client, Console, Server) in the summary output
  • Adds prompt to copy the PR summary to clipboard in markdown format after display
  • Supports comma-separated platform selection (e.g. client,server) in addition to single platform or *

Test plan

  • Run sdks task with git push enabled and verify PR summary is grouped by platform
  • Verify pressing Enter copies markdown summary to clipboard
  • Test comma-separated platform selection (e.g. client,server)
  • Test single platform and * still work as before

- Group PR links by platform (Client, Console, Server) in the summary
- Add option to copy PR summary to clipboard in markdown format
- Support comma-separated platform selection (e.g. "client,server")
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eb99c6b0-731b-4c6e-b130-b8cde36c140b

📥 Commits

Reviewing files that changed from the base of the PR and between f3fcdec and b742f1c.

📒 Files selected for processing (1)
  • src/Appwrite/Platform/Tasks/SDKs.php

📝 Walkthrough

Walkthrough

Platform selection now accepts comma-separated platform keys (or */no selection → null), parsed into a trimmed selectedPlatforms array. Each entry is validated against static::getPlatforms() with an “Unknown platform … Options are …” exception for invalid values. SDK generation filters by membership in selectedPlatforms. Pull request URL tracking moved from a flat map to a nested map keyed by platform then SDK ($prUrls[$platformName][$sdkName]); createPullRequest(...) and updateExistingPr(...) now receive $platformName. The PR summary is grouped by platform with indented per‑SDK URLs. The “Examples copied” message can include an optional label from $languageTitle and prints the destination path including $languagePath.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: platform grouping in PR summary output and clipboard copy functionality, matching the primary refactoring efforts in the changeset.
Description check ✅ Passed The description clearly relates to the changeset, covering the three main modifications: platform grouping, clipboard copy feature, and comma-separated platform selection support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-sdk-pr-summary

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.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 25, 2026

Greptile Summary

This PR enhances the SDKs task in three ways: PR links in the summary are now grouped by platform (Client/Console/Server), a clipboard copy step is added after displaying the summary, and platform selection now supports comma-separated values (e.g. client,server) in addition to *.

The structural change to $prUrls (from a flat [sdkName => url] map to a nested [platformName => [sdkName => url]] map) is consistently applied across createPullRequest, updateExistingPr, and the summary display loop.

Key concerns:

  • Blocking prompt in CI: The new Console::confirm('Press Enter to copy PR summary to clipboard') call will hang indefinitely when the task runs non-interactively (e.g. with --git=yes in a CI pipeline). Since $prUrls is only populated when git push is enabled — which can be controlled via a CLI argument — this is a realistic automated scenario.
  • Clipboard fragility on Linux/Wayland: The fallback command xclip -selection clipboard is not available on Wayland sessions; wl-copy is needed there. The current error handling is graceful but the user receives no hint about which package to install.
  • Silent failure for invalid comma-separated platform names: Misspelled entries (e.g. client,servr) are silently skipped with no warning, which can confuse users into thinking a platform was processed when it was not.

Confidence Score: 3/5

  • The PR is feature-complete for interactive use but has a blocking stdin issue that can hang automated/CI runs when --git=yes is passed non-interactively.
  • The nested $prUrls restructuring is cleanly done, but the unconditional Console::confirm clipboard prompt will cause the process to hang in non-interactive automated runs (a real usage path when --git=yes is supplied via CLI args). This is a P1 concern that should be resolved before merging. The other two issues (Wayland clipboard support, platform validation) are P2 improvements.
  • src/Appwrite/Platform/Tasks/SDKs.php — specifically lines 560 (blocking clipboard prompt) and 143 (unvalidated platform names).

Important Files Changed

Filename Overview
src/Appwrite/Platform/Tasks/SDKs.php Adds platform grouping to the PR summary display and clipboard copy flow, and supports comma-separated platform selection; the new Console::confirm for clipboard copy blocks CI/automated runs without a TTY guard, the Linux clipboard command doesn't cover Wayland, and invalid comma-separated platform names are silently ignored.

Reviews (1): Last reviewed commit: "feat: improve SDK PR summary with platfo..." | Re-trigger Greptile

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

🔄 PHP-Retry Summary

Flaky tests detected across commits:

Commit d535b6b - 2 flaky tests
Test Retries Total Time Details
UsageTest::testVectorsDBStats 1 10.02s Logs
TablesDBPermissionsGuestTest::testReadDocuments with data set #5 1 241.03s Logs
Commit 647099e - 4 flaky tests
Test Retries Total Time Details
UsageTest::testVectorsDBStats 1 10.10s Logs
LegacyConsoleClientTest::testAttributeResponseModels 1 242.27s Logs
LegacyCustomClientTest::testAttributeResponseModels 1 242.55s Logs
LegacyCustomClientTest::testInvalidDocumentStructure 1 240.55s Logs
Commit f3fcdec - 2 flaky tests
Test Retries Total Time Details
UsageTest::testVectorsDBStats 1 10.07s Logs
FunctionsScheduleTest::testCreateScheduledAtExecution 1 129.54s Logs
Commit b742f1c - 6 flaky tests
Test Retries Total Time Details
UsageTest::testVectorsDBStats 1 10.16s Logs
LegacyConsoleClientTest::testTimeout 1 123.75s Logs
LegacyCustomClientTest::testAttributeResponseModels 1 242.33s Logs
LegacyCustomServerTest::testCreateAttributes 1 242.26s Logs
LegacyCustomServerTest::testPatchAttribute 1 240.85s Logs
LegacyTransactionsConsoleClientTest::testBulkDeleteOperations 1 240.36s Logs

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

✨ Benchmark results

  • Requests per second: 2,097
  • Requests with 200 status code: 377,555
  • P99 latency: 0.086327061

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 2,097 1,338
200 377,555 240,898
P99 0.086327061 0.16544572

- Guard clipboard prompt with posix_isatty() to avoid blocking CI/automated runs
- Add Wayland support (wl-copy) and improve error message for missing clipboard tools
- Validate comma-separated platform names against getPlatforms()
Copy link
Contributor

@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: 2

🧹 Nitpick comments (1)
src/Appwrite/Platform/Tasks/SDKs.php (1)

705-706: Document the nested prUrls shape on these helpers.

Both signatures now depend on array<string, array<string, string>> &$prUrls, but that contract is still implicit. A short PHPDoc block here would make the new platform grouping much easier to follow.

📝 Example docblocks
+    /**
+     * `@param` array<string, mixed> $language
+     * `@param` array<string, array<string, string>> $prUrls
+     */
     private function createPullRequest(array $language, string $platformName, string $target, string $gitBranch, string $repoBranch, string $aiChangelog, array &$prUrls): void

+    /**
+     * `@param` array<string, array<string, string>> $prUrls
+     */
     private function updateExistingPr(string $repoName, string $gitBranch, string $prTitle, string $prBody, string $platformName, string $sdkName, array &$prUrls, string $existingPrUrl = ''): void

As per coding guidelines, "Include comprehensive PHPDoc comments".

Also applies to: 1129-1130

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Appwrite/Platform/Tasks/SDKs.php` around lines 705 - 706, The helper
createPullRequest currently accepts a reference parameter &$prUrls but does not
document its nested shape; add a PHPDoc block above createPullRequest (and any
other function that takes the same &$prUrls reference) declaring `@param`
array<string, array<string,string>> &$prUrls and describing the mapping (e.g.
platformName => [language => prUrl], with examples like ['github' => ['php' =>
'https://...']]) so callers and future maintainers understand the exact nested
array structure; ensure the PHPDoc mentions that the array is mutated by the
function and include a short return/void description.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 154-157: The platform loop currently bypasses the platform filter
when $sdks is set because the condition includes "&& ($sdks === null)"; update
the condition in the foreach over $platforms so the platform selection check
only depends on $selectedPlatforms (i.e. keep the check "if ($selectedPlatforms
!== null && !\in_array($key, $selectedPlatforms)) { continue; }"), removing the
$sdks === null clause so the --platform and --sdks selectors are intersected;
touch the loop that references $platforms, $selectedPlatforms and $sdks to apply
this change.
- Around line 581-595: The code assumes success if popen() returns a resource
but ignores the exit status of the clipboard command; change the logic in the
block that sets $copyCommand and uses \popen($copyCommand, 'w') so you capture
and check the return value of \pclose($process) and only call
Console::success('PR summary copied to clipboard!') when pclose returns a zero
(successful) exit status, otherwise call Console::error(...) with the exit code
or a descriptive message; reference the variables and functions $copyCommand,
\popen(), \fwrite(), \pclose(), and Console::success()/Console::error() so the
check is added immediately after the existing fwrite/pclose sequence.

---

Nitpick comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 705-706: The helper createPullRequest currently accepts a
reference parameter &$prUrls but does not document its nested shape; add a
PHPDoc block above createPullRequest (and any other function that takes the same
&$prUrls reference) declaring `@param` array<string, array<string,string>>
&$prUrls and describing the mapping (e.g. platformName => [language => prUrl],
with examples like ['github' => ['php' => 'https://...']]) so callers and future
maintainers understand the exact nested array structure; ensure the PHPDoc
mentions that the array is mutated by the function and include a short
return/void description.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e28c31b3-9ba3-489e-8395-1b82a63f90c6

📥 Commits

Reviewing files that changed from the base of the PR and between d535b6b and 647099e.

📒 Files selected for processing (1)
  • src/Appwrite/Platform/Tasks/SDKs.php

@blacksmith-sh

This comment has been minimized.

Copy link
Contributor

@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: 1

♻️ Duplicate comments (1)
src/Appwrite/Platform/Tasks/SDKs.php (1)

154-157: ⚠️ Potential issue | 🟠 Major

--sdks still bypasses the platform filter.

Line 156 keeps the && ($sdks === null) escape hatch, so --platform=client,server --sdks=web still walks every platform that defines web instead of intersecting the two selectors.

🔧 Minimal fix
-            if ($selectedPlatforms !== null && ! \in_array($key, $selectedPlatforms) && ($sdks === null)) {
+            if ($selectedPlatforms !== null && ! \in_array($key, $selectedPlatforms, true)) {
                 continue;
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Appwrite/Platform/Tasks/SDKs.php` around lines 154 - 157, The
platform-loop filter currently lets --sdks bypass --platform because the
condition includes "&& ($sdks === null)"; update the foreach filter so it only
checks $selectedPlatforms against $key (remove the $sdks === null check) — i.e.,
in the loop over $platforms ($platforms, foreach with $key and $platform) use if
($selectedPlatforms !== null && !\in_array($key, $selectedPlatforms)) continue;
so both $selectedPlatforms and $sdks selectors are applied (ensure subsequent
logic that filters SDK entries still uses $sdks).
🧹 Nitpick comments (1)
src/Appwrite/Platform/Tasks/SDKs.php (1)

675-676: Add PHPDoc for the new PR-helper contracts.

Both signatures gained extra context plus a nested by-reference array, but neither method documents the expected $language keys or the $prUrls[$platformName][$sdkName] shape. Please add/update PHPDoc here so the contract is explicit.

As per coding guidelines, "Include comprehensive PHPDoc comments".

Also applies to: 1099-1100

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Appwrite/Platform/Tasks/SDKs.php` around lines 675 - 676, Add/update
comprehensive PHPDoc for the PR-helper methods (including createPullRequest and
the other PR-helper in this class) that documents the expected structure of the
$language array (list the required keys and their types/meaning) and the exact
shape of the by-reference $prUrls structure (clarify that
$prUrls[$platformName][$sdkName] will be populated with URL strings, its types,
and when/why it is mutated). Also annotate parameter types (array|string) and
the void return, and mention that $prUrls is modified by reference so callers
can rely on populated entries for the given $platformName and $sdkName.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 557-568: The current summary block prints the grouped PR URLs
using $prUrls and Console::log/Console::info but never constructs the Markdown,
prompts the user, or invokes the clipboard copy, so add those steps after the
existing Console::log('') that ends the block: call a markdown builder (e.g.,
buildPullRequestMarkdown($prUrls) or buildPRSummaryMarkdown($prUrls)) to produce
the markdown string, then prompt/wait for Enter with
Console::info/Console::prompt (e.g., "Press Enter to copy the PR summary"), and
finally call the clipboard helper (e.g., Clipboard::copy($markdown) or
copyToClipboard($markdown)) and log a success message; reference the same
$prUrls variable and existing Console methods when inserting these calls.

---

Duplicate comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 154-157: The platform-loop filter currently lets --sdks bypass
--platform because the condition includes "&& ($sdks === null)"; update the
foreach filter so it only checks $selectedPlatforms against $key (remove the
$sdks === null check) — i.e., in the loop over $platforms ($platforms, foreach
with $key and $platform) use if ($selectedPlatforms !== null && !\in_array($key,
$selectedPlatforms)) continue; so both $selectedPlatforms and $sdks selectors
are applied (ensure subsequent logic that filters SDK entries still uses $sdks).

---

Nitpick comments:
In `@src/Appwrite/Platform/Tasks/SDKs.php`:
- Around line 675-676: Add/update comprehensive PHPDoc for the PR-helper methods
(including createPullRequest and the other PR-helper in this class) that
documents the expected structure of the $language array (list the required keys
and their types/meaning) and the exact shape of the by-reference $prUrls
structure (clarify that $prUrls[$platformName][$sdkName] will be populated with
URL strings, its types, and when/why it is mutated). Also annotate parameter
types (array|string) and the void return, and mention that $prUrls is modified
by reference so callers can rely on populated entries for the given
$platformName and $sdkName.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1a6ff669-1df0-4944-a5c6-e2f94a6735a2

📥 Commits

Reviewing files that changed from the base of the PR and between 647099e and f3fcdec.

📒 Files selected for processing (1)
  • src/Appwrite/Platform/Tasks/SDKs.php

@ChiragAgg5k ChiragAgg5k merged commit c518632 into 1.9.x Mar 25, 2026
78 of 79 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.

2 participants