Repository navigation
Feat: Add more file params - #11135
Conversation
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughWalkthroughAdds 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
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✏️ Tip: You can disable this entire section by setting 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. Comment |
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
There was a problem hiding this comment.
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 andfiles[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
📒 Files selected for processing (2)
src/Appwrite/Utopia/Response/Model/File.phptests/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
Documenttype used in thefilter()method parameter and theCompressionclass used for the constants in the description.
82-93: LGTM!The new
encryptionandcompressionvalidation 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 fromopenSSLCipherpresence and the direct mapping ofalgorithmtocompressionare 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
compressionandencryptionfields.
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.
✨ Benchmark results
⚡ Benchmark Comparison
|
There was a problem hiding this comment.
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) andcompression(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.
|
Bypassed rule; new change was only comment change |
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