Skip to content

Feat: Add more file params - #11135

Merged
Meldiron merged 3 commits into
1.8.xfrom
feat-new-file-params
Jan 14, 2026
Merged

Meldiron merged 3 commits into
1.8.xfrom
feat-new-file-params

Conversation

@Meldiron

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds encryption and compression as params (can only be read, cannot query by them)

Test Plan

New tests

Related PRs and Issues

x

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

coderabbitai Bot commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

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

Adds encryption and compression metadata handling to the File response model: two new validation rules (encryption: boolean, compression: string) and a new filter(Document) method that maps a Document's algorithm attribute to compression and derives encryption from the presence of an OpenSSL cipher attribute. Adds an end-to-end test that exercises bucket-level and per-file encryption/compression settings across upload, list, get, update, and delete operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • eldadfux
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% 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 'Feat: Add more file params' directly summarizes the main change: introducing new file parameters (encryption and compression) to the File model.
Description check ✅ Passed The description is related to the changeset, explaining that encryption and compression parameters are being added as read-only fields with corresponding tests.

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

✨ Finishing touches
  • 📝 Generate docstrings


📜 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 e4abc0e and e76ed98.

📒 Files selected for processing (1)
  • tests/e2e/Services/Storage/StorageCustomClientTest.php

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

github-actions Bot commented Jan 14, 2026 •

Copy link
Copy Markdown

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
libpng 1.6.51-r0 CVE-2025-66293 HIGH
libpng-dev 1.6.51-r0 CVE-2025-66293 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tests/e2e/Services/Storage/StorageCustomClientTest.php`:
- Line 1512: The comment in StorageCustomClientTest (near the test method or
block referencing existing file update) contains a typo: change "Existing fie
did not update" to "Existing file did not update" so the comment reads
correctly; locate the comment in the StorageCustomClientTest.php test case and
update the string accordingly.
🧹 Nitpick comments (1)
tests/e2e/Services/Storage/StorageCustomClientTest.php (1)

1543-1553: Test assumes specific file ordering in list response.

The assertions rely on files[0] being the first uploaded file and files[1] being the second. If the API's default sort order changes, this test could become flaky. Consider asserting on specific file IDs or adding explicit sorting to make the test more robust.

♻️ Example fix using file IDs
// Store file IDs during creation
$file1Id = /* first file ID */;
$file2Id = /* second file ID */;

// In list assertions, find files by ID
$file1InList = array_filter($files['body']['files'], fn($f) => $f['$id'] === $file1Id);
$file2InList = array_filter($files['body']['files'], fn($f) => $f['$id'] === $file2Id);
📜 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 6478499 and e4abc0e.

📒 Files selected for processing (2)
  • src/Appwrite/Utopia/Response/Model/File.php
  • tests/e2e/Services/Storage/StorageCustomClientTest.php
⏰ 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 (7)
src/Appwrite/Utopia/Response/Model/File.php (3)

7-8: LGTM!

The imports are correctly added for the Document type used in the filter() method parameter and the Compression class used for the constants in the description.


82-93: LGTM!

The new encryption and compression validation rules are well-defined with appropriate types, defaults, and descriptive documentation including external references.


117-125: LGTM!

The filter() method correctly maps internal document attributes to the public API model fields. The encryption derivation from openSSLCipher presence and the direct mapping of algorithm to compression are straightforward and appropriate.

tests/e2e/Services/Storage/StorageCustomClientTest.php (4)

1451-1466: LGTM!

Test setup is well-structured, creating a bucket with encryption and gzip compression enabled.


1469-1499: LGTM!

Good test coverage for file creation, retrieval, and listing operations, with proper assertions for the new compression and encryption fields.


1521-1541: LGTM!

Good verification that new files created after bucket update receive the updated settings (compression: 'none', encryption: false).


1555-1562: LGTM!

Proper cleanup of test resources at the end of the test method.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@github-actions

github-actions Bot commented Jan 14, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

  • Requests per second: 2,207
  • Requests with 200 status code: 397,293
  • P99 latency: 0.080744733

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 2,207 1,248
200 397,293 224,751
P99 0.080744733 0.162253349

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds encryption and compression metadata fields to the File model, allowing these properties to be read (but not queried) through the API. The implementation maps internal database attributes (algorithm and openSSLCipher) to user-facing field names (compression and encryption).

Changes:

  • Added encryption (boolean) and compression (string) fields to the File response model
  • Implemented a filter() method to map internal database attributes to the new API fields
  • Added comprehensive end-to-end test coverage for the new fields

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Appwrite/Utopia/Response/Model/File.php Adds two new fields (encryption, compression) to the File model and implements a filter method to populate them from database attributes
tests/e2e/Services/Storage/StorageCustomClientTest.php Adds comprehensive e2e test verifying that encryption/compression settings are correctly inherited from bucket configuration and persisted with files

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

@Meldiron
Meldiron merged commit b73abf6 into 1.8.x Jan 14, 2026
5 checks passed
@Meldiron

Copy link
Copy Markdown
Contributor Author

Bypassed rule; new change was only comment change

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