Skip to content

Set downloadUrl on realtime event#10847

Merged
abnegate merged 1 commit into1.8.xfrom
feat-csv-export
Nov 20, 2025
Merged

Set downloadUrl on realtime event#10847
abnegate merged 1 commit into1.8.xfrom
feat-csv-export

Conversation

@abnegate
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does and why it's needed.)

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?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 20, 2025

📝 Walkthrough

Walkthrough

Changes to src/Appwrite/Platform/Workers/Migrations.php add real-time queue support to CSV export completion handling. The action method signature is updated to accept a Realtime $queueForRealtime parameter, which is then propagated to handleCSVExportComplete. The method now computes and stores the download URL in migration options, updates the migration document via the Realtime queue, and passes the download URL to the CSV notification email workflow to ensure real-time synchronization of migration status updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Parameter propagation: Verify that Realtime $queueForRealtime is correctly passed through all call sites invoking handleCSVExportComplete and that no existing call paths are missed
  • Download URL handling: Ensure the computed download URL is correctly stored in migration options and properly validated before being used downstream
  • Real-time queue updates: Confirm that calls to updateMigrationDocument using the Realtime queue occur at appropriate points and don't introduce race conditions
  • Email workflow integration: Validate that the download URL is correctly formatted and accessible when passed to the CSV notification email workflow
  • Migration document consistency: Check that document updates via Realtime queue maintain consistency with any parallel database updates

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is completely empty and consists only of the default contribution template with no actual details about the changes, making it unrelated to the changeset. Provide a meaningful description explaining what the PR does, why the downloadUrl needs to be set on realtime events, and include test plan details.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Set downloadUrl on realtime event' is specific and directly related to the changeset, which adds download URL handling with real-time queue propagation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ 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 feat-csv-export

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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

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

@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 (2)
src/Appwrite/Platform/Workers/Migrations.php (2)

421-437: Add docblock entry for the new Realtime parameter

handleCSVExportComplete now depends on Realtime $queueForRealtime (Line 436), but the docblock doesn’t mention it. Adding the missing @param improves IDE support and keeps the documentation in sync with the signature.

-     * @param Mail $queueForMails
+     * @param Mail $queueForMails
+     * @param Realtime $queueForRealtime

530-537: Consider avoiding duplicate migrations.[migrationId].update realtime events

Lines 534–536 persist downloadUrl into options and call updateMigrationDocument, but processMigration() already calls updateMigrationDocument in the finally block (Line 384). For successful CSV exports this results in two back‑to‑back realtime updates for the same final completed state: one without downloadUrl, then one with it.

Functionally this is fine, but if you want a single final update (and less noise on the Realtime channel), you could refactor so that the CSV‑success path only calls updateMigrationDocument once, after downloadUrl is attached.

📜 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 4616a2e and 2443266.

📒 Files selected for processing (1)
  • src/Appwrite/Platform/Workers/Migrations.php (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10546
File: src/Appwrite/Platform/Workers/Migrations.php:144-148
Timestamp: 2025-10-23T08:06:38.889Z
Learning: In the Appwrite codebase, migration workers receive already-validated data from queued jobs. Query validation using Query::parseQueries() happens at the API endpoint level (with try-catch for QueryException) before jobs are queued, so workers in src/Appwrite/Platform/Workers/Migrations.php don't need redundant validation.
Learnt from: abnegate
Repo: appwrite/appwrite PR: 10800
File: src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php:153-154
Timestamp: 2025-11-12T04:07:12.576Z
Learning: In Appwrite's event queue system, `queueForRealtime`, `queueForFunctions`, and `queueForWebhooks` are copied from `queueForEvents`. Therefore, when resetting event queues in transaction staging paths, only `$queueForEvents->reset()` needs to be called in most cases. The other queues only require explicit reset when they are triggered in a loop.
🧬 Code graph analysis (1)
src/Appwrite/Platform/Workers/Migrations.php (2)
src/Appwrite/Event/Mail.php (1)
  • Mail (7-442)
src/Appwrite/Messaging/Adapter/Realtime.php (1)
  • Realtime (12-382)
⏰ 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). (3)
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: Setup & Build Appwrite Image
  • GitHub Check: scan
🔇 Additional comments (1)
src/Appwrite/Platform/Workers/Migrations.php (1)

413-415: Realtime queue wiring for CSV completion looks correct

Passing $queueForRealtime into handleCSVExportComplete here keeps the dependency aligned with the updated method signature and the rest of the migration lifecycle; argument order and types are consistent with processMigration.

@github-actions
Copy link
Copy Markdown

✨ Benchmark results

  • Requests per second: 1,095
  • Requests with 200 status code: 197,191
  • P99 latency: 0.173820618

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 1,095 1,142
200 197,191 205,522
P99 0.173820618 0.181744124

@abnegate abnegate merged commit 0cdabbf into 1.8.x Nov 20, 2025
42 checks passed
@abnegate abnegate deleted the feat-csv-export branch November 20, 2025 06:01
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.

1 participant